diff --git a/_code-samples/quickstart/js/0.All_JS_Files.zip b/_code-samples/quickstart/js/0.All_JS_Files.zip new file mode 100644 index 0000000000..e2ec1f5204 Binary files /dev/null and b/_code-samples/quickstart/js/0.All_JS_Files.zip differ diff --git a/_code-samples/quickstart/js/1.get-accounts-send-xrp.html b/_code-samples/quickstart/js/1.get-accounts-send-xrp.html index 0a4c659a0d..2a0c79d081 100644 --- a/_code-samples/quickstart/js/1.get-accounts-send-xrp.html +++ b/_code-samples/quickstart/js/1.get-accounts-send-xrp.html @@ -58,24 +58,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -153,24 +135,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed diff --git a/_code-samples/quickstart/js/10.check.html b/_code-samples/quickstart/js/10.check.html new file mode 100644 index 0000000000..ef569c351b --- /dev/null +++ b/_code-samples/quickstart/js/10.check.html @@ -0,0 +1,278 @@ + + + Token Test Harness + + + + + + + + + + + + + + +

Token Test Harness

+
+ Choose your ledger instance: +    + + +    + + +

+ +
+ +

+ + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Standby Account + + +
+
+ Seed + + +
+
+ XRP Balance + + +
+
+ Amount + + +
+
+ Destination + + +
+
+ Issuer + + +
+
+ Check ID + + +
+
+ + +
+ Currency + + +
+

+ +

+
+ + + + + + +
+ +

+ +
+ +
+ +
+ +
+ +
+
+
+ + + + +
+ + + + + + + + + +
+ +

+ +
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Operational Account + + +
+
+ Seed + + +
+
+ XRP Balance + + +
+
+ Amount + + +
+
+ Destination + + +
+
+ Issuer + + +
+
+ Check ID + + +
+
+ + + + +
+ Currency + + +
+

+ +

+
+
+
+
+ + \ No newline at end of file diff --git a/_code-samples/quickstart/js/2.create-trustline-send-currency.html b/_code-samples/quickstart/js/2.create-trustline-send-currency.html index 0c5aa9a63f..d499b3d46c 100644 --- a/_code-samples/quickstart/js/2.create-trustline-send-currency.html +++ b/_code-samples/quickstart/js/2.create-trustline-send-currency.html @@ -58,24 +58,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -181,24 +163,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed diff --git a/_code-samples/quickstart/js/3.mint-nfts.html b/_code-samples/quickstart/js/3.mint-nfts.html index 8ed27ab813..01473eaeac 100644 --- a/_code-samples/quickstart/js/3.mint-nfts.html +++ b/_code-samples/quickstart/js/3.mint-nfts.html @@ -59,24 +59,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -211,24 +193,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed diff --git a/_code-samples/quickstart/js/4.transfer-nfts.html b/_code-samples/quickstart/js/4.transfer-nfts.html index 8aa8b1b022..6789a0d981 100644 --- a/_code-samples/quickstart/js/4.transfer-nfts.html +++ b/_code-samples/quickstart/js/4.transfer-nfts.html @@ -61,24 +61,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -245,24 +227,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed diff --git a/_code-samples/quickstart/js/5.broker-nfts.html b/_code-samples/quickstart/js/5.broker-nfts.html index 7a5929b55e..b0fc4dc290 100644 --- a/_code-samples/quickstart/js/5.broker-nfts.html +++ b/_code-samples/quickstart/js/5.broker-nfts.html @@ -61,42 +61,22 @@ - - Public Key - - - - -
- + + Seed + + + + + - - Private Key - - - - -
- - - - - Seed -
- - - - - - - - XRP Balance - - - -
- + + XRP Balance + + + + + @@ -147,24 +127,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -331,24 +293,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed diff --git a/_code-samples/quickstart/js/6.authorized-minter.html b/_code-samples/quickstart/js/6.authorized-minter.html index bf43ffb3a2..cf0528e951 100644 --- a/_code-samples/quickstart/js/6.authorized-minter.html +++ b/_code-samples/quickstart/js/6.authorized-minter.html @@ -62,24 +62,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -262,24 +244,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed diff --git a/_code-samples/quickstart/js/7.batch-minting.html b/_code-samples/quickstart/js/7.batch-minting.html index 2f0b87d359..51ca2f96bb 100644 --- a/_code-samples/quickstart/js/7.batch-minting.html +++ b/_code-samples/quickstart/js/7.batch-minting.html @@ -56,24 +56,6 @@
- - - Public Key - - - -
- - - - - Private Key - - - -
- - Seed @@ -154,4 +136,4 @@ - + \ No newline at end of file diff --git a/_code-samples/quickstart/js/8.escrow.html b/_code-samples/quickstart/js/8.escrow.html index 54300cd465..5b5ec57e73 100644 --- a/_code-samples/quickstart/js/8.escrow.html +++ b/_code-samples/quickstart/js/8.escrow.html @@ -1,4 +1,4 @@ - + Time-based Escrow Test Harness @@ -41,6 +41,7 @@ + diff --git a/_code-samples/quickstart/js/9.escrow-condition.html b/_code-samples/quickstart/js/9.escrow-condition.html index c73d10b4d0..574f6a53eb 100644 --- a/_code-samples/quickstart/js/9.escrow-condition.html +++ b/_code-samples/quickstart/js/9.escrow-condition.html @@ -116,24 +116,6 @@ - - - - - - - - - - - - - - - -
@@ -115,24 +116,6 @@ - - - - - - - - - - - - - - - - + + +
- Public Key - - -
-
- Private Key - - -
-
Seed @@ -256,24 +239,6 @@
- Public Key - - -
-
- Private Key - - -
-
Seed @@ -288,6 +253,9 @@

