Merge pull request #1414 from XRPLF/Updates_for_JS2.2.3

Updates for js2.2.3
This commit is contained in:
Dennis Dawson
2022-06-09 11:02:00 -07:00
committed by GitHub
36 changed files with 1989 additions and 861 deletions

View File

@@ -56,6 +56,7 @@ This transaction assumes that the issuer, `rNCFjv8Ek5oDrNiMJ3pw6eLLFtMjZLJnf2`,
**Note:** The xrpl.js client library throws an error if you try to sign a transaction with the `URI` field in lowercase hexadecimal. This is a [bug](https://github.com/XRPLF/xrpl.js/issues/2004).
## NFTokenMint Flags
Transactions of the NFTokenMint type support additional values in the [`Flags` field](transaction-common-fields.html#flags-field), as follows:

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,7 @@ This example shows how to:
2. Retrieve the accounts from seed values.
3. Transfer XRP between accounts.
When you create an account, you receive a public/private key pair offline. It does not appear on the ledger until it is funded with XRP. This example shows how to create an account for Testnet, but not how to create an account that you can use on Mainnet.
When you create an account, you receive a public/private key pair offline. It does not appear on the ledger until it is funded with XRP. This example shows how to create accounts for Testnet, but not how to create an account that you can use on Mainnet.
@@ -47,7 +47,7 @@ To get test accounts:
1. Open `1.get-accounts-send-xrp.html` in a browser
2. Choose **Testnet** or **Devnet**.
2. Choose **NFT-Devnet**, **Testnet**, or **Devnet**.
3. Click **Get New Standby Account**.
4. Click **Get New Operational Account.**
5. Copy and paste the **Seeds** field in a persistent location, such as a Notepad, so that you can reuse the accounts after reloading the form.
@@ -56,22 +56,6 @@ To get test accounts:
![Standby and Operational Accounts](img/quickstart3.png)
NOTE: The accounts in the test harness work on _Testnet_ and _Devnet_, but not on _NFT-Devnet_. To create accounts that can mint and trade NFTs:
1. Visit the [XRP Testnet Faucet](https://xrpl.org/xrp-testnet-faucet.html) page.
2. Click **Generate NFT-Devnet credentials**.
3. Copy the account **Secret**.
4. Paste the secret in a persistent location, such as a notepad, and press return.
5. Click **Generate NFT-Devnet credentials** to create a second account.
6. Copy the account **Secret**.
7. Paste the secret in the persistent location.
8. Copy both secrets, separated by a return.
9. Paste them in the **Account** **Seeds** field.
10. Click **Get Accounts from Seeds**.
You can transfer XRP between your new accounts. Each account has its own fields and buttons.
To transfer XRP between accounts:
@@ -79,7 +63,8 @@ To transfer XRP between accounts:
1. Enter the **Amount** of XRP to send.
2. Click **Send XRP>** to transfer XRP from the standby account to the operational account, or **<Send XRP** to transfer XRP from the operational account to the standby account**.**
2. Enter the **Destination** account (for example, copy and paste the Operational **Account Field** to the Standby **Destination** field).
3. Click **Send XRP>** to transfer XRP from the standby account to the operational account, or **<Send XRP** to transfer XRP from the operational account to the standby account.
@@ -95,7 +80,7 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port
## ripplex-1-send-xrp.js
This example can be used with any XRP Ledger network. Currently, there are _Testnet_ and _Devnet,_ with the experimental _NFT-Devnet_ server with support for NFTs. You can update the code to choose different or additional XRP Ledger networks.
This example can be used with any XRP Ledger network. Currently, there are _Testnet_ and _Devnet,_ with the experimental _NFT-Devnet_ server with support for NFTokens. You can update the code to choose different or additional XRP Ledger networks.
### getNet()
@@ -116,9 +101,9 @@ This function uses brute force `if` statements to discover the selected network
```
let net
if (document.getElementById("xls").checked) net = "wss://xls20-sandbox.rippletest.net:51233"
if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
return net
if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
return net
} // End of getNet()
```
@@ -243,7 +228,7 @@ Otherwise, populate the operational account fields.
```
Insert the seed values for both accounts as they are created to the **Seeds** field as a convenience. You can copy the values and store them offline, then paste them into the **Seeds** field to retrieve the accounts with the `getAccountsFromSeeds()` function.
Insert the seed values for both accounts as they are created to the **Seeds** field as a convenience. You can copy the values and store them offline. When you reload this form or another in this tutorial, copy and paste them into the **Seeds** field to retrieve the accounts with the `getAccountsFromSeeds()` function.
```
@@ -289,7 +274,7 @@ Connect to the selected network.
```
Parse the **seeds** field.
Parse the **Seeds** field.
```
@@ -396,7 +381,7 @@ Connect to your selected ledger.
```
Prepare the transaction. This is a Payment transaction from the standby wallet to the operational wallet. You could add a **Destination** field to send to any account: this hardcoded example is for convenience in this tutorial.
Prepare the transaction. This is a Payment transaction from the standby wallet to the operational wallet.
The _Payment_ transaction expects the XRP to be expressed in drops, or 1/millionth of an XRP. You can use the xrpToDrops utility to convert the send amount for you (which beats having to type an extra 6 zeroes to send 1 XRP).
@@ -406,7 +391,7 @@ The _Payment_ transaction expects the XRP to be expressed in drops, or 1/million
"TransactionType": "Payment",
"Account": standby_wallet.address,
"Amount": xrpl.xrpToDrops(sendAmount),
"Destination": operational_wallet.address
"Destination": standbyDestinationField.value
})
@@ -499,7 +484,7 @@ For each of the transactions, there is an accompanying reciprocal transaction, w
"TransactionType": "Payment",
"Account": operational_wallet.address,
"Amount": xrpl.xrpToDrops(operationalAmountField.value),
"Destination": standby_wallet.address
"Destination": operationalDestinationField.value
})
@@ -539,18 +524,24 @@ Create a standard HTML form to send transactions and requests, then display the
<html>
<head>
<title>Token Test Harness</title>
<script src='https://unpkg.com/xrpl@2.1.1'></script>
<script src='https://unpkg.com/xrpl@2.2.3'></script>
<script src='ripplex1-send-xrp.js'></script>
<script>
if (typeof module !== "undefined") {
const xrpl = require('xrpl')
}
</script>
</head>
<!-- ************************************************************** -->
<!-- ********************** The Form ****************************** -->
<!-- ************************************************************** -->
<body>
<h1>Token Test Harness</h1>
<form id="theForm">
Choose your network:
Choose your ledger instance:
<input type="radio" id="xls" name="server"
value="wss://xls20-sandbox.rippletest.net:51233" checked>
<label for="xls20">XLS20-NFT</label>
@@ -630,6 +621,15 @@ Create a standard HTML form to send transactions and requests, then display the
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="standbyDestinationField" size="40" value="100"></input>
<br>
</td>
</tr>
</table>
<p align="right">
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
@@ -716,6 +716,15 @@ Create a standard HTML form to send transactions and requests, then display the
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="operationalDestinationField" size="40" value="100"></input>
<br>
</td>
</tr>
</table>
<p align="right">
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
@@ -739,4 +748,4 @@ Create a standard HTML form to send transactions and requests, then display the
| Previous | Next |
| :--- | ---: |
| [← XRPL Quickstart >](xrpl-quickstart.html) | [2. Create TrustLine and Send Currency → >](create-trustline-send-currency.html) |
| [← XRPL Quickstart >](xrpl-quickstart.html) | [2. Create Trust Line and Send Currency → >](create-trustline-send-currency.html) |

View File

@@ -10,7 +10,7 @@ labels:
---
# 2. Create TrustLine and Send Currency
# 2. Create Trust Line and Send Currency
This example shows how to:
@@ -18,7 +18,7 @@ This example shows how to:
1. Configure accounts to allow transfer of funds to third party accounts.
2. Set a currency type for transactions.
3. Create a TrustLine between the standby account and the operational account.
3. Create a trust line between the standby account and the operational account.
4. Send issued currency between accounts.
5. Display account balances for all currencies.
@@ -53,7 +53,8 @@ To create a trustline between accounts:
3. Enter a [currency code](https://www.iban.com/currency-codes) in the **Currency** field.
4. Enter the maximum transfer limit in the **Amount** field.
5. Click **Create Trustline**.
5. Enter the destination account value in the **Destination** field.
6. Click **Create Trustline**.
@@ -63,12 +64,14 @@ To create a trustline between accounts:
## Send an Issued Currency Token
To transfer an issued currency token, once you have created a TrustLine:
To transfer an issued currency token, once you have created a trust line:
1. Enter the **Amount**.
2. Click **Send Currency**.
2. Enter the **Destination**.
3. Enter the **Currency** type.
4. Click **Send Currency**.
@@ -194,9 +197,9 @@ Report the result.
### Create TrustLine
### Create Trust Line
A TrustLine enables two accounts to trade a defined currency up to a set limit. This gives the participants assurance that any exchanges are between known entities at agreed upon maximum amounts.
A trust line enables two accounts to trade a defined currency up to a set limit. This gives the participants assurance that any exchanges are between known entities at agreed upon maximum amounts.
```
@@ -227,6 +230,12 @@ Get the standby and operational wallets.
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
```
Capture the currency code from the standby currency field.
```
const currency_code = standbyCurrencyField.value
```
Define the transaction, capturing the currency code and (limit) amount from the form fields.
@@ -235,7 +244,7 @@ Define the transaction, capturing the currency code and (limit) amount from the
```
const trustSet_tx = {
"TransactionType": "TrustSet",
"Account": operational_wallet.address,
"Account": standbyDestinationField.value,
"LimitAmount": {
"currency": standbyCurrencyField.value,
"issuer": standby_wallet.address,
@@ -290,7 +299,7 @@ Report the results.
### Send Issued Currency
Once you have created a TrustLine from an account to your own, you can send issued currency tokens to that account, up to the established limit.
Once you have created a trust line from an account to your own, you can send issued currency tokens to that account, up to the established limit.
```
@@ -341,7 +350,7 @@ Get the account wallets.
"value": issue_quantity,
"issuer": standby_wallet.address
},
"Destination": operational_wallet.address
"Destination": standbyDestinationField.value
}
```
@@ -359,7 +368,7 @@ Sign the transaction.
```
const pay_signed = standby_wallet.sign(pay_prepared)
results += 'Sending ${issue_quantity} ${currency_code} to ${operational_wallet.address}...'
results += 'Sending ${issue_quantity} ${currency_code} to ' + standbyDestinationField.value + '...'
document.getElementById('standbyResultField').value = results
```
@@ -526,7 +535,7 @@ For each of the transactions, there is an accompanying reciprocal transaction, w
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
const trustSet_tx = {
"TransactionType": "TrustSet",
"Account": standby_wallet.address,
"Account": operationalDestinationField.value,
"LimitAmount": {
"currency": operationalCurrencyField.value,
"issuer": operational_wallet.address,
@@ -535,11 +544,12 @@ For each of the transactions, there is an accompanying reciprocal transaction, w
}
const ts_prepared = await client.autofill(trustSet_tx)
const ts_signed = standby_wallet.sign(ts_prepared)
results += '\nCreating trust line from standby account to operational account...'
results += '\nCreating trust line from operational account to ' + operationalDestinationField.value + ' account...'
document.getElementById('operationalResultField').value = results
const ts_result = await client.submitAndWait(ts_signed.tx_blob)
if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
results += '\nTrustline established between account \n' + standby_wallet.address + ' \n and account\n' + operational_wallet.address + '.'
results += '\nTrustline established between account \n' + standby_wallet.address + ' \n and account\n' +
operationalDestinationField.value + '.'
document.getElementById('operationalResultField').value = results
} else {
results += '\nTrustLine failed. See JavaScript console for details.'
@@ -582,13 +592,13 @@ For each of the transactions, there is an accompanying reciprocal transaction, w
"value": issue_quantity,
"issuer": operational_wallet.address
},
"Destination": standby_wallet.address
"Destination": operationalDestinationField.value
}
const pay_prepared = await client.autofill(send_token_tx)
const pay_signed = operational_wallet.sign(pay_prepared)
results += 'Sending ${issue_quantity} ${currency_code} to ${standby_wallet.address}...'
results += 'Sending ${issue_quantity} ${currency_code} to ' + operationalDestinationField.value + '...'
document.getElementById('operationalResultField').value = results
const pay_result = await client.submitAndWait(pay_signed.tx_blob)
if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
@@ -603,9 +613,8 @@ For each of the transactions, there is an accompanying reciprocal transaction, w
(await client.getXrpBalance(standby_wallet.address))
document.getElementById('operationalBalanceField').value =
(await client.getXrpBalance(operational_wallet.address))
client.disconnect()
getBalances()
client.disconnect()
} // end of oPsendCurrency()
```
@@ -621,7 +630,7 @@ Update the form to support the new functions.
<html>
<head>
<title>Token Test Harness</title>
<script src='https://unpkg.com/xrpl@2.1.1'></script>
<script src='https://unpkg.com/xrpl@2.2.3'></script>
<script src='ripplex1-send-xrp.js'></script>
<script src='ripplex2-send-currency.js'></script>
<script>
@@ -630,8 +639,7 @@ Update the form to support the new functions.
}
</script>
</head>
<!-- ************************************************************** -->
<!-- ********************** The Form ****************************** -->
<!-- ************************************************************** -->
@@ -719,6 +727,15 @@ Update the form to support the new functions.
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="standbyDestinationField" size="40" value="100"></input>
<br>
</td>
</tr>
<tr valign="top">
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
<td>
@@ -835,7 +852,18 @@ Update the form to support the new functions.
</tr>
<tr>
<td align="right">
<input type="checkbox" id="operationalDefault" checked="true"/>
Destination
</td>
<td>
<input type="text" id="operationalDestinationField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
<input type="checkbox" id="operationalDefault" checked="true"/>
<label for="operationalDefault">Allow Rippling</label>
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
</td>

View File

@@ -20,7 +20,7 @@ This example shows how to:
3. Delete (Burn) a NFToken.
![Test harness with mint NFToken fields](img/quickstart13.png)
![Test harness with mint NFToken fields](img/quickstart8.png)
@@ -34,24 +34,16 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port
1. Open `3.mint-nfts.html` in a browser.
2. Get test accounts.
1. If you have existing NFT-Devnet account seeds
1. Paste account seeds in the **Seeds** field.
1. If you have existing NFT-Devnet account seeds:
1. Paste the account seeds in the **Seeds** field.
2. Click **Get Accounts from Seeds**.
2. If you do not have NFT-Devnet account seeds:
1. Visit the [XRP Testnet Faucet](https://xrpl.org/xrp-testnet-faucet.html) page.
2. Click **Generate NFT-Devnet credentials**.
3. Copy the account **Secret**.
4. Paste the secret in a persistent location, such as a notepad, and press return.
5. Click **Generate NFT-Devnet credentials** to create a second account.
6. Copy the account **Secret**.
7. Paste the secret in the persistent location.
8. Copy both secrets, separated by a return.
9. Paste them in the **Account** **Seeds** field.
10. Click **Get Accounts from Seeds**.
2. If you do not have existing NFT-Devnet accounts:
1. Click **Get New Standby Account**.
2. Click **Get New Operational Account**.
![Get accounts](img/quickstart14.png)
![Get accounts](img/quickstart9.png)
@@ -59,15 +51,14 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port
To mint a non-fungible token object:
1. Set the **Flags** field. For testing purposes, we recommend setting the value to _8_. This sets the _tsTransferable_ flag, meaning that the NFToken object can be transferred to another account. Otherwise, the NFToken object can only be transferred back to the issuing account. See [NFToken Mint](https://xrpl.org/nftokenmint.html#:~:text=Example%20NFTokenMint%20JSON-,NFTokenMint%20Fields,-NFTokenMint%20Flags) for information about all of the available flags for minting NFTokens.
2. Enter the **Token URL**. This is a URI that points to the data or metadata associated with the NFToken object. You can use the sample URI provided if you do not have one of your own.
3. Click **Mint Token**.
3. Enter the **Transfer Fee**, a percentage of the proceeds from future sales of the NFToken that will be returned to the original creator. This is a value of 0-50000 inclusive, allowing transfer rates between 0.000% and 50.000% in increments of 0.001%. If you do not set the **Flags** field to allow the NFToken to be transferrable, set this field to 0.
4. Click **Mint Token**.
![Mint NFToken fields](img/quickstart15.png)
![Mint NFToken fields](img/quickstart10.png)
## Get Tokens
@@ -76,7 +67,7 @@ Click **Get Tokens** to get a list of NFTokens owned by the account.
![Get NFTokens](img/quickstart16.png)
![Get NFTokens](img/quickstart11.png)
@@ -93,7 +84,7 @@ To permanently destroy a NFToken:
![Burn NFTokens](img/quickstart17.png)
![Burn NFTokens](img/quickstart12.png)
@@ -112,7 +103,7 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port
// *******************************************************
// ********************** Mint Token *********************
// *******************************************************
async function mintToken() {
async function mintToken() {
```
@@ -122,15 +113,15 @@ Connect to the ledger and get the account wallets.
```
results = 'Connecting to ' + getNet() + '....'
document.getElementById('standbyResultField').value = results
let net = getNet()
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
const client = new xrpl.Client(net)
await client.connect()
results += '\nConnected. Minting NFToken.'
document.getElementById('standbyResultField').value = results
results = 'Connecting to ' + getNet() + '....'
document.getElementById('standbyResultField').value = results
let net = getNet()
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
const client = new xrpl.Client(net)
await client.connect()
results += '\nConnected. Minting NFToken.'
document.getElementById('standbyResultField').value = results
```
@@ -140,9 +131,9 @@ Define the transaction.
```
const transactionBlob = {
TransactionType: "NFTokenMint",
Account: standby_wallet.classicAddress,
const transactionBlob = {
"TransactionType": "NFTokenMint",
"Account": standby_wallet.classicAddress,
```
@@ -150,17 +141,28 @@ Note that the URI field expects a hexadecimal value rather than the literal URI
```
URI: xrpl.convertStringToHex(standbyTokenUrlField.value),
Flags: parseInt(standbyFlagsField.value),
"URI": xrpl.convertStringToHex(standbyTokenUrlField.value),
```
If you want the NFToken to be transferable to third parties, set the **Flags** field to _8_.
```
"Flags": parseInt(standbyFlagsField.value),
```
The Transfer Fee is a value 0 to 50000, used to set a royalty of 0.000% to 50.000% in increments of 0.001.
```
"TransferFee": parseInt(standbyTransferFeeField.value),
```
The TokenTaxon is a required value. It is an arbitrary value defined by the issuer. If you do not have a use for the field, you can set it to _0_.
```
TokenTaxon: 0 //Required, but if you have no use for it, set to zero.
}
"NFTokenTaxon": 0 //Required, but if you have no use for it, set to zero.
}
```
@@ -170,7 +172,7 @@ Send the transaction and wait for the response.
```
const tx = await client.submitAndWait(transactionBlob, { wallet: standby_wallet} )
const tx = await client.submitAndWait(transactionBlob, { wallet: standby_wallet} )
```
@@ -178,10 +180,10 @@ Request a list of NFTs owned by the account.
```
const nfts = await client.request({
method: "account_nfts",
account: standby_wallet.classicAddress
})
const nfts = await client.request({
method: "account_nfts",
account: standby_wallet.classicAddress
})
```
@@ -191,11 +193,11 @@ Report the results.
```
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
document.getElementById('standbyBalanceField').value =
(await client.getXrpBalance(standby_wallet.address))
document.getElementById('operationalBalanceField').value = results
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
document.getElementById('standbyBalanceField').value =
(await client.getXrpBalance(standby_wallet.address))
document.getElementById('operationalBalanceField').value = results
```
@@ -203,10 +205,8 @@ Disconnect from the ledger.
```
client.disconnect()
} //End of mintToken()
client.disconnect()
} //End of mintToken()
```
@@ -219,7 +219,7 @@ Disconnect from the ledger.
// ******************* Get Tokens ************************
// *******************************************************
async function getTokens() {
async function getTokens() {
```
@@ -227,14 +227,14 @@ Connect to the ledger and get the account wallet.
```
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '...'
document.getElementById('standbyResultField').value = results
await client.connect()
results += '\nConnected. Getting NFTokens...'
document.getElementById('standbyResultField').value = results
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + net + '...'
document.getElementById('standbyResultField').value = results
await client.connect()
results += '\nConnected. Getting NFTokens...'
document.getElementById('standbyResultField').value = results
```
@@ -242,10 +242,10 @@ Request a list of NFTs owned by the account.
```
const nfts = await client.request({
method: "account_nfts",
account: standby_wallet.classicAddress
})
const nfts = await client.request({
method: "account_nfts",
account: standby_wallet.classicAddress
})
```
@@ -253,8 +253,8 @@ Report the results.
```
results += '\nNFTs:\n ' + JSON.stringify(nfts,null,2)
document.getElementById('standbyResultField').value = results
results += '\nNFTs:\n ' + JSON.stringify(nfts,null,2)
document.getElementById('standbyResultField').value = results
```
@@ -262,8 +262,8 @@ Disconnect from the ledger.
```
client.disconnect()
} //End of getTokens()
client.disconnect()
} //End of getTokens()
```
@@ -282,16 +282,15 @@ Connect to the ledger and get the account wallets.
```
async function burnToken() {
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '...'
document.getElementById('standbyResultField').value = results
await client.connect()
results += '\nConnected. Burning NFToken...'
document.getElementById('standbyResultField').value = results
async function burnToken() {
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + net + '...'
document.getElementById('standbyResultField').value = results
await client.connect()
results += '\nConnected. Burning NFToken...'
document.getElementById('standbyResultField').value = results
```
@@ -299,11 +298,11 @@ Define the transaction.
```
const transactionBlob = {
"TransactionType": "NFTokenBurn",
"Account": standby_wallet.classicAddress,
"TokenID": standbyTokenIdField.value
}
const transactionBlob = {
"TransactionType": "NFTokenBurn",
"Account": standby_wallet.classicAddress,
"TokenID": standbyTokenIdField.value
}
```
@@ -311,7 +310,7 @@ Submit the transaction and wait for the results.
```
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
```
@@ -319,10 +318,10 @@ Request a list of NFTokens owned by the client.
```
const nfts = await client.request({
method: "account_nfts",
account: standby_wallet.classicAddress
})
const nfts = await client.request({
method: "account_nfts",
account: standby_wallet.classicAddress
})
```
@@ -330,17 +329,17 @@ Report the results.
```
results += '\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\nBalance changes: ' +
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
document.getElementById('standbyResultField').value = results
document.getElementById('standbyBalanceField').value =
(await client.getXrpBalance(standby_wallet.address))
results += '\nNFTs: \n' + JSON.stringify(nfts,null,2)
document.getElementById('standbyResultField').value = results
client.disconnect()
}
// End of burnToken()
results += '\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\nBalance changes: ' +
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
document.getElementById('standbyResultField').value = results
document.getElementById('standbyBalanceField').value =
(await client.getXrpBalance(standby_wallet.address))
results += '\nNFTs: \n' + JSON.stringify(nfts,null,2)
document.getElementById('standbyResultField').value = results
client.disconnect()
}
// End of burnToken()
```
@@ -352,57 +351,50 @@ Report the results.
// *******************************************************
// ************** Operational Mint Token *****************
// *******************************************************
async function oPmintToken() {
results = 'Connecting to ' + getNet() + '....'
document.getElementById('operationalResultField').value = results
let net = getNet()
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
const client = new xrpl.Client(net)
await client.connect()
results += '\nConnected. Minting NFToken.'
document.getElementById('operationalResultField').value = results
// Note that you must convert the token URL to a hexadecimal
// value for this transaction.
// ------------------------------------------------------------------------
const transactionBlob = {
"TransactionType": 'NFTokenMint',
"Account": operational_wallet.classicAddress,
"URI": xrpl.convertStringToHex(operationalTokenUrlField.value),
"Flags": parseInt(operationalFlagsField.value),
"TransferFee": parseInt(operationalTransferFeeField.value),
"NFTokenTaxon": 0 //Required, but if you have no use for it, set to zero.
}
// ----------------------------------------------------- Submit signed blob
const tx = await client.submitAndWait(transactionBlob, { wallet: operational_wallet} )
const nfts = await client.request({
method: "account_nfts",
account: operational_wallet.classicAddress
})
// ------------------------------------------------------- Report results
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
document.getElementById('operationalBalanceField').value =
(await client.getXrpBalance(operational_wallet.address))
document.getElementById('operationalResultField').value = results
async function oPmintToken() {
results = 'Connecting to ' + getNet() + '....'
document.getElementById('operationalResultField').value = results
let net = getNet()
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
const client = new xrpl.Client(net)
await client.connect()
results += '\nConnected. Minting NFToken.'
document.getElementById('operationalResultField').value = results
// Note that you must convert the token URL to a hexadecimal
// value for this transaction.
// ------------------------------------------------------------------------
const transactionBlob = {
TransactionType: "NFTokenMint",
Account: operational_wallet.classicAddress,
URI: xrpl.convertStringToHex(operationalTokenUrlField.value),
Flags: parseInt(operationalFlagsField.value),
TokenTaxon: 0 //Required, but if you have no use for it, set to zero.
}
// ------------------- Submit transaction and wait for results
const tx = await client.submitAndWait(transactionBlob, { wallet: operational_wallet} )
const nfts = await client.request({
method: "account_nfts",
account: operational_wallet.classicAddress
})
// ------------------------------------------------------- Report results
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
document.getElementById('operationalBalanceField').value =
(await client.getXrpBalance(operational_wallet.address))
document.getElementById('operationalResultField').value = results
client.disconnect()
} //End of oPmintToken
client.disconnect()
} //End of oPmintToken
// *******************************************************
// ************** Operational Get Tokens *****************
// *******************************************************
async function oPgetTokens() {
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
let net = getNet()
@@ -420,54 +412,47 @@ Report the results.
document.getElementById('operationalResultField').value = results
client.disconnect()
} //End of oPgetTokens
// *******************************************************
// ************* Operational Burn Token ******************
// *******************************************************
async function oPburnToken() {
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '...'
document.getElementById('operationalResultField').value = results
await client.connect()
results += '\nConnected. Burning NFToken...'
document.getElementById('operationalResultField').value = results
// ------------------------------------------------------- Prepare transaction
const transactionBlob = {
"TransactionType": "NFTokenBurn",
"Account": operational_wallet.classicAddress,
"TokenID": operationalTokenIdField.value
}
//-------------------------------------------------------- Submit signed blob
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
const nfts = await client.request({
method: "account_nfts",
account: operational_wallet.classicAddress
})
results += '\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\nBalance changes: ' +
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
document.getElementById('operationalResultField').value = results
document.getElementById('operationalBalanceField').value =
(await client.getXrpBalance(operational_wallet.address))
results += '\nNFTs: \n' + JSON.stringify(nfts,null,2)
document.getElementById('operationalResultField').value = results
client.disconnect()
}
// End of oPburnToken()
</script>
</head>
async function oPburnToken() {
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
let net = getNet()
const client = new xrpl.Client(net)
results = 'Connecting to ' + getNet() + '...'
document.getElementById('operationalResultField').value = results
await client.connect()
results += '\nConnected. Burning NFToken...'
document.getElementById('operationalResultField').value = results
// ------------------------------------------------------- Prepare transaction
const transactionBlob = {
"TransactionType": "NFTokenBurn",
"Account": operational_wallet.classicAddress,
"NFTokenID": operationalTokenIdField.value
}
//-------------------------------------------------------- Submit signed blob
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
const nfts = await client.request({
method: "account_nfts",
account: operational_wallet.classicAddress
})
results += '\nTransaction result: '+ tx.result.meta.TransactionResult
results += '\nBalance changes: ' +
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
document.getElementById('operationalResultField').value = results
document.getElementById('operationalBalanceField').value =
(await client.getXrpBalance(operational_wallet.address))
document.getElementById('operationalBalanceField').value =
(await client.getXrpBalance(operational_wallet.address))
results += '\nNFTs: \n' + JSON.stringify(nfts,null,2)
document.getElementById('operationalResultField').value = results
client.disconnect()
}
// End of oPburnToken()
```
@@ -481,7 +466,7 @@ Bold text in the following indicates changes to the form that support the new fu
<html>
<head>
<title>Token Test Harness</title>
<script src='https://unpkg.com/xrpl@2.1.1'></script>
<script src='https://unpkg.com/xrpl@2.2.3'></script>
<script src='ripplex1-send-xrp.js'></script>
<script src='ripplex2-send-currency.js'></script>
<script src='ripplex3-mint-nfts.js'></script>
@@ -491,8 +476,7 @@ Bold text in the following indicates changes to the form that support the new fu
}
</script>
</head>
<!-- ************************************************************** -->
<!-- ********************** The Form ****************************** -->
<!-- ************************************************************** -->
@@ -580,6 +564,15 @@ Bold text in the following indicates changes to the form that support the new fu
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="standbyDestinationField" size="40"></input>
<br>
</td>
</tr>
<tr valign="top">
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
<td>
@@ -596,7 +589,7 @@ Bold text in the following indicates changes to the form that support the new fu
</td>
</tr>
<tr>
<td align="right">Token URL</td>
<td align="right">NFToken URL</td>
<td><input type="text" id="standbyTokenUrlField"
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
</td>
@@ -606,9 +599,13 @@ Bold text in the following indicates changes to the form that support the new fu
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
</tr>
<tr>
<td align="right">Token ID</td>
<td align="right">NFToken ID</td>
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
</tr>
<tr>
<td align="right">Transfer Fee</td>
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
</tr>
</table>
<p align="left">
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
@@ -719,11 +716,19 @@ Bold text in the following indicates changes to the form that support the new fu
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="operationalDestinationField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
<input type="checkbox" id="operationalDefault" checked="true"/>
<td align="right"> <input type="checkbox" id="operationalDefault" checked="true"/>
<label for="operationalDefault">Allow Rippling</label>
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
</td>
@@ -737,7 +742,7 @@ Bold text in the following indicates changes to the form that support the new fu
</td>
</tr>
<tr>
<td align="right">Token URL</td>
<td align="right">NFToken URL</td>
<td><input type="text" id="operationalTokenUrlField"
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
</td>
@@ -747,10 +752,14 @@ Bold text in the following indicates changes to the form that support the new fu
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
</tr>
<tr>
<td align="right">Token ID</td>
<td align="right">NFToken ID</td>
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
</tr>
</table>
<tr>
<td align="right">Transfer Fee</td>
<td><input type="text" id="operationalTransferFeeField" value="" size="80"/></td>
</tr>
</table>
<p align="right">
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
</p>
@@ -776,7 +785,7 @@ Bold text in the following indicates changes to the form that support the new fu
| Previous | Next |
| :--- | ---: |
| [← 2. Create TrustLine and Send Currency >](create-trustline-send-currency.html) | [4. Transfer NFTokens → >](transfer-nftokens.html) |
| [← 2. Create Trust Line and Send Currency >](create-trustline-send-currency.html) | [4. Transfer NFTokens → >](transfer-nftokens.html) |
<!--{# common link defs #}-->
{% include '_snippets/rippled-api-links.md' %}

File diff suppressed because it is too large Load Diff

View File

@@ -37,10 +37,12 @@ Much of this is “brute force” code that sacrifices conciseness for readabili
In this quickstart, you can:
1. [Create Accounts and Send XRP](create-accounts-send-xrp.html)
2. [Create TrustLine and Send Currency](create-trustline-send-currency.html).
2. [Create Trust Line and Send Currency](create-trustline-send-currency.html).
3. [Mint and Burn NFTokens](mint-and-burn-nftokens.html).
4. [Transfer NFTokens](transfer-nftokens.html).
There is also an expanded lesson demonstrating how to [Broker a NFToken Sale](broker-sale.html).
## Prerequisites

View File

@@ -1106,6 +1106,11 @@ pages:
- en
- ja
- md: tutorials/quickstart/broker-sale.md
targets:
- en
- ja
- md: tutorials/get-started/get-started.md
targets:
- en

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 KiB

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 KiB

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

After

Width:  |  Height:  |  Size: 189 KiB

BIN
img/quickstart21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
img/quickstart22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

BIN
img/quickstart23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
img/quickstart24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
img/quickstart25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
img/quickstart26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
img/quickstart27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

After

Width:  |  Height:  |  Size: 172 KiB