Update tutorial nav

This commit is contained in:
ddawson
2024-02-29 14:17:51 -08:00
committed by Amarantha Kulkarni
parent 05c0191e5a
commit f0c5b6141a
120 changed files with 3169 additions and 532 deletions

Binary file not shown.

View File

@@ -58,24 +58,6 @@
<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
@@ -153,24 +135,6 @@
<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

View File

@@ -0,0 +1,278 @@
<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='ripplex10-check.js'></script>
</head>
<!-- ************************************************************** -->
<!-- ********************** The Form ****************************** -->
<!-- ************************************************************** -->
<body>
<h1>Token Test Harness</h1>
<form id="theForm">
Choose your ledger instance:
&nbsp;&nbsp;
<input type="radio" id="tn" name="server"
value="wss://s.altnet.rippletest.net:51233" checked>
<label for="testnet">Testnet</label>
&nbsp;&nbsp;
<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">
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>
<td align="right">
Issuer
</td>
<td>
<input type="text" id="standbyIssuerField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Check ID
</td>
<td>
<input type="text" id="standbyCheckID" 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&#62;</button>
<br/><br/>
<button type="button" onClick="sendCheck()">Send Check</button>
<br/>
<button type="button" onClick="getChecks()">Get Checks</button>
<br/>
<button type="button" onClick="cashCheck()">Cash Check</button>
<br/>
<button type="button" onClick="cancelCheck()">Cancel Check</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()">&#60; Send XRP</button>
<br/><br/>
<button type="button" onClick="opSendCheck()">Send Check</button>
<br/>
<button type="button" onClick="opGetChecks()">Get Checks</button>
<br/>
<button type="button" onClick="opCashCheck()">Cash Check</button>
<br/>
<button type="button" onClick="opCancelCheck()">Cancel Check</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">
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 align="right">
Issuer
</td>
<td>
<input type="text" id="operationalIssuerField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Check ID
</td>
<td>
<input type="text" id="operationalCheckIDField" 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>

View File

@@ -58,24 +58,6 @@
<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
@@ -181,24 +163,6 @@
<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

View File

@@ -59,24 +59,6 @@
<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
@@ -211,24 +193,6 @@
<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

View File

@@ -61,24 +61,6 @@
<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
@@ -245,24 +227,6 @@
<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

View File

@@ -60,33 +60,13 @@
<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>
<button type="button" onClick="brGetOffers()">Get Offers</button>
</td>
</tr>
<tr>
@@ -95,7 +75,7 @@
</td>
<td>
<input type="text" id="brokerBalanceField" size="40"></input>
<br>
<button type="button" onClick="brCancelOffer()">Cancel Offer</button>
</td>
</tr>
<tr>
@@ -147,24 +127,6 @@
<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
@@ -331,24 +293,6 @@
<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

View File

@@ -62,24 +62,6 @@
<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
@@ -262,24 +244,6 @@
<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

View File

@@ -56,24 +56,6 @@
<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

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<title>Time-based Escrow Test Harness</title>
<link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
@@ -41,6 +41,7 @@
<td>
<table>
<tr valign="top">
<td>
<td>
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
<table>
@@ -115,24 +116,6 @@
<label for="standbyDefault">Allow Rippling</label>
</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
@@ -256,24 +239,6 @@
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
</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
@@ -288,6 +253,9 @@
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
</p>
</td>
</td>
</tr>
</td>
</tr>
</table>
</td>

View File

@@ -116,24 +116,6 @@
<label for="standbyDefault">Allow Rippling</label>
</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
@@ -258,24 +240,6 @@
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
</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

View File