- Public Key - - -
-
- Private Key - - -
-
Seed @@ -258,24 +240,6 @@
- Public Key - - -
-
- Private Key - - -
-
Seed diff --git a/_code-samples/quickstart/js/ripplex1-send-xrp.js b/_code-samples/quickstart/js/ripplex1-send-xrp.js index 63171684e0..07c1d274e3 100644 --- a/_code-samples/quickstart/js/ripplex1-send-xrp.js +++ b/_code-samples/quickstart/js/ripplex1-send-xrp.js @@ -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)) diff --git a/_code-samples/quickstart/js/ripplex10-check.js b/_code-samples/quickstart/js/ripplex10-check.js new file mode 100644 index 0000000000..b036cd44ab --- /dev/null +++ b/_code-samples/quickstart/js/ripplex10-check.js @@ -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() \ No newline at end of file diff --git a/_code-samples/quickstart/js/ripplex2-send-currency.js b/_code-samples/quickstart/js/ripplex2-send-currency.js index bf7acc025e..27a6db8d80 100644 --- a/_code-samples/quickstart/js/ripplex2-send-currency.js +++ b/_code-samples/quickstart/js/ripplex2-send-currency.js @@ -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 diff --git a/_code-samples/quickstart/js/ripplex5-broker-nfts.js b/_code-samples/quickstart/js/ripplex5-broker-nfts.js index 8f74d1d2df..aaa1790a73 100644 --- a/_code-samples/quickstart/js/ripplex5-broker-nfts.js +++ b/_code-samples/quickstart/js/ripplex5-broker-nfts.js @@ -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.' diff --git a/_code-samples/quickstart/py/0.All_Py_Files.zip b/_code-samples/quickstart/py/0.All_Py_Files.zip new file mode 100644 index 0000000000..89142179c3 Binary files /dev/null and b/_code-samples/quickstart/py/0.All_Py_Files.zip differ diff --git a/_code-samples/quickstart/py/conditions.py b/_code-samples/quickstart/py/conditions.py new file mode 100644 index 0000000000..71ad46a47a --- /dev/null +++ b/_code-samples/quickstart/py/conditions.py @@ -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()) diff --git a/_code-samples/quickstart/py/lesson1-send-xrp.py b/_code-samples/quickstart/py/lesson1-send-xrp.py index 90993f3882..03fb330c76 100644 --- a/_code-samples/quickstart/py/lesson1-send-xrp.py +++ b/_code-samples/quickstart/py/lesson1-send-xrp.py @@ -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) diff --git a/_code-samples/quickstart/py/lesson10-check.py b/_code-samples/quickstart/py/lesson10-check.py new file mode 100644 index 0000000000..394da6ef2f --- /dev/null +++ b/_code-samples/quickstart/py/lesson10-check.py @@ -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() diff --git a/_code-samples/quickstart/py/lesson2-send-currency.py b/_code-samples/quickstart/py/lesson2-send-currency.py index a4969390ac..e00a74f918 100644 --- a/_code-samples/quickstart/py/lesson2-send-currency.py +++ b/_code-samples/quickstart/py/lesson2-send-currency.py @@ -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)) diff --git a/_code-samples/quickstart/py/lesson6-auth-minter.py b/_code-samples/quickstart/py/lesson6-auth-minter.py index 77de5a1261..9e8f17981b 100644 --- a/_code-samples/quickstart/py/lesson6-auth-minter.py +++ b/_code-samples/quickstart/py/lesson6-auth-minter.py @@ -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 ################################# diff --git a/_code-samples/quickstart/py/lesson7-batch-minting.py b/_code-samples/quickstart/py/lesson7-batch-minting.py index f9d2d154fa..e3958afcb2 100644 --- a/_code-samples/quickstart/py/lesson7-batch-minting.py +++ b/_code-samples/quickstart/py/lesson7-batch-minting.py @@ -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, diff --git a/_code-samples/quickstart/py/lesson9-conditional-escrow.py b/_code-samples/quickstart/py/lesson9-conditional-escrow.py index 33f8c3e3d1..ef3a6afcb8 100644 --- a/_code-samples/quickstart/py/lesson9-conditional-escrow.py +++ b/_code-samples/quickstart/py/lesson9-conditional-escrow.py @@ -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, diff --git a/_code-samples/quickstart/py/mod1.py b/_code-samples/quickstart/py/mod1.py index 90ad06a707..aa8e591f03 100644 --- a/_code-samples/quickstart/py/mod1.py +++ b/_code-samples/quickstart/py/mod1.py @@ -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 diff --git a/_code-samples/quickstart/py/mod10.py b/_code-samples/quickstart/py/mod10.py new file mode 100644 index 0000000000..e97a568fa3 --- /dev/null +++ b/_code-samples/quickstart/py/mod10.py @@ -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 diff --git a/_code-samples/quickstart/py/mod2.py b/_code-samples/quickstart/py/mod2.py index 035375da8d..0775f36c79 100644 --- a/_code-samples/quickstart/py/mod2.py +++ b/_code-samples/quickstart/py/mod2.py @@ -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 diff --git a/_code-samples/quickstart/py/mod7.py b/_code-samples/quickstart/py/mod7.py index 7ed5f048d7..64f66461fc 100644 --- a/_code-samples/quickstart/py/mod7.py +++ b/_code-samples/quickstart/py/mod7.py @@ -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), diff --git a/_code-samples/quickstart/py/mod9.py b/_code-samples/quickstart/py/mod9.py index 78499a22e2..f1862c81fa 100644 --- a/_code-samples/quickstart/py/mod9.py +++ b/_code-samples/quickstart/py/mod9.py @@ -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, diff --git a/docs/img/conditional-escrow1.png b/docs/img/conditional-escrow1.png index dc737feefb..364ea085bf 100644 Binary files a/docs/img/conditional-escrow1.png and b/docs/img/conditional-escrow1.png differ diff --git a/docs/img/conditional-escrow2.png b/docs/img/conditional-escrow2.png index 694b50f040..e1dc7580ec 100644 Binary files a/docs/img/conditional-escrow2.png and b/docs/img/conditional-escrow2.png differ diff --git a/docs/img/conditional-escrow3.png b/docs/img/conditional-escrow3.png index ed5d4f8896..429d86f93a 100644 Binary files a/docs/img/conditional-escrow3.png and b/docs/img/conditional-escrow3.png differ diff --git a/docs/img/conditional-escrow4.png b/docs/img/conditional-escrow4.png index 78b9c6a4c6..338a49cd9e 100644 Binary files a/docs/img/conditional-escrow4.png and b/docs/img/conditional-escrow4.png differ diff --git a/docs/img/conditional-escrow5.png b/docs/img/conditional-escrow5.png index 76c57cf6ba..6e268a79b4 100644 Binary files a/docs/img/conditional-escrow5.png and b/docs/img/conditional-escrow5.png differ diff --git a/docs/img/introduction1-howdy.png b/docs/img/introduction1-howdy.png index 685656d497..d15dfc2d8c 100644 Binary files a/docs/img/introduction1-howdy.png and b/docs/img/introduction1-howdy.png differ diff --git a/docs/img/quickstart-checks1.png b/docs/img/quickstart-checks1.png new file mode 100644 index 0000000000..908b0937a6 Binary files /dev/null and b/docs/img/quickstart-checks1.png differ diff --git a/docs/img/quickstart-checks2.png b/docs/img/quickstart-checks2.png new file mode 100644 index 0000000000..2274bf6243 Binary files /dev/null and b/docs/img/quickstart-checks2.png differ diff --git a/docs/img/quickstart-checks3.png b/docs/img/quickstart-checks3.png new file mode 100644 index 0000000000..d9391107cf Binary files /dev/null and b/docs/img/quickstart-checks3.png differ diff --git a/docs/img/quickstart-checks4.png b/docs/img/quickstart-checks4.png new file mode 100644 index 0000000000..f55b3f6b12 Binary files /dev/null and b/docs/img/quickstart-checks4.png differ diff --git a/docs/img/quickstart-checks5.png b/docs/img/quickstart-checks5.png new file mode 100644 index 0000000000..b05eec9f28 Binary files /dev/null and b/docs/img/quickstart-checks5.png differ diff --git a/docs/img/quickstart-checks6.png b/docs/img/quickstart-checks6.png new file mode 100644 index 0000000000..58fc506f6d Binary files /dev/null and b/docs/img/quickstart-checks6.png differ diff --git a/docs/img/quickstart-checks7.png b/docs/img/quickstart-checks7.png new file mode 100644 index 0000000000..c6f64c8b9f Binary files /dev/null and b/docs/img/quickstart-checks7.png differ diff --git a/docs/img/quickstart-checks8.png b/docs/img/quickstart-checks8.png new file mode 100644 index 0000000000..943f2b7010 Binary files /dev/null and b/docs/img/quickstart-checks8.png differ diff --git a/docs/img/quickstart-escrow1.png b/docs/img/quickstart-escrow1.png index 4c88077a6e..067534b3a1 100644 Binary files a/docs/img/quickstart-escrow1.png and b/docs/img/quickstart-escrow1.png differ diff --git a/docs/img/quickstart-escrow2.png b/docs/img/quickstart-escrow2.png index 906c5c84fc..8b069c248d 100644 Binary files a/docs/img/quickstart-escrow2.png and b/docs/img/quickstart-escrow2.png differ diff --git a/docs/img/quickstart-escrow3.png b/docs/img/quickstart-escrow3.png index d6081d4043..54a5318a8d 100644 Binary files a/docs/img/quickstart-escrow3.png and b/docs/img/quickstart-escrow3.png differ diff --git a/docs/img/quickstart-escrow4.png b/docs/img/quickstart-escrow4.png index daf0dacb35..cc0c2e6fd2 100644 Binary files a/docs/img/quickstart-escrow4.png and b/docs/img/quickstart-escrow4.png differ diff --git a/docs/img/quickstart-escrow5.png b/docs/img/quickstart-escrow5.png index d79e118513..a768cd8d0e 100644 Binary files a/docs/img/quickstart-escrow5.png and b/docs/img/quickstart-escrow5.png differ diff --git a/docs/img/quickstart-escrow6.png b/docs/img/quickstart-escrow6.png index a7d4566c05..9ccfcfd8c4 100644 Binary files a/docs/img/quickstart-escrow6.png and b/docs/img/quickstart-escrow6.png differ diff --git a/docs/img/quickstart-escrow7.png b/docs/img/quickstart-escrow7.png index 70d88d2785..79b9d6fd09 100644 Binary files a/docs/img/quickstart-escrow7.png and b/docs/img/quickstart-escrow7.png differ diff --git a/docs/img/quickstart-escrow8.png b/docs/img/quickstart-escrow8.png index 605cc91717..650c9d96b7 100644 Binary files a/docs/img/quickstart-escrow8.png and b/docs/img/quickstart-escrow8.png differ diff --git a/docs/img/quickstart-escrow9.png b/docs/img/quickstart-escrow9.png index 224390e02c..69746a1923 100644 Binary files a/docs/img/quickstart-escrow9.png and b/docs/img/quickstart-escrow9.png differ diff --git a/docs/img/quickstart-py-checks1.png b/docs/img/quickstart-py-checks1.png new file mode 100644 index 0000000000..3f57cea708 Binary files /dev/null and b/docs/img/quickstart-py-checks1.png differ diff --git a/docs/img/quickstart-py-checks2.png b/docs/img/quickstart-py-checks2.png new file mode 100644 index 0000000000..82220ee2dc Binary files /dev/null and b/docs/img/quickstart-py-checks2.png differ diff --git a/docs/img/quickstart-py-checks3.png b/docs/img/quickstart-py-checks3.png new file mode 100644 index 0000000000..a5e4ddd658 Binary files /dev/null and b/docs/img/quickstart-py-checks3.png differ diff --git a/docs/img/quickstart-py-checks4.png b/docs/img/quickstart-py-checks4.png new file mode 100644 index 0000000000..20c45603f8 Binary files /dev/null and b/docs/img/quickstart-py-checks4.png differ diff --git a/docs/img/quickstart-py-checks5.png b/docs/img/quickstart-py-checks5.png new file mode 100644 index 0000000000..cd1ce12449 Binary files /dev/null and b/docs/img/quickstart-py-checks5.png differ diff --git a/docs/img/quickstart-py-checks6.png b/docs/img/quickstart-py-checks6.png new file mode 100644 index 0000000000..7786ec3ba5 Binary files /dev/null and b/docs/img/quickstart-py-checks6.png differ diff --git a/docs/img/quickstart-py-checks7.png b/docs/img/quickstart-py-checks7.png new file mode 100644 index 0000000000..c5494724a6 Binary files /dev/null and b/docs/img/quickstart-py-checks7.png differ diff --git a/docs/img/quickstart-py-checks8.png b/docs/img/quickstart-py-checks8.png new file mode 100644 index 0000000000..9a003ee480 Binary files /dev/null and b/docs/img/quickstart-py-checks8.png differ diff --git a/docs/img/quickstart1.png b/docs/img/quickstart1.png index f8ff06a598..e15584d71c 100644 Binary files a/docs/img/quickstart1.png and b/docs/img/quickstart1.png differ diff --git a/docs/img/quickstart10.png b/docs/img/quickstart10.png index dc9330959c..e76bc8419c 100644 Binary files a/docs/img/quickstart10.png and b/docs/img/quickstart10.png differ diff --git a/docs/img/quickstart11.png b/docs/img/quickstart11.png index caf2648536..2c3899544e 100644 Binary files a/docs/img/quickstart11.png and b/docs/img/quickstart11.png differ diff --git a/docs/img/quickstart12.png b/docs/img/quickstart12.png index 20441696cf..9ca385bbb8 100644 Binary files a/docs/img/quickstart12.png and b/docs/img/quickstart12.png differ diff --git a/docs/img/quickstart13.png b/docs/img/quickstart13.png index e279613004..f66a7afff5 100644 Binary files a/docs/img/quickstart13.png and b/docs/img/quickstart13.png differ diff --git a/docs/img/quickstart14.png b/docs/img/quickstart14.png index a28e61c7f2..8bb801fc1d 100644 Binary files a/docs/img/quickstart14.png and b/docs/img/quickstart14.png differ diff --git a/docs/img/quickstart15.png b/docs/img/quickstart15.png index acd6f6a55b..ca28fb8e17 100644 Binary files a/docs/img/quickstart15.png and b/docs/img/quickstart15.png differ diff --git a/docs/img/quickstart16.png b/docs/img/quickstart16.png index 580804c4ec..0543359223 100644 Binary files a/docs/img/quickstart16.png and b/docs/img/quickstart16.png differ diff --git a/docs/img/quickstart17.png b/docs/img/quickstart17.png index 22430e8425..436df141c6 100644 Binary files a/docs/img/quickstart17.png and b/docs/img/quickstart17.png differ diff --git a/docs/img/quickstart18.png b/docs/img/quickstart18.png index 3ab37e6739..6607a4a363 100644 Binary files a/docs/img/quickstart18.png and b/docs/img/quickstart18.png differ diff --git a/docs/img/quickstart19.png b/docs/img/quickstart19.png index a446453ea9..0e2b6597d5 100644 Binary files a/docs/img/quickstart19.png and b/docs/img/quickstart19.png differ diff --git a/docs/img/quickstart2.png b/docs/img/quickstart2.png index 531a67954d..ccc9170d6c 100644 Binary files a/docs/img/quickstart2.png and b/docs/img/quickstart2.png differ diff --git a/docs/img/quickstart20.png b/docs/img/quickstart20.png index a9ab7941b4..eb1e4b9d90 100644 Binary files a/docs/img/quickstart20.png and b/docs/img/quickstart20.png differ diff --git a/docs/img/quickstart21.png b/docs/img/quickstart21.png index fdb00c6dde..fc402bc15d 100644 Binary files a/docs/img/quickstart21.png and b/docs/img/quickstart21.png differ diff --git a/docs/img/quickstart22.png b/docs/img/quickstart22.png index 2c9b31b8ab..62559f83f2 100644 Binary files a/docs/img/quickstart22.png and b/docs/img/quickstart22.png differ diff --git a/docs/img/quickstart23.png b/docs/img/quickstart23.png index 774ce4ecb4..da0db3cfbd 100644 Binary files a/docs/img/quickstart23.png and b/docs/img/quickstart23.png differ diff --git a/docs/img/quickstart24.png b/docs/img/quickstart24.png index 06b22e579f..894ce827d8 100644 Binary files a/docs/img/quickstart24.png and b/docs/img/quickstart24.png differ diff --git a/docs/img/quickstart25.png b/docs/img/quickstart25.png index d3f851dfd0..a1ce9c1fd4 100644 Binary files a/docs/img/quickstart25.png and b/docs/img/quickstart25.png differ diff --git a/docs/img/quickstart26.png b/docs/img/quickstart26.png index 546da5efdd..4e74214290 100644 Binary files a/docs/img/quickstart26.png and b/docs/img/quickstart26.png differ diff --git a/docs/img/quickstart27.png b/docs/img/quickstart27.png index a76bd0fac6..dcebab2a6c 100644 Binary files a/docs/img/quickstart27.png and b/docs/img/quickstart27.png differ diff --git a/docs/img/quickstart28.png b/docs/img/quickstart28.png index c83c0b9af6..4e308e3bc3 100644 Binary files a/docs/img/quickstart28.png and b/docs/img/quickstart28.png differ diff --git a/docs/img/quickstart29.png b/docs/img/quickstart29.png index 1a0e9531a8..7d7ca70902 100644 Binary files a/docs/img/quickstart29.png and b/docs/img/quickstart29.png differ diff --git a/docs/img/quickstart3.png b/docs/img/quickstart3.png index 63beced880..84be6261ef 100644 Binary files a/docs/img/quickstart3.png and b/docs/img/quickstart3.png differ diff --git a/docs/img/quickstart30.png b/docs/img/quickstart30.png index 9809be408c..da5e06bbd8 100644 Binary files a/docs/img/quickstart30.png and b/docs/img/quickstart30.png differ diff --git a/docs/img/quickstart31.png b/docs/img/quickstart31.png index 853d4adcee..ef7e2663fd 100644 Binary files a/docs/img/quickstart31.png and b/docs/img/quickstart31.png differ diff --git a/docs/img/quickstart32.png b/docs/img/quickstart32.png index e98fc07b63..cd1f393469 100644 Binary files a/docs/img/quickstart32.png and b/docs/img/quickstart32.png differ diff --git a/docs/img/quickstart33-batch-mint.png b/docs/img/quickstart33-batch-mint.png index 7dcf289d27..f8c0a55c31 100644 Binary files a/docs/img/quickstart33-batch-mint.png and b/docs/img/quickstart33-batch-mint.png differ diff --git a/docs/img/quickstart4.png b/docs/img/quickstart4.png index b381d5ca2f..ceef3a7fb4 100644 Binary files a/docs/img/quickstart4.png and b/docs/img/quickstart4.png differ diff --git a/docs/img/quickstart5.png b/docs/img/quickstart5.png index eef4349512..b9fe040b7f 100644 Binary files a/docs/img/quickstart5.png and b/docs/img/quickstart5.png differ diff --git a/docs/img/quickstart6.png b/docs/img/quickstart6.png index 6049449a2f..2a87fc10f0 100644 Binary files a/docs/img/quickstart6.png and b/docs/img/quickstart6.png differ diff --git a/docs/img/quickstart7.png b/docs/img/quickstart7.png index cfc7e3f0ab..36e3d103b6 100644 Binary files a/docs/img/quickstart7.png and b/docs/img/quickstart7.png differ diff --git a/docs/img/quickstart8.png b/docs/img/quickstart8.png index 760143f767..7cc7d16c79 100644 Binary files a/docs/img/quickstart8.png and b/docs/img/quickstart8.png differ diff --git a/docs/img/quickstart9.png b/docs/img/quickstart9.png index f8507b1a8a..8a23b6ad13 100644 Binary files a/docs/img/quickstart9.png and b/docs/img/quickstart9.png differ diff --git a/docs/img/ripplex10-check.js b/docs/img/ripplex10-check.js new file mode 100644 index 0000000000..b036cd44ab --- /dev/null +++ b/docs/img/ripplex10-check.js @@ -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() \ No newline at end of file diff --git a/docs/index.page.tsx b/docs/index.page.tsx index e9cc34fd12..4b28653372 100644 --- a/docs/index.page.tsx +++ b/docs/index.page.tsx @@ -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() {

{translate('Getting Started')}

- -
{translate('Quickstart to XRP Ledger')}
+
+
{translate('Introduction to the XRP Ledger')}

{translate('An introduction to fundamental aspects of the XRP Ledger.')}

-
{translate('Get Started')}
+
{translate('Introduction')}
quick-start
@@ -325,13 +321,13 @@ export default function Docs() {
- + Python Logo
{translate('Python')}
diff --git a/docs/introduction/index.md b/docs/introduction/index.md index 406bca183f..16d74820f7 100644 --- a/docs/introduction/index.md +++ b/docs/introduction/index.md @@ -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 /%} diff --git a/docs/tutorials/index.md b/docs/tutorials/index.md index a751b277c7..ccf833f16b 100644 --- a/docs/tutorials/index.md +++ b/docs/tutorials/index.md @@ -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" /%} + +
{% 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 %} +{% /card-grid %} \ No newline at end of file diff --git a/docs/tutorials/javascript/build-a-browser-wallet-in-javascript.md b/docs/tutorials/javascript/build-apps/build-a-browser-wallet-in-javascript.md similarity index 100% rename from docs/tutorials/javascript/build-a-browser-wallet-in-javascript.md rename to docs/tutorials/javascript/build-apps/build-a-browser-wallet-in-javascript.md diff --git a/docs/tutorials/javascript/build-a-desktop-wallet-in-javascript.md b/docs/tutorials/javascript/build-apps/build-a-desktop-wallet-in-javascript.md similarity index 100% rename from docs/tutorials/javascript/build-a-desktop-wallet-in-javascript.md rename to docs/tutorials/javascript/build-apps/build-a-desktop-wallet-in-javascript.md diff --git a/docs/tutorials/javascript/get-started.md b/docs/tutorials/javascript/build-apps/get-started.md similarity index 100% rename from docs/tutorials/javascript/get-started.md rename to docs/tutorials/javascript/build-apps/get-started.md diff --git a/docs/tutorials/javascript/build-apps/index.md b/docs/tutorials/javascript/build-apps/index.md new file mode 100644 index 0000000000..9edc9eb433 --- /dev/null +++ b/docs/tutorials/javascript/build-apps/index.md @@ -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 /%} diff --git a/docs/tutorials/javascript/index.md b/docs/tutorials/javascript/index.md index 555a583973..c12a8bd3bc 100644 --- a/docs/tutorials/javascript/index.md +++ b/docs/tutorials/javascript/index.md @@ -2,12 +2,53 @@ html: javascript.html parent: tutorials.html top_nav_grouping: Article Types -metadata: - indexPage: true + --- # JavaScript -XRPL tutorials in JavaScript. +You can create your own interface to try out the capabilities and support your specific business needs. These tutorials build a test harness interface to try out features of the XRP Ledger. The harness displays multiple accounts, so that you can transfer tokens from one account to the other and see the results in real time. +Typically, the example functions involve four steps. +- Connect to the XRP Ledger and instantiate your wallet. +- Make changes to the XRP Ledger using transactions. +- Get the state of accounts and tokens on the XRP Ledger using requests. +- Disconnect from the XRP Ledger. + +Each lesson builds the Token Test Harness one section at a time, with complete JavaScript and HTML code samples and a code walkthrough. You can download the source code, manipulate it in a text editor, and run it in your favorite browser. + +Much of this is “brute force” code that sacrifices conciseness for readability. Each example builds on the previous examples, adding a new JavaScript file and the supporting HTML UI. + +Once familiar with the library functions, you can build sample applications in JavaScript. We anticipate that the applications you build greatly improve upon these examples. Your feedback and contributions are most welcome. + +To get started: +- create a new folder on your local disk and install the JavaScript library using npm. + + `npm install xrpl` + +- Clone or download the [Sample modules](https://github.com/XRPLF/xrpl-dev-portal/tree/master/_code-samples/quickstart/js/). + +## Tutorial Modules + +- **Send Payments on the XRPL** + + - [Create Accounts and Send XRP](./modular-tutorials/send-payments/create-accounts-send-xrp/) + - [Create Trust Line and Send Currency](./modular-tutorials/send-payments/create-trust-line-send-currency/) + - [Create Time-based Escrows](./modular-tutorials/send-payments/create-time-based-escrows/) + - [Create Conditional Escrows](./modular-tutorials/send-payments/create-conditional-escrows/) + +- **NFTs Using JavaScript** + - [Mint and Burn NFTs](./modular-tutorials/nfts/mint-and-burn-nfts/) + - [Transfer NFTs](./modular-tutorials/nfts/transfer-nfts/) + - [Broker an NFT Sale](./modular-tutorials/nfts/broker-an-nft-sale/) + - [Assign an Authorized Minter](./modular-tutorials/nfts/assign-an-authorized-minter/) + - [Batch Mint NFTs](./modular-tutorials/nfts/batch-mint-nfts/) + +- **Build Applications with JavaScript** + - [Get Started Using JavaScript](./build-apps/get-started/) + - [Build a Browser Wallet in JavaScript](./build-apps/build-a-browser-wallet-in-javascript/) + - [Build a Desktop Wallet in JavaScript](./build-apps/build-a-desktop-wallet-in-javascript/) + \ No newline at end of file diff --git a/docs/tutorials/javascript/modular-tutorials/index.md b/docs/tutorials/javascript/modular-tutorials/index.md deleted file mode 100644 index d46e8e7cf5..0000000000 --- a/docs/tutorials/javascript/modular-tutorials/index.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -html: modular-tutorials-in-javascript.html -parent: javascript.html -top_nav_grouping: Article Types -metadata: - indexPage: true ---- -# Modular Tutorials in JavaScript - -Modular XRPL tutorials in JavaScript. - - -{% child-pages /%} diff --git a/docs/tutorials/javascript/modular-tutorials/nfts/assign-an-authorized-minter.md b/docs/tutorials/javascript/modular-tutorials/nfts/assign-an-authorized-minter.md index 5abbda0375..c28ba40030 100644 --- a/docs/tutorials/javascript/modular-tutorials/nfts/assign-an-authorized-minter.md +++ b/docs/tutorials/javascript/modular-tutorials/nfts/assign-an-authorized-minter.md @@ -48,7 +48,7 @@ To authorize another account to create NFTs for your account: ## Mint an NFT for Another Account
- +
This example uses the Operational account, which was authorized in the previous step, to mint a token on behalf of the Standby account. diff --git a/docs/tutorials/javascript/modular-tutorials/nfts/batch-mint-nfts.md b/docs/tutorials/javascript/modular-tutorials/nfts/batch-mint-nfts.md index a7d8651847..e3533f8128 100644 --- a/docs/tutorials/javascript/modular-tutorials/nfts/batch-mint-nfts.md +++ b/docs/tutorials/javascript/modular-tutorials/nfts/batch-mint-nfts.md @@ -35,7 +35,7 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port ## Batch Mint NFTs
- +
This example lets you mint multiple NFTs for a single unique item. The NFT might represent "prints" of an original artwork, tickets to an event, or another limited set of unique items. diff --git a/docs/tutorials/javascript/modular-tutorials/nfts/broker-an-nft-sale.md b/docs/tutorials/javascript/modular-tutorials/nfts/broker-an-nft-sale.md index b30707ef22..ad635c8dbe 100644 --- a/docs/tutorials/javascript/modular-tutorials/nfts/broker-an-nft-sale.md +++ b/docs/tutorials/javascript/modular-tutorials/nfts/broker-an-nft-sale.md @@ -43,7 +43,7 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port ## Prepare a Brokered Transaction
- +
1. Use the Standby account to create an NFT Sell Offer with the Broker account as the destination. diff --git a/docs/tutorials/javascript/modular-tutorials/nfts/mint-and-burn-nfts.md b/docs/tutorials/javascript/modular-tutorials/nfts/mint-and-burn-nfts.md index 2c6c6be965..9b301199bd 100644 --- a/docs/tutorials/javascript/modular-tutorials/nfts/mint-and-burn-nfts.md +++ b/docs/tutorials/javascript/modular-tutorials/nfts/mint-and-burn-nfts.md @@ -38,7 +38,7 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port ## Mint an NFT
- +
To mint a non-fungible token object: diff --git a/docs/tutorials/javascript/modular-tutorials/nfts/transfer-nfts.md b/docs/tutorials/javascript/modular-tutorials/nfts/transfer-nfts.md index a527b93d8b..dc98421e37 100644 --- a/docs/tutorials/javascript/modular-tutorials/nfts/transfer-nfts.md +++ b/docs/tutorials/javascript/modular-tutorials/nfts/transfer-nfts.md @@ -42,7 +42,7 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port ## Create a Sell Offer
- +
To create a NFT sell offer: diff --git a/docs/tutorials/javascript/modular-tutorials/send-payments/create-accounts-send-xrp.md b/docs/tutorials/javascript/modular-tutorials/send-payments/create-accounts-send-xrp.md index e1f25bcdf5..98862f83e1 100644 --- a/docs/tutorials/javascript/modular-tutorials/send-payments/create-accounts-send-xrp.md +++ b/docs/tutorials/javascript/modular-tutorials/send-payments/create-accounts-send-xrp.md @@ -36,7 +36,7 @@ Download and expand the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-p ## Usage
- +
To get test accounts: @@ -52,7 +52,7 @@ To get test accounts: You can transfer XRP between your new accounts. Each account has its own fields and buttons.
- +
To transfer XRP from the Standby account to the Operational account: diff --git a/docs/tutorials/javascript/modular-tutorials/send-payments/create-conditional-escrows.md b/docs/tutorials/javascript/modular-tutorials/send-payments/create-conditional-escrows.md index 6d5c9e54ee..1ee0c06dad 100644 --- a/docs/tutorials/javascript/modular-tutorials/send-payments/create-conditional-escrows.md +++ b/docs/tutorials/javascript/modular-tutorials/send-payments/create-conditional-escrows.md @@ -62,7 +62,7 @@ To get test accounts: ### Create Conditional Escrow:
- +
When you create a conditional escrow, you need to specify the amount you want to reserve and the `Condition` value you generated above. You can also set a cancel date and time, after which the escrow is no longer available. diff --git a/docs/tutorials/javascript/modular-tutorials/send-payments/create-time-based-escrows.md b/docs/tutorials/javascript/modular-tutorials/send-payments/create-time-based-escrows.md index 627e7a1084..df68e38c29 100644 --- a/docs/tutorials/javascript/modular-tutorials/send-payments/create-time-based-escrows.md +++ b/docs/tutorials/javascript/modular-tutorials/send-payments/create-time-based-escrows.md @@ -45,7 +45,7 @@ To get test accounts: ## Create Escrow
- +
You can create a time-based escrow with a minimum time to finish the escrow and a cancel time after which the funds in escrow are no longer available to the recipient. This is a test harness: while a practical scenario might express time in days or weeks, this form lets you set the finish and cancel times in seconds so that you can quickly run through a variety of scenarios. (There are 86,400 seconds in a day, if you want to play with longer term escrows.) diff --git a/docs/tutorials/javascript/modular-tutorials/send-payments/create-trust-line-send-currency.md b/docs/tutorials/javascript/modular-tutorials/send-payments/create-trust-line-send-currency.md index 54079af809..d7210681e8 100644 --- a/docs/tutorials/javascript/modular-tutorials/send-payments/create-trust-line-send-currency.md +++ b/docs/tutorials/javascript/modular-tutorials/send-payments/create-trust-line-send-currency.md @@ -42,7 +42,7 @@ Open the Token Test Harness and get accounts: ## Create Trust Line
- +
To create a trust line between accounts: diff --git a/docs/tutorials/javascript/modular-tutorials/send-payments/index.md b/docs/tutorials/javascript/modular-tutorials/send-payments/index.md index 92001f5272..417d57b740 100644 --- a/docs/tutorials/javascript/modular-tutorials/send-payments/index.md +++ b/docs/tutorials/javascript/modular-tutorials/send-payments/index.md @@ -1,46 +1,13 @@ --- html: send-payments-using-javascript.html -parent: modular-tutorials-in-javascript.html -seo: - description: Use a JavaScript test harness to send XRP, trade currencies, and mint and trade NFTs. -labels: - - Accounts - - Cross-Currency - - Non-fungible Tokens, NFTs - - Payments - - Quickstart - - Tokens - - XRP +parent: javascript.html +top_nav_grouping: Article Types +metadata: + indexPage: true --- # Send Payments Using JavaScript -The XRP Ledger (XRPL) is a robust, secure, customizable service. You can create your own interface to try out the capabilities and support your specific business needs. +Send XRP and issued currency on the XRP Ledger using JavaScript. -This quickstart describes a test harness interface you can build to try out the XRP Ledger. The test harness displays multiple accounts, so that you can transfer tokens from one account to the other and see the results in real time. The image below shows the Token Test Harness at the completion of step 4. -![Quickstart Tutorial Window](/docs/img/quickstart1.png) - -That is a lot of fields and buttons, all working together to perform some significant practical tasks. But getting _started_ with the XRP Ledger is not that complicated. When you eat the elephant a bite at a time, none of the tasks are difficult to consume. - -Typically, the example functions for interacting with the XRP Ledger involve four steps. - -1. Connect to the XRP Ledger and instantiate your wallet. -2. Make changes to the XRP Ledger using transactions. -3. Get the state of accounts and tokens on the XRP Ledger using requests. -4. Disconnect from the XRP Ledger. - -Each lesson shows you how to build the Token Test Harness one section at a time. Each module lets you try out meaningful interactions with the test ledger, with complete JavaScript and HTML code samples and a code walkthrough. There is also a link to the complete source code for each section that can be modified with a text editor and run in a browser. If you cannot wait, you can follow the prerequisites below, then jump to lesson 4, [Create Conditional Escrows](create-conditional-escrows.md), and try out the complete test harness right away. - -This quickstart tutorial introduces you to the API used to implement features and explore the capabilities of XRP Ledger. It does not represent *all* of the capabilities of the API and this example is not intended for production or secure payment use. - -Much of this is “brute force” code that sacrifices conciseness for readability. Each example builds on the previous examples, adding a new JavaScript file and the supporting UI. We anticipate that the applications you build greatly improve upon these examples. Your feedback and contributions are most welcome. - -## Prerequisites - -To get started, create a new folder on your local disk and install the JavaScript library using `npm`. - -``` -npm install xrpl -``` - -Download and expand the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-portal/tree/master/_code-samples/quickstart/js/). +{% child-pages /%} diff --git a/docs/tutorials/javascript/modular-tutorials/send-payments/send-and-cash-checks.md b/docs/tutorials/javascript/modular-tutorials/send-payments/send-and-cash-checks.md new file mode 100644 index 0000000000..61f2a99e9d --- /dev/null +++ b/docs/tutorials/javascript/modular-tutorials/send-payments/send-and-cash-checks.md @@ -0,0 +1,902 @@ +--- +html: send-and-cash-checks.html +parent: send-payments-using-javascript.html +blurb: Send checks to facilitate a two-step payment. +labels: + - Accounts + - Quickstart + - Transaction Sending + - Checks + - XRP +--- +# Send and Cash Checks + +This example shows how to: + +1. Send a check to transfer XRP or issued currency to another account. +2. Get a list of checks you have sent or received. +3. Cash a check received from another account. +4. Cancel a check you have sent. + +Checks offer another option for transferring funds between accounts. Checks have two particular advantages. + +1. You can use a check to send funds to another account without first creating a trust line - the trust line is created automatically when the receiver chooses to accept the funds. +2. The receiver can choose to accept less than the full amount of the check. This allows you to authorize a maximum amount when the actual cost is not finalized. + + +[![Empty Check Form](/docs/img/quickstart-checks1.png)](/docs/img/quickstart-checks1.png) + +## Prerequisites + +Clone or download the [Modular Tutorial Samples](https://github.com/XRPLF/xrpl-dev-portal/tree/master/content/_code-samples/quickstart/js/){.github-code-download}. + +**Note:** Without the Quickstart Samples, you will not be able to try the examples that follow. + +## Usage + +To get test accounts: + +1. Open and launch `10check.html`. +2. Click **Get Standby Account**. +3. Click **Get Operational Account**. + +[![Form with New Accounts](/docs/img/quickstart-checks2.png)](/docs/img/quickstart-checks2.png) + +You can transfer XRP between your new accounts. Each account has its own fields and buttons. + +
+ +
+ +### Send a Check for XRP + +To send a check for XRP from the Standby account to the Operational account: + +1. On the Standby (left) side of the form, enter the **Amount** of XRP to send, in drops. +2. Copy and paste the **Operational Account** field to the Standby **Destination** field. +3. Set the **Currency** to _XRP_. +4. Click **Send Check**. + +[![Send Check Settings](/docs/img/quickstart-checks3.png)](/docs/img/quickstart-checks3.png) + +### Send a Check for an Issued Currency + +To send a check for an issued currency token from the Standby account to the Operational account: + +1. On the Standby side of the form, enter the **Amount** of currency to send. +2. Copy and paste the **Operational Account** field to the Standby **Destination** field. +3. Copy the **Standby Account** field and paste the value in the **Issuer** field. +4. Enter the **Currency** code for your token. +5. Click **Send Check**. + +[![Send Token Check Settings](/docs/img/quickstart-checks4.png)](/docs/img/quickstart-checks4.png) + + +### Get Checks + +Click **Get Checks** to get a list of the current checks you have sent or received. To uniquely identify a check (for existence, when cashing a check), capture the _index_ value for the check. + +[![Get Checks with index highlighted](/docs/img/quickstart-checks5.png)](/docs/img/quickstart-checks5.png) + +### Cash Check + +To cash a check you have received: + +1. Enter the **Check ID** (**index** value). +2. Enter the **Amount** you want to collect, up to the full amount of the check. +3. Enter the currency code. + a. If you cashing a check for XRP, enter _XRP_ in the **Currency** field. + b. If you are cashing a check for an issued currency token: + 1. Enter the **Issuer** of the token. + 2. Enter the **Currency** code for the token. +4. Click **Cash Check**. + +[![Cashed check results](/docs/img/quickstart-checks6.png)](/docs/img/quickstart-checks6.png) + + +### Get Balances + +Click **Get Balances** to get a list of obligations and assets for each account. + +[![Account Balances](/docs/img/quickstart-checks7.png)](/docs/img/quickstart-checks7.png) + +### Cancel Check + +To cancel a check you have previously sent to another account. + +1. Enter the **Check ID** (**index** value). +2. Click **Cancel Check**. + +[![Canceled check results](/docs/img/quickstart-checks8.png)](/docs/img/quickstart-checks8.png) + + +# Code Walkthrough + +You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-portal/tree/master/content/_code-samples/quickstart/js/){.github-code-download} in the source repository for this website. + +## ripplex10-check.js + +### sendCheck() + +Connect to the XRP ledger. + +```javascript +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 +``` + +Instantiate the account wallets. + +```javascript + const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value) + const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value) +``` + +Create the `check_amount` variable, based on the standby amount field. + +```javascript + var check_amount = standbyAmountField.value +``` + +If the currency is anything but _XRP_, it's an issued currency. Update the `check_amount` variable to include the `currency` and `issuer` fields. + +```javascript + if (standbyCurrencyField.value != "XRP") { + check_amount = { + "currency": standbyCurrencyField.value, + "value": standbyAmountField.value, + "issuer": standby_wallet.address + } + } +``` + +Define the `CheckCreate` transaction. + +```javascript + const send_check_tx = { + "TransactionType": "CheckCreate", + "Account": standby_wallet.address, + "SendMax": check_amount, + "Destination": standbyDestinationField.value + } +``` + +Prepare and sign the transaction. + +```javascript + 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 +``` + +Submit the transaction to the XRP Ledger and wait for the response. + +``` + const check_result = await client.submitAndWait(check_signed.tx_blob) +``` + +Report the results + +```javascript + 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}' + } +``` + +Update the XRP balance fields. + +```javascript + standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address)) + operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address)) +``` + +Disconnect from the XRP Ledger. + +```javascript + client.disconnect() +} // end of sendCheck() +``` + +### getChecks() + +```javascript +async function getChecks() { +``` + +Connect to the XRP Ledger. + +```javascript + 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" +``` + +Define and send the `account_objects` request, specifying `check` objects. + +```javascript + const check_objects = await client.request({ + "id": 5, + "command": "account_objects", + "account": standbyAccountField.value, + "ledger_index": "validated", + "type": "check" + }) +``` + +Report the results. + +```javascript + standbyResultField.value = JSON.stringify(check_objects.result, null, 2) +``` + +Disconnect from the XRP Ledger. + +```javascript + client.disconnect() +} // End of getChecks() +``` +### cashCheck() + +Connect to the XRP Ledger and instantiate the account wallets. + +```javascript +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) +``` + +Set the `check_amount` variable to the value in the **Amount** field. + +```javascript + var check_amount = standbyAmountField.value +``` + +If the **Currency** is anything other than `XRP`, the check is for an issued currency. Redefine the variable to include the `currency` and `issuer` for the token. + +``` + if (standbyCurrencyField.value != "XRP") { + check_amount = { + "value": standbyAmountField.value, + "currency": standbyCurrencyField.value, + "issuer": standbyIssuerField.value + } + } +``` + +Define the `CheckCash` transaction. + +```javascript + const cash_check_tx = { + "TransactionType": "CheckCash", + "Account": standby_wallet.address, + "Amount": check_amount, + "CheckID": standbyCheckID.value + } +``` + +Prepare and sign the transaction. + +```javascript + 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 +``` + +Submit the transaction and wait for the results. + +```javascript + const check_result = await client.submitAndWait(cash_signed.tx_blob) +``` + +Report the results. + +```javascript + 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}' + } +``` + +Update the XRP balance fields. + +```javascript + standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address)) + operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address)) +``` + +Disconnect from the XRP Ledger. + +```javascript + client.disconnect() +} // end of cashCheck() +``` + +### cancelCheck + +Connect to the XRP Ledger and instantiate the account wallets. + +```javascript +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) +``` + +Define the `CheckCancel` transaction. + +```javascript + const cancel_check_tx = { + "TransactionType": "CheckCancel", + "Account": standby_wallet.address, + "CheckID": standbyCheckID.value + } +``` + +Prepare and sign the transaction object. + +```javascript + const cancel_prepared = await client.autofill(cancel_check_tx) + const cancel_signed = standby_wallet.sign(cancel_prepared) + results += ' Cancelling check.\n' + standbyResultField.value = results +``` + +Submit the transaction and wait for the results. + +```javascript + const check_result = await client.submitAndWait(cancel_signed.tx_blob) +``` + +Report the results. + +```javascript + 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}' + } +``` + +Update the XRP balance fields. + +```javascript + standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address)) + operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address)) +``` + +Disconnect from the XRP Ledger. + +```javascript + client.disconnect() +} // end of cancelCheck() +``` + +### Reciprocal functions for the Operational account. + +```javascript +// ******************************************************* +// ************ 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() +``` + +## 10.check.html + +```html + + + Token Test Harness + + + + + + + + + + + + + + +