@@ -51,16 +51,12 @@ async function getAccount(type) {
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.'
@@ -95,14 +91,10 @@ async function getAccountsFromSeeds() {
// ----------------------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))

View File

@@ -0,0 +1,329 @@
// *******************************************************
// ************* Standby Send Check **********************
// *******************************************************
async function sendCheck() {
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)
var check_amount = standbyAmountField.value
if (standbyCurrencyField.value != "XRP") {
check_amount = {
"currency": standbyCurrencyField.value,
"value": standbyAmountField.value,
"issuer": standby_wallet.address
}
}
const send_check_tx = {
"TransactionType": "CheckCreate",
"Account": standby_wallet.address,
"SendMax": check_amount,
"Destination": standbyDestinationField.value
}
const check_prepared = await client.autofill(send_check_tx)
const check_signed = standby_wallet.sign(check_prepared)
results += 'Sending ' + check_amount + ' ' + standbyCurrencyField + ' to ' +
standbyDestinationField.value + '...'
standbyResultField.value = results
const check_result = await client.submitAndWait(check_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${check_signed.hash}'
standbyResultField.value = JSON.stringify(check_result.result, null, 2)
} else {
results += 'Transaction failed: See JavaScript console for details.'
standbyResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of sendCheck()
// *******************************************************
// *************** Standby Get Checks ********************
// *******************************************************
async function getChecks() {
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '....'
standbyResultField.value = results
await client.connect()
results += '\nConnected.'
standbyResultField.value = results
results= "\nGetting standby account checks...\n"
const check_objects = await client.request({
"id": 5,
"command": "account_objects",
"account": standbyAccountField.value,
"ledger_index": "validated",
"type": "check"
})
standbyResultField.value = JSON.stringify(check_objects.result, null, 2)
client.disconnect()
} // End of getChecks()
// *******************************************************
// ************* Standby Cash Check **********************
// *******************************************************
async function cashCheck() {
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)
var check_amount = standbyAmountField.value
if (standbyCurrencyField.value != "XRP") {
check_amount = {
"value": standbyAmountField.value,
"currency": standbyCurrencyField.value,
"issuer": standbyIssuerField.value
}
}
const cash_check_tx = {
"TransactionType": "CheckCash",
"Account": standby_wallet.address,
"Amount": check_amount,
"CheckID": standbyCheckID.value
}
const cash_prepared = await client.autofill(cash_check_tx)
const cash_signed = standby_wallet.sign(cash_prepared)
results += ' Receiving ' + standbyAmountField.value + ' ' + standbyCurrencyField.value + '.\n'
standbyResultField.value = results
const check_result = await client.submitAndWait(cash_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
standbyResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
standbyResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of cashCheck()
// *******************************************************
// *************** Standby Cancel Check ******************
// *******************************************************
async function cancelCheck() {
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 cancel_check_tx = {
"TransactionType": "CheckCancel",
"Account": standby_wallet.address,
"CheckID": standbyCheckID.value
}
const cancel_prepared = await client.autofill(cancel_check_tx)
const cancel_signed = standby_wallet.sign(cancel_prepared)
results += ' Cancelling check.\n'
standbyResultField.value = results
const check_result = await client.submitAndWait(cancel_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
standbyResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
standbyResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of cancelCheck()
// *******************************************************
// ************ Operational Send Check *******************
// *******************************************************
async function opSendCheck() {
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 issue_quantity = operationalAmountField.value
var check_amount = operationalAmountField.value
if (operationalCurrencyField.value != "XRP") {
check_amount = {
"currency": operationalCurrencyField.value,
"value": operationalAmountField.value,
"issuer": operational_wallet.address
}
}
const send_check_tx = {
"TransactionType": "CheckCreate",
"Account": operational_wallet.address,
"SendMax": check_amount,
"Destination": operationalDestinationField.value
}
const check_prepared = await client.autofill(send_check_tx)
const check_signed = operational_wallet.sign(check_prepared)
results += '\nSending check to ' +
operationalDestinationField.value + '...'
operationalResultField.value = results
const check_result = await client.submitAndWait(check_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${check_signed.hash}'
operationalResultField.value = JSON.stringify(check_result.result, null, 2)
} else {
results += 'Transaction failed: See JavaScript console for details.'
operationalResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of opSendCheck()
// *******************************************************
// ************ Operational Get Checks *******************
// *******************************************************
async function opGetChecks() {
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '....'
operationalResultField.value = results
await client.connect()
results += '\nConnected.'
operationalResultField.value = results
results= "\nGetting standby account checks...\n"
const check_objects = await client.request({
"id": 5,
"command": "account_objects",
"account": operationalAccountField.value,
"ledger_index": "validated",
"type": "check"
})
operationalResultField.value = JSON.stringify(check_objects.result, null, 2)
client.disconnect()
} // End of opGetChecks()
// *******************************************************
// ************* Operational Cash Check ******************
// *******************************************************
async function opCashCheck() {
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)
var check_amount = operationalAmountField.value
if (operationalCurrencyField.value != "XRP") {
check_amount = {
"value": operationalAmountField.value,
"currency": operationalCurrencyField.value,
"issuer": operationalIssuerField.value
}
}
const cash_check_tx = {
"TransactionType": "CheckCash",
"Account": operational_wallet.address,
"Amount": check_amount,
"CheckID": operationalCheckIDField.value
}
const cash_prepared = await client.autofill(cash_check_tx)
const cash_signed = operational_wallet.sign(cash_prepared)
results += ' Receiving ' + operationalAmountField.value + ' ' + operationalCurrencyField.value + '.\n'
operationalResultField.value = results
const check_result = await client.submitAndWait(cash_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
operationalResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
operationalResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
}
// end of opCashCheck()
// *******************************************************
// ************* Operational Cancel Check ****************
// *******************************************************
async function opCancelCheck() {
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 cancel_check_tx = {
"TransactionType": "CheckCancel",
"Account": operational_wallet.address,
"CheckID": operationalCheckIDField.value
}
const cancel_prepared = await client.autofill(cancel_check_tx)
const cancel_signed = operational_wallet.sign(cancel_prepared)
results += ' Cancelling check.\n'
operationalResultField.value = results
const check_result = await client.submitAndWait(cancel_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
operationalResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
operationalResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of cancelCheck()

View File

@@ -70,15 +70,15 @@ async function createTrustline() {
const currency_code = standbyCurrencyField.value
const trustSet_tx = {
"TransactionType": "TrustSet",
"Account": standbyDestinationField.value,
"Account": standbyAccountField.value,
"LimitAmount": {
"currency": standbyCurrencyField.value,
"issuer": standby_wallet.address,
"issuer": standbyDestinationField.value,
"value": standbyAmountField.value
}
}
const ts_prepared = await client.autofill(trustSet_tx)
const ts_signed = operational_wallet.sign(ts_prepared)
const ts_signed = standby_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)
@@ -164,12 +164,11 @@ async function getBalances() {
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"
results = "\nGetting operational account balances...\n"
const operational_balances = await client.request({
command: "gateway_balances",
account: operational_wallet.address,
@@ -178,7 +177,6 @@ async function getBalances() {
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()
@@ -206,15 +204,15 @@ async function oPcreateTrustline() {
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
const trustSet_tx = {
"TransactionType": "TrustSet",
"Account": operationalDestinationField.value,
"Account": operationalAccountField.value,
"LimitAmount": {
"currency": operationalCurrencyField.value,
"issuer": operational_wallet.address,
"issuer": operationalDestinationField.value,
"value": operationalAmountField.value
}
}
const ts_prepared = await client.autofill(trustSet_tx)
const ts_signed = standby_wallet.sign(ts_prepared)
const ts_signed = operational_wallet.sign(ts_prepared)
results += '\nCreating trust line from operational account to ' +
operationalDestinationField.value + ' account...'
operationalResultField.value = results

View File

@@ -199,8 +199,6 @@ async function getAccount(type) {
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.'
@@ -208,8 +206,6 @@ async function getAccount(type) {
}
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.'
@@ -217,8 +213,6 @@ async function getAccount(type) {
}
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.'

Binary file not shown.

View File

@@ -0,0 +1,11 @@
from os import urandom
from cryptoconditions import PreimageSha256
secret = urandom(32)
fulfillment = PreimageSha256(preimage=secret)
print("Condition", fulfillment.condition_binary.hex().upper())
# Keep secret until you want to finish the escrow
print("Fulfillment", fulfillment.serialize_binary().hex().upper())

View File

@@ -60,9 +60,9 @@ def operational_send_xrp():
get_operational_account_info()
# Create a new window with the title "Quickstart Module 1"
# Create a new window with the title "Send and Receive XRP"
window = tk.Tk()
window.title("Quickstart Module 1")
window.title("Send and Receive XRP")
# Form frame
frm_form = tk.Frame(relief=tk.SUNKEN, borderwidth=3)

View File

@@ -0,0 +1,318 @@
import tkinter as tk
import xrpl
import json
from mod1 import get_account, get_account_info, send_xrp
from mod2 import get_balance
from mod10 import send_check, cash_check, cancel_check, get_checks
#############################################
## Handlers #################################
#############################################
## Mod 10 Handlers
def standby_send_check():
results=send_check(
ent_standby_seed.get(),
ent_standby_amount.get(),
ent_standby_destination.get(),
ent_standby_currency.get(),
ent_standby_issuer.get()
)
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0", json.dumps(results, indent=4))
def standby_cash_check():
results=cash_check(
ent_standby_seed.get(),
ent_standby_amount.get(),
ent_standby_check_id.get(),
ent_standby_currency.get(),
ent_standby_issuer.get()
)
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0", json.dumps(results, indent=4))
def standby_cancel_check():
results=cancel_check(
ent_standby_seed.get(),
ent_standby_check_id.get()
)
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0", json.dumps(results, indent=4))
def standby_get_checks():
results=get_checks(
ent_standby_account.get(),
)
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0", json.dumps(results, indent=4))
def standby_get_balance():
results=get_balance(
ent_standby_seed.get(),
ent_operational_seed.get()
)
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0", json.dumps(results, indent=4))
def operational_send_check():
results=send_check(
ent_operational_seed.get(),
ent_operational_amount.get(),
ent_operational_destination.get(),
ent_operational_currency.get(),
ent_operational_issuer.get()
)
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))
def operational_cash_check():
results=cash_check(
ent_operational_seed.get(),
ent_operational_amount.get(),
ent_operational_check_id.get(),
ent_operational_currency.get(),
ent_operational_issuer.get()
)
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))
def operational_cancel_check():
results=cancel_check(
ent_operational_seed.get(),
ent_operational_check_id.get()
)
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))
def operational_get_checks():
results=get_checks(
ent_operational_account.get(),
)
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))
def operational_get_balance():
results=get_balance(
ent_operational_seed.get(),
ent_standby_seed.get()
)
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))
## Mod 8 Handlers
def operational_get_transaction():
results=get_transaction(ent_operational_account.get(),
ent_operational_look_up.get())
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))
## Mod 1 Handlers
def get_standby_account():
new_wallet=get_account(ent_standby_seed.get())
ent_standby_account.delete(0, tk.END)
ent_standby_seed.delete(0, tk.END)
ent_standby_account.insert(0, new_wallet.classic_address)
ent_standby_seed.insert(0, new_wallet.seed)
def get_standby_account_info():
accountInfo=get_account_info(ent_standby_account.get())
ent_standby_balance.delete(0, tk.END)
ent_standby_balance.insert(0,accountInfo['Balance'])
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0",json.dumps(accountInfo, indent=4))
def standby_send_xrp():
response=send_xrp(ent_standby_seed.get(),ent_standby_amount.get(),
ent_standby_destination.get())
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0",json.dumps(response.result, indent=4))
get_standby_account_info()
get_operational_account_info()
def get_operational_account():
new_wallet=get_account(ent_operational_seed.get())
ent_operational_account.delete(0, tk.END)
ent_operational_account.insert(0, new_wallet.classic_address)
ent_operational_seed.delete(0, tk.END)
ent_operational_seed.insert(0, new_wallet.seed)
def get_operational_account_info():
accountInfo=get_account_info(ent_operational_account.get())
ent_operational_balance.delete(0, tk.END)
ent_operational_balance.insert(0,accountInfo['Balance'])
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0",json.dumps(accountInfo, indent=4))
def operational_send_xrp():
response=send_xrp(ent_operational_seed.get(),ent_operational_amount.get(),
ent_operational_destination.get())
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0",json.dumps(response.result,indent=4))
get_standby_account_info()
get_operational_account_info()
# Create a new window with the title "Conditional Escrow Example"
window=tk.Tk()
window.title("Check Example")
# Form frame
frm_form=tk.Frame(relief=tk.SUNKEN, borderwidth=3)
frm_form.pack()
# Create the Label and Entry widgets for "Standby Account"
lbl_standy_seed=tk.Label(master=frm_form, text="Standby Seed")
ent_standby_seed=tk.Entry(master=frm_form, width=50)
lbl_standby_account=tk.Label(master=frm_form, text="Standby Account")
ent_standby_account=tk.Entry(master=frm_form, width=50)
lbl_standby_balance=tk.Label(master=frm_form, text="XRP Balance")
ent_standby_balance=tk.Entry(master=frm_form, width=50)
lbl_standy_amount=tk.Label(master=frm_form, text="Amount")
ent_standby_amount=tk.Entry(master=frm_form, width=50)
lbl_standby_destination=tk.Label(master=frm_form, text="Destination")
ent_standby_destination=tk.Entry(master=frm_form, width=50)
lbl_standby_issuer=tk.Label(master=frm_form, text="Issuer")
ent_standby_issuer=tk.Entry(master=frm_form, width=50)
lbl_standby_check_id=tk.Label(master=frm_form, text="Check ID")
ent_standby_check_id=tk.Entry(master=frm_form, width=50)
lbl_standby_currency=tk.Label(master=frm_form, text="Currency")
ent_standby_currency=tk.Entry(master=frm_form, width=50)
lbl_standby_results=tk.Label(master=frm_form, text="Results")
text_standby_results=tk.Text(master=frm_form, height=20, width=65)
# Place fields in a grid.
lbl_standy_seed.grid(row=0, column=0, sticky="e")
ent_standby_seed.grid(row=0, column=1)
lbl_standby_account.grid(row=2, column=0, sticky="e")
ent_standby_account.grid(row=2, column=1)
lbl_standby_balance.grid(row=3, column=0, sticky="e")
ent_standby_balance.grid(row=3, column=1)
lbl_standy_amount.grid(row=4, column=0, sticky="e")
ent_standby_amount.grid(row=4, column=1)
lbl_standby_destination.grid(row=5, column=0, sticky="e")
ent_standby_destination.grid(row=5, column=1)
lbl_standby_issuer.grid(row=6, column=0, sticky="e")
ent_standby_issuer.grid(row=6, column=1)
lbl_standby_check_id.grid(row=7, column=0, sticky="e")
ent_standby_check_id.grid(row=7, column=1)
lbl_standby_currency.grid(row=8, column=0, sticky="e")
ent_standby_currency.grid(row=8, column=1)
lbl_standby_results.grid(row=9, column=0, sticky="ne")
text_standby_results.grid(row=9, column=1, sticky="nw")
###############################################
## Operational Account ########################
###############################################
# Create the Label and Entry widgets for "Operational Account"
lbl_operational_seed=tk.Label(master=frm_form, text="Operational Seed")
ent_operational_seed=tk.Entry(master=frm_form, width=50)
lbl_operational_account=tk.Label(master=frm_form, text="Operational Account")
ent_operational_account=tk.Entry(master=frm_form, width=50)
lbl_operational_balance=tk.Label(master=frm_form, text="XRP Balance")
ent_operational_balance=tk.Entry(master=frm_form, width=50)
lbl_operational_amount=tk.Label(master=frm_form, text="Amount")
ent_operational_amount=tk.Entry(master=frm_form, width=50)
lbl_operational_destination=tk.Label(master=frm_form, text="Destination")
ent_operational_destination=tk.Entry(master=frm_form, width=50)
lbl_operational_issuer=tk.Label(master=frm_form, text="Issuer")
ent_operational_issuer=tk.Entry(master=frm_form, width=50)
lbl_operational_check_id=tk.Label(master=frm_form, text="Check ID")
ent_operational_check_id=tk.Entry(master=frm_form, width=50)
lbl_operational_currency=tk.Label(master=frm_form, text="Currency")
ent_operational_currency=tk.Entry(master=frm_form, width=50)
lbl_operational_results=tk.Label(master=frm_form,text='Results')
text_operational_results=tk.Text(master=frm_form, height=20, width=65)
#Place the widgets in a grid
lbl_operational_seed.grid(row=0, column=4, sticky="e")
ent_operational_seed.grid(row=0, column=5, sticky="w")
lbl_operational_account.grid(row=2,column=4, sticky="e")
ent_operational_account.grid(row=2,column=5, sticky="w")
lbl_operational_balance.grid(row=3, column=4, sticky="e")
ent_operational_balance.grid(row=3, column=5, sticky="w")
lbl_operational_amount.grid(row=4, column=4, sticky="e")
ent_operational_amount.grid(row=4, column=5, sticky="w")
lbl_operational_destination.grid(row=5, column=4, sticky="e")
ent_operational_destination.grid(row=5, column=5, sticky="w")
lbl_operational_issuer.grid(row=6, column=4, sticky="e")
ent_operational_issuer.grid(row=6, column=5, sticky="w")
lbl_operational_check_id.grid(row=7, column=4, sticky="e")
ent_operational_check_id.grid(row=7, column=5, sticky="w")
lbl_operational_currency.grid(row=8, column=4, sticky="e")
ent_operational_currency.grid(row=8, column=5)
lbl_operational_results.grid(row=9, column=4, sticky="ne")
text_operational_results.grid(row=9, column=5, sticky="nw")
#############################################
## Buttons ##################################
#############################################
# Create the Get Standby Account Buttons
btn_get_standby_account=tk.Button(master=frm_form, text="Get Standby Account",
command=get_standby_account)
btn_get_standby_account.grid(row=0, column=2, sticky="nsew")
btn_get_standby_account_info=tk.Button(master=frm_form,
text="Get Standby Account Info",
command=get_standby_account_info)
btn_get_standby_account_info.grid(row=1, column=2, sticky="nsew")
btn_standby_send_xrp=tk.Button(master=frm_form, text="Send XRP >",
command=standby_send_xrp)
btn_standby_send_xrp.grid(row=2, column=2, sticky="nsew")
btn_standby_send_check=tk.Button(master=frm_form, text="Send Check",
command=standby_send_check)
btn_standby_send_check.grid(row=4, column=2, sticky="nsew")
btn_standby_get_checks=tk.Button(master=frm_form, text="Get Checks",
command=standby_get_checks)
btn_standby_get_checks.grid(row=5, column=2, sticky="nsew")
btn_standby_cash_check=tk.Button(master=frm_form, text="Cash Check",
command=standby_cash_check)
btn_standby_cash_check.grid(row=6, column=2, sticky="nsew")
btn_standby_cancel_check=tk.Button(master=frm_form, text="Cancel Check",
command=standby_cancel_check)
btn_standby_cancel_check.grid(row=7, column=2, sticky="nsew")
btn_standby_get_balances=tk.Button(master=frm_form, text="Get Balances",
command=standby_get_balance)
btn_standby_get_balances.grid(row=8, column=2, sticky="nsew")
# Create the Operational Account Buttons
btn_get_operational_account=tk.Button(master=frm_form,
text="Get Operational Account",
command=get_operational_account)
btn_get_operational_account.grid(row=0, column=3, sticky="nsew")
btn_get_op_account_info=tk.Button(master=frm_form, text="Get Op Account Info",
command=get_operational_account_info)
btn_get_op_account_info.grid(row=1, column=3, sticky="nsew")
btn_op_send_xrp=tk.Button(master=frm_form, text="< Send XRP",
command=operational_send_xrp)
btn_op_send_xrp.grid(row=2, column=3, sticky="nsew")
btn_op_send_check=tk.Button(master=frm_form, text="Send Check",
command=operational_send_check)
btn_op_send_check.grid(row=4, column=3, sticky="nsew")
btn_op_get_checks=tk.Button(master=frm_form, text="Get Checks",
command=operational_get_checks)
btn_op_get_checks.grid(row=5, column=3, sticky="nsew")
btn_op_cash_check=tk.Button(master=frm_form, text="Cash Check",
command=operational_cash_check)
btn_op_cash_check.grid(row=6, column=3, sticky="nsew")
btn_op_cancel_check=tk.Button(master=frm_form, text="Cancel Check",
command=operational_cancel_check)
btn_op_cancel_check.grid(row=7, column=3, sticky="nsew")
btn_op_get_balances=tk.Button(master=frm_form, text="Get Balances",
command=operational_get_balance)
btn_op_get_balances.grid(row=8, column=3, sticky="nsew")
# Start the application
window.mainloop()

View File

@@ -68,10 +68,10 @@ def operational_configure_account():
def get_balances():
results = get_balance(ent_operational_account.get(), ent_standby_account.get())
results = get_balance(ent_operational_seed.get(), ent_standby_seed.get())
text_standby_results.delete("1.0", tk.END)
text_standby_results.insert("1.0", json.dumps(results, indent=4))
results = get_balance(ent_standby_account.get(), ent_operational_account.get())
results = get_balance(ent_standby_seed.get(), ent_operational_seed.get())
text_operational_results.delete("1.0", tk.END)
text_operational_results.insert("1.0", json.dumps(results, indent=4))

View File

@@ -24,6 +24,7 @@ from mod4 import (
)
from mod5 import broker_sale
from mod6 import set_minter, mint_other
from mod7 import batch_mint, get_batch
#############################################
## Handlers #################################

View File

@@ -48,9 +48,9 @@ def get_standby_account_info():
text_standby_results.insert("1.0",json.dumps(accountInfo, indent=4))
# Create a new window with the title "Quickstart - Batch Minting"
# Create a new window with the title "Python Module - Batch Minting"
window = tk.Tk()
window.title("Quickstart - Batch Minting")
window.title("Python Module - Batch Minting")
# Form frame
frm_form = tk.Frame(relief=tk.SUNKEN, borderwidth=3)
@@ -115,7 +115,7 @@ btn_get_standby_account_info = tk.Button(master=frm_form,
command = get_standby_account_info)
btn_get_standby_account_info.grid(row=1, column=2, sticky = "nsew")
btn_standby_batch_mint = tk.Button(master=frm_form,
text="Batch Mint",
text="Batch Mint NFTs",
command = standby_batch_mint)
btn_standby_batch_mint.grid(row=5, column=2, sticky = "nsew")
btn_standby_get_batch_nfts = tk.Button(master=frm_form,

View File

@@ -4,7 +4,7 @@ import json
from mod1 import get_account, get_account_info, send_xrp
from mod8 import get_escrows, cancel_time_escrow, get_transaction
from mod9 import create_conditional_escrow, finish_conditional_escrow
from mod9 import create_conditional_escrow, finish_conditional_escrow, generate_condition
#############################################
@@ -13,6 +13,12 @@ from mod9 import create_conditional_escrow, finish_conditional_escrow
## Mod 9 Handlers
def get_condition():
results = generate_condition()
ent_standby_escrow_condition.delete(0, tk.END)
ent_standby_escrow_condition.insert(0, results[0])
ent_operational_escrow_fulfillment.delete(0, tk.END)
ent_operational_escrow_fulfillment.insert(0, results[1])
def standby_create_conditional_escrow():
results = create_conditional_escrow(
@@ -37,7 +43,6 @@ def operational_finish_conditional_escrow():
text_operational_results.insert("1.0", json.dumps(results, indent=4))
## Mod 8 Handlers
def operational_get_escrows():
@@ -131,7 +136,6 @@ lbl_standby_destination = tk.Label(master=frm_form, text="Destination")
ent_standby_destination = tk.Entry(master=frm_form, width=50)
lbl_standby_balance = tk.Label(master=frm_form, text="XRP Balance")
ent_standby_balance = tk.Entry(master=frm_form, width=50)
lbl_standby_escrow_condition = tk.Label(master=frm_form, text="Escrow Condition")
ent_standby_escrow_condition = tk.Entry(master=frm_form, width=50)
lbl_standby_escrow_cancel = tk.Label(master=frm_form, text="Escrow Cancel (seconds)")
@@ -180,14 +184,14 @@ lbl_operational_destination = tk.Label(master=frm_form, text="Destination")
ent_operational_destination = tk.Entry(master=frm_form, width=50)
lbl_operational_balance = tk.Label(master=frm_form, text="XRP Balance")
ent_operational_balance = tk.Entry(master=frm_form, width=50)
lbl_operational_escrow_fulfillment = tk.Label(master=frm_form, text="Escrow Fulfillment")
ent_operational_escrow_fulfillment = tk.Entry(master=frm_form, width=50)
lbl_operational_sequence_number = tk.Label(master=frm_form, text="Sequence Number")
ent_operational_sequence_number = tk.Entry(master=frm_form, width=50)
lbl_operational_escrow_owner=tk.Label(master=frm_form, text="Escrow Owner")
ent_operational_escrow_owner=tk.Entry(master=frm_form, width=50)
lbl_operational_look_up = tk.Label(master=frm_form, text="Transaction to Look Up")
ent_operational_look_up = tk.Entry(master=frm_form, width=50)
lbl_operational_escrow_fulfillment = tk.Label(master=frm_form, text="Escrow Fulfillment")
ent_operational_escrow_fulfillment = tk.Entry(master=frm_form, width=50)
lbl_operational_results = tk.Label(master=frm_form,text='Results')
text_operational_results = tk.Text(master=frm_form, height = 20, width = 65)
@@ -229,13 +233,15 @@ btn_get_standby_account_info.grid(row = 1, column = 2, sticky = "nsew")
btn_standby_send_xrp = tk.Button(master=frm_form, text="Send XRP >",
command = standby_send_xrp)
btn_standby_send_xrp.grid(row = 2, column = 2, sticky = "nsew")
btn_standby_get_condition = tk.Button(master=frm_form, text="Get Condition",
command = get_condition)
btn_standby_get_condition.grid(row=4, column=2, sticky="nsew")
btn_standby_create_escrow = tk.Button(master=frm_form, text="Create Conditional Escrow",
command = standby_create_conditional_escrow)
btn_standby_create_escrow.grid(row = 4, column = 2, sticky="nsew")
btn_standby_create_escrow.grid(row=5, column = 2, sticky="nsew")
btn_standby_cancel_escrow = tk.Button(master=frm_form, text="Cancel Escrow",
command = standby_cancel_time_escrow)
btn_standby_cancel_escrow.grid(row=5,column = 2, sticky="nsew")
btn_standby_cancel_escrow.grid(row=6,column = 2, sticky="nsew")
# Create the Operational Account Buttons
btn_get_operational_account = tk.Button(master=frm_form,

View File

@@ -1,6 +1,6 @@
import xrpl
testnet_url = "https://s.altnet.rippletest.net:51234/"
testnet_url = "https://s.devnet.rippletest.net:51234/"
def get_account(seed):
"""get_account"""
@@ -33,4 +33,5 @@ def send_xrp(seed, amount, destination):
response = xrpl.transaction.submit_and_wait(payment, client, sending_wallet)
except xrpl.transaction.XRPLReliableSubmissionException as e:
response = f"Submit failed: {e}"
return response

View File

@@ -0,0 +1,83 @@
import xrpl
from xrpl.clients import JsonRpcClient
from xrpl.wallet import Wallet
from datetime import datetime
from xrpl.models.transactions import CheckCreate, CheckCash, CheckCancel
from xrpl.models.requests import AccountObjects, AccountTx, GatewayBalances
testnet_url = "https://s.devnet.rippletest.net:51234"
def send_check(seed, amount, destination, currency, issuer):
"""send_check"""
wallet=Wallet.from_seed(seed)
client=JsonRpcClient(testnet_url)
if currency != "XRP":
amount = {"value": amount,
"currency": currency,
"issuer": issuer
}
check_tx=xrpl.models.transactions.CheckCreate(
account=wallet.address,
send_max=amount,
destination=destination
)
# Submit the transaction and report the results
reply=""
try:
response=xrpl.transaction.submit_and_wait(check_tx,client,wallet)
reply=response.result
except xrpl.transaction.XRPLReliableSubmissionException as e:
reply=f"Submit failed: {e}"
return reply
def cash_check(seed, amount, check_id, currency, issuer):
"""cash_check"""
wallet=Wallet.from_seed(seed)
client=JsonRpcClient(testnet_url)
if currency != "XRP":
amount = {
"value": amount,
"currency": currency,
"issuer": issuer
}
finish_tx=xrpl.models.transactions.CheckCash(
account=wallet.address,
amount=amount,
check_id=check_id
)
# Submit the transaction and report the results
reply=""
try:
response=xrpl.transaction.submit_and_wait(finish_tx,client,wallet)
reply=response.result
except xrpl.transaction.XRPLReliableSubmissionException as e:
reply=f"Submit failed: {e}"
return reply
def cancel_check(seed, check_id):
"""cancel_check"""
wallet=Wallet.from_seed(seed)
client=JsonRpcClient(testnet_url)
cancel_tx=xrpl.models.transactions.CheckCancel(
account=wallet.address,
check_id=check_id
)
# Submit the transaction and report the results
reply=""
try:
response=xrpl.transaction.submit_and_wait(cancel_tx,client,wallet)
reply=response.result
except xrpl.transaction.XRPLReliableSubmissionException as e:
reply=f"Submit failed: {e}"
return reply
def get_checks(account):
"""get_checks"""
client=JsonRpcClient(testnet_url)
acct_checks=AccountObjects(
account=account,
ledger_index="validated",
type="check"
)
response=client.request(acct_checks)
return response.result

View File

@@ -3,7 +3,7 @@ from xrpl.clients import JsonRpcClient
from xrpl.wallet import Wallet
testnet_url = "https://s.altnet.rippletest.net:51234"
testnet_url = "https://s.devnet.rippletest.net:51234"
#####################
# create_trust_line #
@@ -54,13 +54,14 @@ def send_currency(seed, destination, currency, amount):
# get_balance #
###############
def get_balance(sb_account_id, op_account_id):
def get_balance(sb_account_seed, op_account_seed):
"""get_balance"""
wallet = Wallet.from_seed(sb_account_seed)
opWallet = Wallet.from_seed(op_account_seed)
client=JsonRpcClient(testnet_url)
balance=xrpl.models.requests.GatewayBalances(
account=sb_account_id,
ledger_index="validated",
hotwallet=[op_account_id]
account=wallet.address,
ledger_index="validated"
)
response = client.request(balance)
return response.result

View File

@@ -17,7 +17,6 @@ def batch_mint(seed, uri, flags, transfer_fee, taxon, count):
)
get_seq_request = client.request(acct_info)
current_sequence=get_seq_request.result['account_data']['Sequence']
ticket_tx=xrpl.models.transactions.TicketCreate(
account=wallet.address,
ticket_count=int(count),

View File

@@ -3,9 +3,17 @@ from xrpl.clients import JsonRpcClient
from xrpl.wallet import Wallet
from datetime import datetime
from xrpl.models.transactions import EscrowCreate, EscrowFinish
from os import urandom
from cryptoconditions import PreimageSha256
testnet_url = "https://s.altnet.rippletest.net:51234"
def generate_condition():
randy = urandom(32)
fulfillment = PreimageSha256(preimage=randy)
return (fulfillment.condition_binary.hex().upper(),
fulfillment.serialize_binary().hex().upper())
def add_seconds(numOfSeconds):
new_date = datetime.now()
if new_date != '':
@@ -18,6 +26,7 @@ def create_conditional_escrow(seed, amount, destination, cancel, condition):
wallet=Wallet.from_seed(seed)
client=JsonRpcClient(testnet_url)
cancel_date = add_seconds(cancel)
finish_date = cancel_date - 200
escrow_tx=xrpl.models.transactions.EscrowCreate(
account=wallet.address,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 1007 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 108 KiB

329
docs/img/ripplex10-check.js Normal file
View File

@@ -0,0 +1,329 @@
// *******************************************************
// ************* Standby Send Check **********************
// *******************************************************
async function sendCheck() {
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)
var check_amount = standbyAmountField.value
if (standbyCurrencyField.value != "XRP") {
check_amount = {
"currency": standbyCurrencyField.value,
"value": standbyAmountField.value,
"issuer": standby_wallet.address
}
}
const send_check_tx = {
"TransactionType": "CheckCreate",
"Account": standby_wallet.address,
"SendMax": check_amount,
"Destination": standbyDestinationField.value
}
const check_prepared = await client.autofill(send_check_tx)
const check_signed = standby_wallet.sign(check_prepared)
results += 'Sending ' + check_amount + ' ' + standbyCurrencyField + ' to ' +
standbyDestinationField.value + '...'
standbyResultField.value = results
const check_result = await client.submitAndWait(check_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${check_signed.hash}'
standbyResultField.value = JSON.stringify(check_result.result, null, 2)
} else {
results += 'Transaction failed: See JavaScript console for details.'
standbyResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of sendCheck()
// *******************************************************
// *************** Standby Get Checks ********************
// *******************************************************
async function getChecks() {
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '....'
standbyResultField.value = results
await client.connect()
results += '\nConnected.'
standbyResultField.value = results
results= "\nGetting standby account checks...\n"
const check_objects = await client.request({
"id": 5,
"command": "account_objects",
"account": standbyAccountField.value,
"ledger_index": "validated",
"type": "check"
})
standbyResultField.value = JSON.stringify(check_objects.result, null, 2)
client.disconnect()
} // End of getChecks()
// *******************************************************
// ************* Standby Cash Check **********************
// *******************************************************
async function cashCheck() {
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)
var check_amount = standbyAmountField.value
if (standbyCurrencyField.value != "XRP") {
check_amount = {
"value": standbyAmountField.value,
"currency": standbyCurrencyField.value,
"issuer": standbyIssuerField.value
}
}
const cash_check_tx = {
"TransactionType": "CheckCash",
"Account": standby_wallet.address,
"Amount": check_amount,
"CheckID": standbyCheckID.value
}
const cash_prepared = await client.autofill(cash_check_tx)
const cash_signed = standby_wallet.sign(cash_prepared)
results += ' Receiving ' + standbyAmountField.value + ' ' + standbyCurrencyField.value + '.\n'
standbyResultField.value = results
const check_result = await client.submitAndWait(cash_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
standbyResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
standbyResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of cashCheck()
// *******************************************************
// *************** Standby Cancel Check ******************
// *******************************************************
async function cancelCheck() {
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 cancel_check_tx = {
"TransactionType": "CheckCancel",
"Account": standby_wallet.address,
"CheckID": standbyCheckID.value
}
const cancel_prepared = await client.autofill(cancel_check_tx)
const cancel_signed = standby_wallet.sign(cancel_prepared)
results += ' Cancelling check.\n'
standbyResultField.value = results
const check_result = await client.submitAndWait(cancel_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
standbyResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
standbyResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of cancelCheck()
// *******************************************************
// ************ Operational Send Check *******************
// *******************************************************
async function opSendCheck() {
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 issue_quantity = operationalAmountField.value
var check_amount = operationalAmountField.value
if (operationalCurrencyField.value != "XRP") {
check_amount = {
"currency": operationalCurrencyField.value,
"value": operationalAmountField.value,
"issuer": operational_wallet.address
}
}
const send_check_tx = {
"TransactionType": "CheckCreate",
"Account": operational_wallet.address,
"SendMax": check_amount,
"Destination": operationalDestinationField.value
}
const check_prepared = await client.autofill(send_check_tx)
const check_signed = operational_wallet.sign(check_prepared)
results += '\nSending check to ' +
operationalDestinationField.value + '...'
operationalResultField.value = results
const check_result = await client.submitAndWait(check_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${check_signed.hash}'
operationalResultField.value = JSON.stringify(check_result.result, null, 2)
} else {
results += 'Transaction failed: See JavaScript console for details.'
operationalResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of opSendCheck()
// *******************************************************
// ************ Operational Get Checks *******************
// *******************************************************
async function opGetChecks() {
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '....'
operationalResultField.value = results
await client.connect()
results += '\nConnected.'
operationalResultField.value = results
results= "\nGetting standby account checks...\n"
const check_objects = await client.request({
"id": 5,
"command": "account_objects",
"account": operationalAccountField.value,
"ledger_index": "validated",
"type": "check"
})
operationalResultField.value = JSON.stringify(check_objects.result, null, 2)
client.disconnect()
} // End of opGetChecks()
// *******************************************************
// ************* Operational Cash Check ******************
// *******************************************************
async function opCashCheck() {
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)
var check_amount = operationalAmountField.value
if (operationalCurrencyField.value != "XRP") {
check_amount = {
"value": operationalAmountField.value,
"currency": operationalCurrencyField.value,
"issuer": operationalIssuerField.value
}
}
const cash_check_tx = {
"TransactionType": "CheckCash",
"Account": operational_wallet.address,
"Amount": check_amount,
"CheckID": operationalCheckIDField.value
}
const cash_prepared = await client.autofill(cash_check_tx)
const cash_signed = operational_wallet.sign(cash_prepared)
results += ' Receiving ' + operationalAmountField.value + ' ' + operationalCurrencyField.value + '.\n'
operationalResultField.value = results
const check_result = await client.submitAndWait(cash_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
operationalResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
operationalResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
}
// end of opCashCheck()
// *******************************************************
// ************* Operational Cancel Check ****************
// *******************************************************
async function opCancelCheck() {
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 cancel_check_tx = {
"TransactionType": "CheckCancel",
"Account": operational_wallet.address,
"CheckID": operationalCheckIDField.value
}
const cancel_prepared = await client.autofill(cancel_check_tx)
const cancel_signed = operational_wallet.sign(cancel_prepared)
results += ' Cancelling check.\n'
operationalResultField.value = results
const check_result = await client.submitAndWait(cancel_signed.tx_blob)
if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${cash_signed.hash}'
operationalResultField.value = results
} else {
results += 'Transaction failed: See JavaScript console for details.'
operationalResultField.value = results
throw 'Error sending transaction: ${check_result.result.meta.TransactionResult}'
}
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
client.disconnect()
} // end of cancelCheck()

View File

@@ -13,10 +13,6 @@ const recommendedPages = [
description: 'Public API Methods',
link: '/docs/references/http-websocket-apis/public-api-methods/',
},
{
description: 'Getting Started with Python',
link: '/docs/tutorials/get-started/get-started-using-python/',
},
{
description: 'Run a Validator',
link: '/docs/infrastructure/configuration/server-modes/run-rippled-as-a-validator/',
@@ -291,11 +287,11 @@ export default function Docs() {
<h4 className="pb-4">{translate('Getting Started')}</h4>
<div className="card-grid card-grid-2xN quickstart-card">
<div className="col">
<a href="/docs/tutorials/javascript/modular-tutorials/send-payments" className="card float-up-on-hover">
<h5 className="mt-7">{translate('Quickstart to XRP Ledger')}</h5>
<a href="/docs/introduction/" className="card float-up-on-hover">
<h5 className="mt-7">{translate('Introduction to the XRP Ledger')}</h5>
<p className="mb-8 mt-4">{translate('An introduction to fundamental aspects of the XRP Ledger.')}</p>
<div className="dg-lg-block mb-3">
<div className="btn btn-primary btn-arrow get-started-button">{translate('Get Started')}</div>
<div className="btn btn-primary btn-arrow get-started-button">{translate('Introduction')}</div>
</div>
<img alt="quick-start" id="quick-start-img" className="quickstart-image" />
</a>
@@ -325,13 +321,13 @@ export default function Docs() {
<div className="col">
<div className="card-grid langs-cards card-grid-2xN mt-10" id="langs-cards">
<div className="col langs">
<a href="/docs/tutorials/javascript/get-started/">
<a href="/docs/tutorials/javascript/">
<img alt="Javascript Logo" src={require('../static/img/logos/javascript.svg')} className="circled-logo" />
<h5 className="btn-arrow">{translate('Javascript')}</h5>
</a>
</div>
<div className="col langs">
<a href="/docs/tutorials/python/get-started/">
<a href="/docs/tutorials/python/">
<img alt="Python Logo" src={require('../static/img/logos/python.svg')} className="circled-logo" />
<h5 className="btn-arrow">{translate('Python')}</h5>
</a>

View File

@@ -7,7 +7,8 @@ top_nav_grouping: Article Types
---
# Introduction
This is a quick introduction to the principal features of the XRP Ledger (XRPL). Read this to get a high level understanding of the XRPL, then you can read more about areas of particular interest. The XRP Ledger is a blockchain that permanently records digital transactions of tokens between accounts. The sections below expand on the concepts introduced in that sentence.
![Howdy!](/docs/img/introduction1-howdy.png)
The XRP Ledger is a blockchain that permanently records digital transactions of tokens between accounts. The sections below expand on the concepts introduced in that sentence.
{% child-pages /%}

View File

@@ -7,37 +7,22 @@ seo:
The XRP Ledger tutorials walk you through the steps to learn and get started with the XRP Ledger and to use the ledger for advanced use cases.
## Get Started with SDKs
## Get Started with Your Favorite Programming Language
These tutorials walk you through the basics of building a very simple XRP Ledger-connected application using SDKs.
{% card-grid %}
{% xrpl-card title="Python" body="Using xrpl.py, a pure Python library." href="/docs/tutorials/python/get-started/" image="/img/logos/python.svg" imageAlt="Python logo" /%}
{% xrpl-card title="Javascript" body="Using the xrpl.js client library." href="/docs/tutorials/javascript/" image="/img/logos/javascript.svg" imageAlt="Javascript logo" /%}
{% xrpl-card title="Python" body="Using xrpl.py, a pure Python library." href="/docs/tutorials/python/" image="/img/logos/python.svg" imageAlt="Python logo" /%}
<br/>
{% xrpl-card title="Java" body="Using xrpl4j, a pure Java library." href="/docs/tutorials/java/get-started/" image="/img/logos/java.svg" imageAlt="Java logo" /%}
{% xrpl-card title="Javascript" body="Using the xrpl.js client library." href="/docs/tutorials/javascript/get-started/" image="/img/logos/javascript.svg" imageAlt="Javascript logo" /%}
{% xrpl-card title="PHP" body="Using the XRPL_PHP client library." href="/docs/tutorials/php/get-started/" image="/img/logos/php.svg" imageAlt="PHP logo" /%}
{% xrpl-card title="HTTP & WebSocket APIs" body="Access the XRP Ledger directly through the APIs of its core server." href="/docs/tutorials/http-websocket-apis/get-started/" image="/img/logos/globe.svg" imageAlt="globe icon" /%}
{% /card-grid %}
## XRP Ledger Use Cases
{% card-grid %}
{% xrpl-card title="Payments" body="Send and receive payments on the XRP Ledger." href="/docs/use-cases/payments/" /%}
{% xrpl-card title="DeFi" body="Decentralized Finance (DeFi) is about enabling fast, secure financial transactions without a central authority." href="/docs/use-cases/defi/" /%}
{% xrpl-card title="Tokens" body="Create and trade fungible and non-fungible tokens on the XRP Ledger." href="/docs/use-cases/tokenization/" /%}
{% /card-grid %}
## Manage XRP Ledger Servers
{% card-grid %}
{% xrpl-card title="Install rippled server" body="Set up the core XRP Ledger server." href="/docs/infrastructure/installation/" /%}
{% xrpl-card title="Configure rippled server" body="Customize your core XRP Ledger server's settings." href="/docs/infrastructure/configuration/" /%}
{% xrpl-card title="Troubleshooting" body="Diagnose and solve issues with XRP Ledger servers and infrastructure." href="/docs/infrastructure/troubleshooting/" /%}
{% xrpl-card title="Install Clio server" body="Set up the Clio server for efficiently querying XRP Ledger data." href="/docs/infrastructure/installation/install-clio-on-ubuntu" /%}
{% /card-grid %}

View File

@@ -0,0 +1,13 @@
---
html: build-apps-with-javascript.html
parent: javascript.html
top_nav_grouping: Article Types
metadata:
indexPage: true
---
# Build Applications with JavaScript
Build full-featured applications in JavaScript.
{% child-pages /%}

Some files were not shown because too many files have changed in this diff Show More