Token Test Harness

+
+ Choose your ledger instance: +    + + +    + + +

+ +
+ +

+ + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Standby Account + + +
+
+ Public Key + + +
+
+ Private Key + + +
+
+ Seed + + +
+
+ XRP Balance + + +
+
+ Amount + + +
+
+ Destination + + +
+
+ Issuer + + +
+
+ Check ID + + +
+
+ + +
+ Currency + + +
+

+ +

+
+ + + + + + +
+ +

+ +
+ +
+ +
+ +
+ +
+
+
+ + + + +
+ + + + + + + + + +
+ +

+ +
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Operational Account + + +
+
+ Public Key + + +
+
+ Private Key + + +
+
+ Seed + + +
+
+ XRP Balance + + +
+
+ Amount + + +
+
+ Destination + + +
+
+ Issuer + + +
+
+ Check ID + + +
+
+ + + + +
+ Currency + + +
+

+ +

+
+
+
+
+ + +``` \ No newline at end of file diff --git a/docs/tutorials/python/build-a-desktop-wallet-in-python.md b/docs/tutorials/python/build-apps/build-a-desktop-wallet-in-python.md similarity index 100% rename from docs/tutorials/python/build-a-desktop-wallet-in-python.md rename to docs/tutorials/python/build-apps/build-a-desktop-wallet-in-python.md diff --git a/docs/tutorials/python/get-started.md b/docs/tutorials/python/build-apps/get-started.md similarity index 100% rename from docs/tutorials/python/get-started.md rename to docs/tutorials/python/build-apps/get-started.md diff --git a/docs/tutorials/python/build-apps/index.md b/docs/tutorials/python/build-apps/index.md new file mode 100644 index 0000000000..dca92e1376 --- /dev/null +++ b/docs/tutorials/python/build-apps/index.md @@ -0,0 +1,14 @@ +--- +html: build-apps-in-python.html +parent: python.html +top_nav_grouping: Article Types +metadata: + indexPage: true +seo: + description: Build full-featured applications in Python. +--- +# Build Applications in Python + +Build full-featured applications in Python + +{% child-pages /%} diff --git a/docs/tutorials/python/index.md b/docs/tutorials/python/index.md index 2f5b678716..2cd293297f 100644 --- a/docs/tutorials/python/index.md +++ b/docs/tutorials/python/index.md @@ -2,12 +2,51 @@ html: python.html parent: tutorials.html top_nav_grouping: Article Types -metadata: - indexPage: true --- # Python -XRPL tutorials in Python. +You can create your own interface to try out the capabilities and support your specific business needs. These tutorials build a test harness interface to try out features of the XRP Ledger. The harness displays multiple accounts, so that you can transfer tokens from one account to the other and see the results in real time. +Typically, the example functions involve four steps. -{% child-pages /%} +- Connect to the XRP Ledger and instantiate your wallet. +- Make changes to the XRP Ledger using transactions. +- Get the state of accounts and tokens on the XRP Ledger using requests. +- Disconnect from the XRP Ledger. + +Each lesson builds the Token Test Harness one section at a time, with complete Python code that incrementally builds a user interface and separate files that contain the business logic. After describing usage, each lesson provides a code walkthrough. You can download the source code, manipulate it in your favorite IDE, and run it to interact with the XRP Ledger. + +Once familiar with the library functions, you can build sample applications in Python. We anticipate that the applications you build greatly improve upon these examples. Your feedback and contributions are most welcome. + +To get started: + +- Create a new folder on your local disk and install the Python library (xrpl-py) using pip. +

+ `pip3 install xrpl-py` + +- Clone or download the [Sample modules](https://github.com/XRPLF/xrpl-dev-portal/tree/master/_code-samples/quickstart/py/). + +**Note**: Without the sample modules, you won't be able to try the examples that follow. + +## Tutorial Modules + +- **Send Payments on the XRPL** + + - [Create Accounts and Send XRP](./modular-tutorials/send-payments/create-accounts-send-xrp/) + - [Create TrustLine and Send Currency](./modular-tutorials/send-payments/create-trust-line-send-currency/) + - [Create Time-based Escrows](./modular-tutorials/send-payments/create-time-based-escrows/) + - [Create Conditional Escrows](./modular-tutorials/send-payments/create-conditional-escrows/) + - [Send Checks](./modular-tutorials/send-payments/send-checks/) + +- **Mint and Trade NFTs on the XRPL** + - [Mint and Burn NFTs](./modular-tutorials/nfts/mint-and-burn-nfts/) + - [Transfer NFTs](./modular-tutorials/nfts/transfer-nfts/) + - [Broker an NFT Sale](./modular-tutorials/nfts/broker-an-nft-sale/) + - [Assign an Authorized Minter](./modular-tutorials/nfts/assign-an-authorized-minter/) + - [Batch Mint NFTs](./modular-tutorials/nfts/batch-mint-nfts) + +- **Build Applications with Python** + - [Get Started Using Python](./get-started/) + - [Build a Desktop Wallet in Python](./build-a-desktop-wallet-in-python/) + + diff --git a/docs/tutorials/python/modular-tutorials/send-payments/create-accounts-send-xrp.md b/docs/tutorials/python/modular-tutorials/send-payments/create-accounts-send-xrp.md index 9ceb30947f..e9e7c3827e 100644 --- a/docs/tutorials/python/modular-tutorials/send-payments/create-accounts-send-xrp.md +++ b/docs/tutorials/python/modular-tutorials/send-payments/create-accounts-send-xrp.md @@ -34,9 +34,8 @@ Download and expand the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-p **Note:** Without the Quickstart Samples, you will not be able to try the examples that follow. ## Usage -
- +
To get test accounts: @@ -53,7 +52,7 @@ To get test accounts: You can transfer XRP between your new accounts. Each account has its own fields and buttons.
- +
To transfer XRP from the Standby account to the Operational account: diff --git a/docs/tutorials/python/modular-tutorials/send-payments/send-and-cash-checks.md b/docs/tutorials/python/modular-tutorials/send-payments/send-and-cash-checks.md new file mode 100644 index 0000000000..e30c090d7c --- /dev/null +++ b/docs/tutorials/python/modular-tutorials/send-payments/send-and-cash-checks.md @@ -0,0 +1,663 @@ +--- +html: send-and-cash-checks.html +parent: send-payments-using-python.html +blurb: Send checks to facilitate a two-step payment. +labels: + - Accounts + - Quickstart + - Transaction Sending + - Checks + - XRP +--- +# Send and Cash Checks + +This example shows how to: + +1. Send a check to transfer XRP or issued currency to another account. +2. Get a list of checks you have sent or received. +3. Cash a check received from another account. +4. Cancel a check you have sent. + +Checks offer another option for transferring funds between accounts. Checks have two particular advantages. + +1. You can use a check to send funds to another account without first creating a trust line - the trust line is created automatically when the receiver chooses to accept the funds. +2. The receiver can choose to accept less than the full amount of the check. This allows you to authorize a maximum amount when the actual cost is not finalized. + + +[![Empty Check Form](/docs/img/quickstart-py-checks1.png)](/docs/img/quickstart-py-checks1.png) + +## Prerequisites + +If you haven't done so already, create a new folder on your local disk and install the Python library using `pip`. + +``` + pip3 install xrpl-py +``` + +Clone or download the [Modular Tutorial Samples](https://github.com/XRPLF/xrpl-dev-portal/tree/master/content/_code-samples/quickstart/py/){.github-code-download}. + +**Note:** Without the Quickstart Samples, you will not be able to try the examples that follow. + +## Usage + +To get test accounts: + +1. Open and launch `lesson10-check.py`. +2. Click **Get Standby Account**. +3. Click **Get Operational Account**. +4. Click **Get Standby Account Info**. +5. Click **Get Operational Account Info**. +5. Copy and paste the **Standby Seed** and **Operational Seed** fields to a persistent location, such as a Notepad, so that you can reuse the accounts after reloading the form. + +[![Form with New Accounts](/docs/img/quickstart-py-checks2.png)](/docs/img/quickstart-py-checks2.png) + +You can transfer XRP between your new accounts. Each account has its own fields and buttons. + +
+ +
+ +### Send a Check for XRP + +To send a check for XRP from the Standby account to the Operational account: + +1. On the Standby (left) side of the form, enter the **Amount** of XRP to send in drops. +2. Copy and paste the **Operational Account** field to the Standby **Destination** field. +3. Set the **Currency** to _XRP_. +4. Click **Send Check**. + +[![Send Check Settings](/docs/img/quickstart-py-checks3.png)](/docs/img/quickstart-py-checks3.png) + +### Send a Check for an Issued Currency + +To send a check for an issued currency token from the Standby account to the Operational account: + +1. On the Standby side of the form, enter the **Amount** of currency to send. +2. Copy and paste the **Operational Account** field to the Standby **Destination** field. +3. Copy the **Standby Account** field and paste the value in the **Issuer** field. +4. Enter the **Currency** code for your token. +5. Click **Send Check**. + +[![Send Token Check Settings](/docs/img/quickstart-py-checks4.png)](/docs/img/quickstart-py-checks4.png) + + +### Get Checks + +Click **Get Checks** to get a list of the current checks you have sent or received. To uniquely identify a check (for existence, when cashing a check), capture the **index** value for the check. + +[![Get Checks with index highlighted](/docs/img/quickstart-py-checks5.png)](/docs/img/quickstart-py-checks5.png) + +### Cash Check + +To cash a check you have received: + +1. Enter the **Check ID** (**index** value). +2. Enter the **Amount** you want to collect, up to the full amount of the check. +3. Enter the currency code. + a. If you cashing a check for XRP, enter _XRP_ in the **Currency** field. + b. If you are cashing a check for an issued currency token: + 1. Enter the **Issuer** of the token. + 2. Enter the **Currency** code for the token. +4. Click **Cash Check**. + +[![Cashed check results](/docs/img/quickstart-py-checks6.png)](/docs/img/quickstart-py-checks6.png) + + +### Get Balances + +Click **Get Balances** to get a list of obligations and assets for each account. + +[![Account Balances](/docs/img/quickstart-py-checks7.png)](/docs/img/quickstart-py-checks7.png) + +### Cancel Check + +To cancel a check you have previously sent to another account. + +1. Enter the **Check ID** (**index** value). +2. Click **Cancel Check**. + +[![Canceled check results](/docs/img/quickstart-py-checks8.png)](/docs/img/quickstart-py-checks8.png) + + +# Code Walkthrough + +You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-portal/tree/master/content/_code-samples/quickstart/py/){.github-code-download} in the source repository for this website. + +## mod10.py + +Import dependencies. + +```python +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 +``` + +Set the TestNet URL. + +```python +testnet_url = "https://s.altnet.rippletest.net:51234" +``` +### send_check + +Pass the arguments for the account seed, check amount, and destination account. Set the currency type to _XRP_, or if it is an issued currency token provide the currency type and issuer. + +```python +def send_check(seed, amount, destination, currency, issuer): + """send_check""" +``` + +Instantiate the account wallet and create a client connection. + +```python + wallet=Wallet.from_seed(seed) + client=JsonRpcClient(testnet_url) +``` + +Create the amount variable. If you are sending XRP, the amount variable is fine as is. If you are sending issued currency, you need to create an amount object that includes the currency and the issuer. + +```python + if currency != "XRP": + amount = {"value": amount, + "currency": currency, + "issuer": issuer + } +``` + +Define the `CheckCreate` transaction. + +```python + check_tx=xrpl.models.transactions.CheckCreate( + account=wallet.address, + send_max=amount, + destination=destination + ) +``` + +Submit the transaction and report the results. + +```python + 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 +``` + +### cash_check + +Pass the values for seed, amount, and check_id. Set the currency type to _XRP_, or include the currency type and issuer. + +```python +def cash_check(seed, amount, check_id, currency, issuer): + """cash_check""" +``` + +Instantiate the account wallet and create a client connection. + +```python + wallet=Wallet.from_seed(seed) + client=JsonRpcClient(testnet_url) +``` + +If using an issued currency token, create an amount object that includes the currency type and issuer. + +```python + if currency != "XRP": + amount = { + "value": amount, + "currency": currency, + "issuer": issuer + } +``` + +Define the CheckCash transaction. + +```python + finish_tx=xrpl.models.transactions.CheckCash( + account=wallet.address, + amount=amount, + check_id=check_id + ) +``` + +Submit the transaction and report the results. + +```python + 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 +``` + +### cancel_check + +Pass the values for the account seed and the check ID. + +```python +def cancel_check(seed, check_id): + """cancel_check""" +``` + +Instantiate the account wallet and create a client connection. + +```python + wallet=Wallet.from_seed(seed) + client=JsonRpcClient(testnet_url) +``` + +Define the CheckCancel transaction. + +```python + cancel_tx=xrpl.models.transactions.CheckCancel( + account=wallet.address, + check_id=check_id + ) +``` + +Submit the transaction and report the results + +```python + 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 +``` + +### get_checks + +```python +def get_checks(account): + """get_checks""" +``` + +Create a client connection. + +```python + client=JsonRpcClient(testnet_url) +``` + +Define the AccountObjects request, specifying the type _check_. + +```python + acct_checks=AccountObjects( + account=account, + ledger_index="validated", + type="check" + ) +``` + +Send the request and report the results. + +```python + response=client.request(acct_checks) + return response.result +``` + +## lesson10-check.py + +This example builds on `lesson2-send-currency.py`. Changes are noted below. + +```python +import tkinter as tk +import xrpl +import json + +from mod1 import get_account, get_account_info, send_xrp +from mod2 import get_balance +``` + +Import check-specific functions. + +```python +from mod10 import send_check, cash_check, cancel_check, get_checks + +############################################# +## Handlers ################################# +############################################# +``` + +Add handlers for module 10. + +```python +## 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_standby_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 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 "Check 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) +``` + +Add fields for _Issuer_ and _Check ID_. + +```python +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) +``` + +Place the _Issuer_ and _Check ID_ fields in the grid. + +```python +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) +``` + +Add fields for the _Issuer_ and _Check ID_. + +```python +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") +``` + +Place the _Issuer_ and _Check ID_ fields in the grid. + +```python +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") +``` + +Add standby buttons for **Send Check**, **Get Checks**, **Cash Check**, **Cancel Check**, and **Get Balances**. + + +```python +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") +``` + +Add operational buttons for **Send Check**, **Get Checks**, **Cash Check**, **Cancel Check**, and **Get Balances**. + + +```javascript +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() +``` \ No newline at end of file diff --git a/sidebars.yaml b/sidebars.yaml index b7ea09abd4..4b26cc472b 100644 --- a/sidebars.yaml +++ b/sidebars.yaml @@ -155,52 +155,55 @@ expanded: false items: - page: docs/tutorials/public-servers.md - - page: docs/tutorials/python/index.md - expanded: false - items: - - page: docs/tutorials/python/get-started.md - - page: docs/tutorials/python/modular-tutorials/index.md - expanded: false - items: - - page: docs/tutorials/python/modular-tutorials/send-payments/index.md - expanded: false - items: - - page: docs/tutorials/python/modular-tutorials/send-payments/create-accounts-send-xrp.md - - page: docs/tutorials/python/modular-tutorials/send-payments/create-trust-line-send-currency.md - - page: docs/tutorials/python/modular-tutorials/send-payments/create-time-based-escrows.md - - page: docs/tutorials/python/modular-tutorials/nfts/index.md - expanded: false - items: - - page: docs/tutorials/python/modular-tutorials/nfts/mint-and-burn-nfts.md - - page: docs/tutorials/python/modular-tutorials/nfts/transfer-nfts.md - - page: docs/tutorials/python/modular-tutorials/nfts/broker-an-nft-sale.md - - page: docs/tutorials/python/modular-tutorials/nfts/assign-an-authorized-minter.md - - page: docs/tutorials/python/modular-tutorials/nfts/batch-mint-nfts.md - - page: docs/tutorials/python/build-a-desktop-wallet-in-python.md - page: docs/tutorials/javascript/index.md expanded: false items: - - page: docs/tutorials/javascript/get-started.md - - page: docs/tutorials/javascript/modular-tutorials/index.md + - page: docs/tutorials/javascript/modular-tutorials/send-payments/index.md expanded: false items: - - page: docs/tutorials/javascript/modular-tutorials/send-payments/index.md - expanded: false - items: - - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-accounts-send-xrp.md - - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-trust-line-send-currency.md - - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-time-based-escrows.md - - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-conditional-escrows.md - - page: docs/tutorials/javascript/modular-tutorials/nfts/index.md - expanded: false - items: - - page: docs/tutorials/javascript/modular-tutorials/nfts/mint-and-burn-nfts.md - - page: docs/tutorials/javascript/modular-tutorials/nfts/transfer-nfts.md - - page: docs/tutorials/javascript/modular-tutorials/nfts/broker-an-nft-sale.md - - page: docs/tutorials/javascript/modular-tutorials/nfts/assign-an-authorized-minter.md - - page: docs/tutorials/javascript/modular-tutorials/nfts/batch-mint-nfts.md - - page: docs/tutorials/javascript/build-a-browser-wallet-in-javascript.md - - page: docs/tutorials/javascript/build-a-desktop-wallet-in-javascript.md + - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-accounts-send-xrp.md + - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-trust-line-send-currency.md + - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-time-based-escrows.md + - page: docs/tutorials/javascript/modular-tutorials/send-payments/create-conditional-escrows.md + - page: docs/tutorials/javascript/modular-tutorials/send-payments/send-and-cash-checks.md + - page: docs/tutorials/javascript/modular-tutorials/nfts/index.md + expanded: false + items: + - page: docs/tutorials/javascript/modular-tutorials/nfts/mint-and-burn-nfts.md + - page: docs/tutorials/javascript/modular-tutorials/nfts/transfer-nfts.md + - page: docs/tutorials/javascript/modular-tutorials/nfts/broker-an-nft-sale.md + - page: docs/tutorials/javascript/modular-tutorials/nfts/assign-an-authorized-minter.md + - page: docs/tutorials/javascript/modular-tutorials/nfts/batch-mint-nfts.md + - page: docs/tutorials/javascript/build-apps/index.md + expanded: false + items: + - page: docs/tutorials/javascript/build-apps/get-started.md + - page: docs/tutorials/javascript/build-apps/build-a-browser-wallet-in-javascript.md + - page: docs/tutorials/javascript/build-apps/build-a-desktop-wallet-in-javascript.md + - page: docs/tutorials/python/index.md + expanded: false + items: + - page: docs/tutorials/python/modular-tutorials/send-payments/index.md + expanded: false + items: + - page: docs/tutorials/python/modular-tutorials/send-payments/create-accounts-send-xrp.md + - page: docs/tutorials/python/modular-tutorials/send-payments/create-trust-line-send-currency.md + - page: docs/tutorials/python/modular-tutorials/send-payments/create-time-based-escrows.md + - page: docs/tutorials/python/modular-tutorials/send-payments/create-conditional-escrows.md + - page: docs/tutorials/python/modular-tutorials/send-payments/send-and-cash-checks.md + - page: docs/tutorials/python/modular-tutorials/nfts/index.md + expanded: false + items: + - page: docs/tutorials/python/modular-tutorials/nfts/mint-and-burn-nfts.md + - page: docs/tutorials/python/modular-tutorials/nfts/transfer-nfts.md + - page: docs/tutorials/python/modular-tutorials/nfts/broker-an-nft-sale.md + - page: docs/tutorials/python/modular-tutorials/nfts/assign-an-authorized-minter.md + - page: docs/tutorials/python/modular-tutorials/nfts/batch-mint-nfts.md + - page: docs/tutorials/python/build-apps/index.md + expanded: false + items: + - page: docs/tutorials/python/build-apps/get-started.md + - page: docs/tutorials/python/build-apps/build-a-desktop-wallet-in-python.md - page: docs/tutorials/java/index.md expanded: false items: