Move send mpts to tutorials, redo screenshots, revise code samples
@@ -20,6 +20,12 @@ button {
 | 
			
		||||
  border: none
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input:read-only {
 | 
			
		||||
  background-color:rgb(11, 96, 132);
 | 
			
		||||
  color:white;
 | 
			
		||||
  border: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button {
 | 
			
		||||
  font-weight: bold;
 | 
			
		||||
  font-family: "Work Sans", sans-serif;
 | 
			
		||||
@@ -27,6 +33,11 @@ button {
 | 
			
		||||
  -webkit-text-fill-color: white;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button:hover {
 | 
			
		||||
  background-color: #0555c5;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
td {
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
@@ -35,8 +46,8 @@ td {
 | 
			
		||||
.switch {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 60px;
 | 
			
		||||
  height: 34px;
 | 
			
		||||
  width: 30px;
 | 
			
		||||
  height: 16px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Hide default HTML checkbox */
 | 
			
		||||
@@ -62,10 +73,10 @@ td {
 | 
			
		||||
.slider:before {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  content: "";
 | 
			
		||||
  height: 26px;
 | 
			
		||||
  width: 26px;
 | 
			
		||||
  height: 13px;
 | 
			
		||||
  width: 13px;
 | 
			
		||||
  left: 4px;
 | 
			
		||||
  bottom: 4px;
 | 
			
		||||
  bottom: 2px;
 | 
			
		||||
  background-color: white;
 | 
			
		||||
  -webkit-transition: .4s;
 | 
			
		||||
  transition: .4s;
 | 
			
		||||
@@ -80,14 +91,14 @@ input:focus+.slider {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input:checked+.slider:before {
 | 
			
		||||
  -webkit-transform: translateX(26px);
 | 
			
		||||
  -ms-transform: translateX(26px);
 | 
			
		||||
  transform: translateX(26px);
 | 
			
		||||
  -webkit-transform: translateX(13px);
 | 
			
		||||
  -ms-transform: translateX(13px);
 | 
			
		||||
  transform: translateX(13px);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Rounded sliders */
 | 
			
		||||
.slider.round {
 | 
			
		||||
  border-radius: 34px;
 | 
			
		||||
  border-radius: 17px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.slider.round:before {
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
<head>
 | 
			
		||||
    <title>MPT Generator</title>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <link href="mpt-generator.css" rel="stylesheet">
 | 
			
		||||
    <link href="modular-tutorials.css" rel="stylesheet">
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script> 
 | 
			
		||||
 | 
			
		||||
    <script src='mpt-generator.js'></script>
 | 
			
		||||
@@ -31,14 +31,23 @@
 | 
			
		||||
                                                Choose your ledger instance:
 | 
			
		||||
                                            </span>
 | 
			
		||||
                                              
 | 
			
		||||
                                            <input type="radio" id="dn" name="server"
 | 
			
		||||
                                                value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
                                            <label for="devnet">Devnet</label>
 | 
			
		||||
                                              
 | 
			
		||||
                                            <input type="radio" id="tn" name="server"
 | 
			
		||||
                                                value="wss://s.altnet.rippletest.net:51233" >
 | 
			
		||||
                                            <label for="testnet">Testnet</label>
 | 
			
		||||
                                              
 | 
			
		||||
                                            <input type="radio" id="dn" name="server"
 | 
			
		||||
                                                value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
                                            <label for="devnet">Devnet</label><br />
 | 
			
		||||
 | 
			
		||||
                                        </td>
 | 
			
		||||
                                    </tr>
 | 
			
		||||
                                    <tr>
 | 
			
		||||
                                        <td align="right">
 | 
			
		||||
                                            <span class="tooltip" tooltip-data="Arbitrary human-readable name for the account.">
 | 
			
		||||
                                                <label for="accountNameField">Account Name</label>
 | 
			
		||||
                                            </span>
 | 
			
		||||
                                        </td>
 | 
			
		||||
                                        <td>
 | 
			
		||||
                                            <input type="text" id="accountNameField" size="40"></input>
 | 
			
		||||
                                        </td>
 | 
			
		||||
                                    </tr>
 | 
			
		||||
                                    <tr>
 | 
			
		||||
@@ -204,12 +213,16 @@
 | 
			
		||||
                <td>
 | 
			
		||||
                    <h2>MPToken Create Transaction</h2>
 | 
			
		||||
                    <p><button type="button" onclick="generateCode()">Generate Transaction</button>
 | 
			
		||||
                      <button type = "button" onclick="sendTransaction()">Send Transaction</button></p>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Follow this link to see the MPT Issuance entry on the Explorer.">
 | 
			
		||||
                        Link to Explorer entry for MPT Issuance.
 | 
			
		||||
                      
 | 
			
		||||
                    <button type = "button" onclick="sendTransaction()">Send Transaction</button>
 | 
			
		||||
                      
 | 
			
		||||
                    <button type = "button" onclick="gatherMptInfo()">Gather MPT Information</button>
 | 
			
		||||
                    </p>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="The MPT Issuance ID of your generated MPT.">
 | 
			
		||||
                        MPT Issuance ID
 | 
			
		||||
                    </span>
 | 
			
		||||
                    <p><input type="text" id="urlField" size="50"></p>
 | 
			
		||||
                    <textarea id="codeTextArea" rows="25" cols="75"></textarea>
 | 
			
		||||
                    <p><input type="text" id="mptIssuanceIdField" size="50"></p>
 | 
			
		||||
                    <textarea id="resultField" rows="25" cols="75"></textarea>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </table>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,76 +1,69 @@
 | 
			
		||||
function generateCode() {
 | 
			
		||||
    let v_flags = 0
 | 
			
		||||
    if (clawbackSlider.checked) {v_flags+=64}
 | 
			
		||||
    if (lockSlider.checked) {v_flags+=2}
 | 
			
		||||
    if (authTokensSlider.checked) {v_flags +=4}
 | 
			
		||||
    if (txrSlider.checked) {v_flags += 32}
 | 
			
		||||
    if (tradeSlider.checked) {v_flags += 16}
 | 
			
		||||
    if (escrowSlider.checked) {v_flags+=8}
 | 
			
		||||
    const mptHexString = xrpl.convertStringToHex(metadataTextArea.value)
 | 
			
		||||
    let v_codeBlock = "{\n  \"TransactionType\": \"MPTokenIssuanceCreate\",\n  \"Account\": \"" + accountField.value +
 | 
			
		||||
    "\",\n  \"AssetScale\": " + parseInt(assetScaleField.value) + ", \n  \"MaximumAmount\": \"" + maximumAmountField.value +
 | 
			
		||||
    "\",\n  \"TransferFee\": " + transferFeeField.value +
 | 
			
		||||
    ",\n  \"Flags\": " + v_flags + ",\n  \"MPTokenMetadata\": \"" + mptHexString +  "\"\n}"
 | 
			
		||||
 | 
			
		||||
    codeTextArea.value = v_codeBlock
 | 
			
		||||
}
 | 
			
		||||
  let v_flags = 0
 | 
			
		||||
  if (clawbackSlider.checked) {v_flags+=64}
 | 
			
		||||
  if (lockSlider.checked) {v_flags+=2}
 | 
			
		||||
  if (authTokensSlider.checked) {v_flags +=4}
 | 
			
		||||
  if (txrSlider.checked) {v_flags += 32}
 | 
			
		||||
  if (tradeSlider.checked) {v_flags += 16}
 | 
			
		||||
  if (escrowSlider.checked) {v_flags+=8}
 | 
			
		||||
  const mptHexString = xrpl.convertStringToHex(metadataTextArea.value)
 | 
			
		||||
  let v_codeBlock = "{\n  \"TransactionType\": \"MPTokenIssuanceCreate\",\n  \"Account\": \"" + accountField.value +
 | 
			
		||||
  "\",\n  \"AssetScale\": " + parseInt(assetScaleField.value) + ", \n  \"MaximumAmount\": \"" + maximumAmountField.value +
 | 
			
		||||
  "\",\n  \"TransferFee\": " + transferFeeField.value +
 | 
			
		||||
  ",\n  \"Flags\": " + v_flags + ",\n  \"MPTokenMetadata\": \"" + mptHexString +  "\"\n}"
 | 
			
		||||
  resultField.value = v_codeBlock
 | 
			
		||||
} //End of generateCode()
 | 
			
		||||
// ******************************************************
 | 
			
		||||
// ************* Get the Preferred Network **************
 | 
			
		||||
// ******************************************************   
 | 
			
		||||
 | 
			
		||||
function getNet() {
 | 
			
		||||
    let net
 | 
			
		||||
    if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
 | 
			
		||||
    if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
 | 
			
		||||
    return net
 | 
			
		||||
  } // End of getNet()
 | 
			
		||||
  let net
 | 
			
		||||
  if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
 | 
			
		||||
  if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
 | 
			
		||||
  return net
 | 
			
		||||
} // End of getNet()
 | 
			
		||||
                
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // ************* Get Account *****************************
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  
 | 
			
		||||
  async function getAccount() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    results = 'Connecting to ' + net + '....'
 | 
			
		||||
  
 | 
			
		||||
  //-------------------------------This uses the default faucet for Testnet/Devnet.
 | 
			
		||||
    let faucetHost = null
 | 
			
		||||
    codeTextArea.value = results
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, funding wallet.'
 | 
			
		||||
  // ----------------------------------------Create and fund a test account wallet.
 | 
			
		||||
    const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
 | 
			
		||||
    results += '\nGot a wallet.'
 | 
			
		||||
  
 | 
			
		||||
  // ------------------------------------------------------Get the current balance.
 | 
			
		||||
    const my_balance = (await client.getXrpBalance(my_wallet.address))  
 | 
			
		||||
    accountField.value = my_wallet.address
 | 
			
		||||
    seedField.value = my_wallet.seed
 | 
			
		||||
    results += '\nAccount created.'
 | 
			
		||||
    codeTextArea.value = results
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getAccount()
 | 
			
		||||
        
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // ************ Get Account from Seed ******************** 
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  
 | 
			
		||||
  async function getAccountFromSeed() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, finding wallets.\n'
 | 
			
		||||
    codeTextArea.value = results
 | 
			
		||||
  // --------------------------------------------------Find the test account wallet.    
 | 
			
		||||
    const my_wallet = xrpl.Wallet.fromSeed(seedField.value)
 | 
			
		||||
        
 | 
			
		||||
  // -------------------------------------------------------Get the current balance.
 | 
			
		||||
    accountField.value = my_wallet.address
 | 
			
		||||
    seedField.value = my_wallet.seed      
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getAccountFromSeed()
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ************* Get Account *****************************
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function getAccount() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  accountField.value = "Getting new account...."
 | 
			
		||||
  let faucetHost = null
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = '\nConnected, funding wallet.'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
// ----------------------------------------Create and fund a test account wallet.
 | 
			
		||||
  const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
 | 
			
		||||
  results += '\nGot a wallet.'
 | 
			
		||||
// ------------------------------------------------------Get the current balance.
 | 
			
		||||
  const my_balance = (await client.getXrpBalance(my_wallet.address))  
 | 
			
		||||
  accountField.value = my_wallet.address
 | 
			
		||||
  seedField.value = my_wallet.seed
 | 
			
		||||
  results += '\nAccount created.'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getAccount()
 | 
			
		||||
      
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ************ Get Account from Seed ******************** 
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function getAccountFromSeed() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results += '\nConnected, finding wallets.\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
// --------------------------------------------------Find the account wallet.    
 | 
			
		||||
  const my_wallet = xrpl.Wallet.fromSeed(seedField.value)
 | 
			
		||||
  accountField.value = my_wallet.address
 | 
			
		||||
  seedField.value = my_wallet.seed      
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getAccountFromSeed()
 | 
			
		||||
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // *************** Send Transaction **********************
 | 
			
		||||
@@ -85,28 +78,34 @@ async function sendTransaction() {
 | 
			
		||||
  if (tradeSlider.checked) {v_flags += 16}
 | 
			
		||||
  if (escrowSlider.checked) {v_flags+=8}
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  console.log(results)
 | 
			
		||||
  mptIssuanceIdField.value = results
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const my_wallet = xrpl.Wallet.fromSeed(seedField.value)
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
 | 
			
		||||
const metadataHexString = xrpl.convertStringToHex(metadataTextArea.value)
 | 
			
		||||
 | 
			
		||||
const transactionJson = {
 | 
			
		||||
  "TransactionType": "MPTokenIssuanceCreate",
 | 
			
		||||
  "Account": accountField.value,
 | 
			
		||||
  "AssetScale": parseInt(assetScaleField.value),
 | 
			
		||||
  "MaximumAmount": maximumAmountField.value,
 | 
			
		||||
  "TransferFee": parseInt(transferFeeField.value),
 | 
			
		||||
  "Flags": v_flags,
 | 
			
		||||
  "MPTokenMetadata": metadataHexString
 | 
			
		||||
}
 | 
			
		||||
  const metadataHexString = xrpl.convertStringToHex(metadataTextArea.value)
 | 
			
		||||
  const transactionJson = {
 | 
			
		||||
    "TransactionType": "MPTokenIssuanceCreate",
 | 
			
		||||
    "Account": accountField.value,
 | 
			
		||||
    "AssetScale": parseInt(assetScaleField.value),
 | 
			
		||||
    "MaximumAmount": maximumAmountField.value,
 | 
			
		||||
    "TransferFee": parseInt(transferFeeField.value),
 | 
			
		||||
    "Flags": v_flags,
 | 
			
		||||
    "MPTokenMetadata": metadataHexString
 | 
			
		||||
  }
 | 
			
		||||
  const tx = await client.submitAndWait(transactionJson, { wallet: my_wallet} )
 | 
			
		||||
  if (document.getElementById("tn").checked) {
 | 
			
		||||
    codeTextArea.value += "\n Success! Ledger Index: " + tx.result.ledger_index + "\nSee https://testnet.xrpl.org/ledgers/" + tx.result.ledger_index
 | 
			
		||||
    resultField.value += "\n Success! Ledger Index: " + tx.result.ledger_index + "\nSee https://testnet.xrpl.org/ledgers/" + tx.result.ledger_index
 | 
			
		||||
  } else {
 | 
			
		||||
    codeTextArea.value += "\n Success! Ledger Index: " + tx.result.ledger_index + "\nSee https://devnet.xrpl.org/ledgers/" + tx.result.ledger_index
 | 
			
		||||
    resultField.value += "\n Success! Ledger Index: " + tx.result.ledger_index + "\nSee https://devnet.xrpl.org/ledgers/" + tx.result.ledger_index
 | 
			
		||||
  }
 | 
			
		||||
  urlField.value = "https://devnet.xrpl.org/ledgers/" + tx.result.ledger_index
 | 
			
		||||
  mptIssuanceIdField.value = JSON.stringify(tx.result.meta.mpt_issuance_id)
 | 
			
		||||
}
 | 
			
		||||
// *****************************************************
 | 
			
		||||
// ************ Gather MPT Info ********************
 | 
			
		||||
// *****************************************************
 | 
			
		||||
 | 
			
		||||
function gatherMptInfo() {
 | 
			
		||||
  let mptInfo = accountNameField.value + "\n" + accountField.value + "\n" + seedField.value + "\n" + mptIssuanceIdField.value
 | 
			
		||||
  resultField.value = mptInfo
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										101
									
								
								_code-samples/mpt-sender/account-support.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,101 @@
 | 
			
		||||
// ******************************************************
 | 
			
		||||
// ************* Get the Preferred Network **************
 | 
			
		||||
// ******************************************************  
 | 
			
		||||
 | 
			
		||||
function getNet() {
 | 
			
		||||
  let net
 | 
			
		||||
  if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233/"
 | 
			
		||||
  if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233/"
 | 
			
		||||
  return net
 | 
			
		||||
} // End of getNet()
 | 
			
		||||
              
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ************* Get Account *****************************
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function getAccount() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let faucetHost = null
 | 
			
		||||
  const my_wallet = (await client.fundWallet(null, { faucetHost})).wallet
 | 
			
		||||
  const newAccount = [my_wallet.address, my_wallet.seed]
 | 
			
		||||
  return (newAccount)
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getAccount()
 | 
			
		||||
 | 
			
		||||
async function getNewAccount1() {
 | 
			
		||||
  account1address.value = "Getting new account."
 | 
			
		||||
  const accountInfo= await getAccount()
 | 
			
		||||
  account1address.value = accountInfo[0]
 | 
			
		||||
  account1seed.value = accountInfo[1]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getNewAccount2() {
 | 
			
		||||
  account2address.value = "Getting new account."
 | 
			
		||||
  const accountInfo= await getAccount()
 | 
			
		||||
  account2address.value = accountInfo[0]
 | 
			
		||||
  account2seed.value = accountInfo[1]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// *****************************************************
 | 
			
		||||
// ********** Get Account from Seed ******************** 
 | 
			
		||||
// *****************************************************
 | 
			
		||||
 | 
			
		||||
async function getAccountFromSeed(my_seed) {
 | 
			
		||||
  const net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = '\nConnected, finding wallet.\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(my_seed)
 | 
			
		||||
// ----------------------Populate the fields for left and right accounts.
 | 
			
		||||
  const address = wallet.address
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  return (address)
 | 
			
		||||
} // End of getAccountFromSeed()
 | 
			
		||||
 | 
			
		||||
async function getAccountFromSeed1() {
 | 
			
		||||
  account1address.value = await getAccountFromSeed(account1seed.value)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getAccountFromSeed2() {
 | 
			
		||||
  account2address.value = await getAccountFromSeed(account2seed.value)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function gatherAccountInfo() {
 | 
			
		||||
  let accountData = account1name.value + "\n" + account1address.value + "\n" + account1seed.value + "\n"
 | 
			
		||||
  accountData += account2name.value + "\n" + account2address.value + "\n" + account2seed.value
 | 
			
		||||
  resultField.value = accountData
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function distributeAccountInfo() {
 | 
			
		||||
  let accountInfo = resultField.value.split("\n")
 | 
			
		||||
  account1name.value = accountInfo[0]
 | 
			
		||||
  account1address.value = accountInfo[1]
 | 
			
		||||
  account1seed.value = accountInfo[2]
 | 
			
		||||
  account2name.value = accountInfo[3]
 | 
			
		||||
  account2address.value = accountInfo[4]
 | 
			
		||||
  account2seed.value = accountInfo[5]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getBalance() {
 | 
			
		||||
  const net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  xrpBalanceField.value = await client.getXrpBalance(accountAddressField.value)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function populate1() {
 | 
			
		||||
  accountNameField.value = account1name.value
 | 
			
		||||
  accountAddressField.value = account1address.value
 | 
			
		||||
  accountSeedField.value = account1seed.value
 | 
			
		||||
  getBalance()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function populate2() {
 | 
			
		||||
  accountNameField.value = account2name.value
 | 
			
		||||
  accountAddressField.value = account2address.value
 | 
			
		||||
  accountSeedField.value = account2seed.value
 | 
			
		||||
  getBalance()
 | 
			
		||||
}
 | 
			
		||||
@@ -1,103 +0,0 @@
 | 
			
		||||
// ******************************************************
 | 
			
		||||
// ************* Get the Preferred Network **************
 | 
			
		||||
// ******************************************************   
 | 
			
		||||
 | 
			
		||||
function getNet() {
 | 
			
		||||
  let net
 | 
			
		||||
  if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
 | 
			
		||||
  if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
 | 
			
		||||
  return net
 | 
			
		||||
} // End of getNet()
 | 
			
		||||
              
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ************* Get Account *****************************
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function getAccount(type) {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
      
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + net + '....'
 | 
			
		||||
        
 | 
			
		||||
// This uses the default faucet for Testnet/Devnet
 | 
			
		||||
  let faucetHost = null
 | 
			
		||||
 | 
			
		||||
  if (type == 'left') {
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  await client.connect()
 | 
			
		||||
        
 | 
			
		||||
  results += '\nConnected, funding wallet.'
 | 
			
		||||
  if (type == 'left') {
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
// -----------------------------------Create and fund a test account wallet
 | 
			
		||||
  const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
 | 
			
		||||
        
 | 
			
		||||
  results += '\nGot a wallet.'
 | 
			
		||||
  if (type == 'left') {
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  }       
 | 
			
		||||
      
 | 
			
		||||
// ------------------------------------------------------Get the current balance.
 | 
			
		||||
  const my_balance = (await client.getXrpBalance(my_wallet.address))  
 | 
			
		||||
        
 | 
			
		||||
  if (type == 'left') {
 | 
			
		||||
    leftAccountField.value = my_wallet.address
 | 
			
		||||
    leftBalanceField.value = (await client.getXrpBalance(my_wallet.address))
 | 
			
		||||
    leftSeedField.value = my_wallet.seed
 | 
			
		||||
    results += '\nStandby account created.'
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    rightAccountField.value = my_wallet.address
 | 
			
		||||
    rightSeedField.value = my_wallet.seed
 | 
			
		||||
    rightBalanceField.value = (await client.getXrpBalance(my_wallet.address))
 | 
			
		||||
    results += '\nOperational account created.'
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
// --------------- Capture the seeds for both accounts for ease of reload.
 | 
			
		||||
  seeds.value = leftSeedField.value + '\n' + rightSeedField.value
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getAccount()
 | 
			
		||||
      
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ********** Get Accounts from Seeds ******************** 
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function getAccountsFromSeeds() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results += '\nConnected, finding wallets.\n'
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
      
 | 
			
		||||
// -------------------------------------------------Find the test account wallets.    
 | 
			
		||||
  var lines = seeds.value.split('\n')
 | 
			
		||||
  const left_wallet = xrpl.Wallet.fromSeed(lines[0])
 | 
			
		||||
  const right_wallet = xrpl.Wallet.fromSeed(lines[1])
 | 
			
		||||
      
 | 
			
		||||
// -------------------------------------------------------Get the current balance.
 | 
			
		||||
  const left_balance = (await client.getXrpBalance(left_wallet.address))  
 | 
			
		||||
  const right_balance = (await client.getXrpBalance(right_wallet.address))  
 | 
			
		||||
        
 | 
			
		||||
// ----------------------Populate the fields for Standby and Operational accounts.
 | 
			
		||||
  leftAccountField.value = left_wallet.address
 | 
			
		||||
  leftSeedField.value = left_wallet.seed
 | 
			
		||||
  leftBalanceField.value = (await client.getXrpBalance(left_wallet.address))
 | 
			
		||||
      
 | 
			
		||||
  rightAccountField.value = right_wallet.address
 | 
			
		||||
  rightSeedField.value = right_wallet.seed
 | 
			
		||||
  rightBalanceField.value = (await client.getXrpBalance(right_wallet.address))
 | 
			
		||||
      
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
            
 | 
			
		||||
} // End of getAccountsFromSeeds()
 | 
			
		||||
@@ -20,6 +20,12 @@ button {
 | 
			
		||||
  border: none
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input:read-only {
 | 
			
		||||
  background-color:rgb(11, 96, 132);
 | 
			
		||||
  color:white;
 | 
			
		||||
  border: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button {
 | 
			
		||||
  font-weight: bold;
 | 
			
		||||
  font-family: "Work Sans", sans-serif;
 | 
			
		||||
@@ -27,6 +33,11 @@ button {
 | 
			
		||||
  -webkit-text-fill-color: white;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button:hover {
 | 
			
		||||
  background-color: #0555c5;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
td {
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
@@ -35,8 +46,8 @@ td {
 | 
			
		||||
.switch {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  width: 60px;
 | 
			
		||||
  height: 34px;
 | 
			
		||||
  width: 30px;
 | 
			
		||||
  height: 16px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Hide default HTML checkbox */
 | 
			
		||||
@@ -62,10 +73,10 @@ td {
 | 
			
		||||
.slider:before {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  content: "";
 | 
			
		||||
  height: 26px;
 | 
			
		||||
  width: 26px;
 | 
			
		||||
  height: 13px;
 | 
			
		||||
  width: 13px;
 | 
			
		||||
  left: 4px;
 | 
			
		||||
  bottom: 4px;
 | 
			
		||||
  bottom: 2px;
 | 
			
		||||
  background-color: white;
 | 
			
		||||
  -webkit-transition: .4s;
 | 
			
		||||
  transition: .4s;
 | 
			
		||||
@@ -80,14 +91,14 @@ input:focus+.slider {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input:checked+.slider:before {
 | 
			
		||||
  -webkit-transform: translateX(26px);
 | 
			
		||||
  -ms-transform: translateX(26px);
 | 
			
		||||
  transform: translateX(26px);
 | 
			
		||||
  -webkit-transform: translateX(13px);
 | 
			
		||||
  -ms-transform: translateX(13px);
 | 
			
		||||
  transform: translateX(13px);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Rounded sliders */
 | 
			
		||||
.slider.round {
 | 
			
		||||
  border-radius: 34px;
 | 
			
		||||
  border-radius: 17px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.slider.round:before {
 | 
			
		||||
@@ -1,211 +1,218 @@
 | 
			
		||||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>Send MPT Test Harness</title>
 | 
			
		||||
<head>
 | 
			
		||||
    <title>Send MPT</title>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <link href="mpt-generator.css" rel="stylesheet"> 
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script> 
 | 
			
		||||
    <script src='get-accounts.js'></script>
 | 
			
		||||
    <link href="modular-tutorials.css" rel="stylesheet">
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script>
 | 
			
		||||
    <script src="account-support.js"></script>
 | 
			
		||||
    <script src='send-mpt.js'></script>
 | 
			
		||||
    <script>
 | 
			
		||||
      if (typeof module !== "undefined") {
 | 
			
		||||
        const xrpl = require('xrpl')
 | 
			
		||||
      }
 | 
			
		||||
        if (typeof module !== "undefined") {
 | 
			
		||||
            const xrpl = require('xrpl')
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
  </head>
 | 
			
		||||
  
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<!-- ************************************************************** -->
 | 
			
		||||
<!-- ********************** The Form ****************************** -->
 | 
			
		||||
<!-- ************************************************************** -->
 | 
			
		||||
 | 
			
		||||
  <body>
 | 
			
		||||
    <h1>Send MPTs</h1>
 | 
			
		||||
<body>
 | 
			
		||||
    <h1>Send MPT</h1>
 | 
			
		||||
    <form id="theForm">
 | 
			
		||||
      Choose your ledger instance:  
 | 
			
		||||
        
 | 
			
		||||
      <input type="radio" id="tn" name="server"
 | 
			
		||||
        value="wss://s.altnet.rippletest.net:51233" >
 | 
			
		||||
      <label for="testnet">Testnet</label>
 | 
			
		||||
        
 | 
			
		||||
      <input type="radio" id="dn" name="server"
 | 
			
		||||
        value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
      <label for="devnet">Devnet</label>
 | 
			
		||||
      <br/><br/>
 | 
			
		||||
      <button type="button" onClick="getAccountsFromSeeds()">Get Accounts From Seeds</button>
 | 
			
		||||
      <br/>
 | 
			
		||||
      <textarea id="seeds" cols="40" rows= "2"></textarea>
 | 
			
		||||
      <br/><br/>
 | 
			
		||||
      <table>
 | 
			
		||||
        <tr valign="top">
 | 
			
		||||
          <td>
 | 
			
		||||
            <table>
 | 
			
		||||
              <tr valign="top">
 | 
			
		||||
        <span class="tooltip" tooltip-data="Choose the XRPL host server for your account.">
 | 
			
		||||
            Choose your ledger instance:
 | 
			
		||||
        </span>
 | 
			
		||||
          
 | 
			
		||||
        <input type="radio" id="dn" name="server" value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
        <label for="dn">Devnet</label>
 | 
			
		||||
          
 | 
			
		||||
        <input type="radio" id="tn" name="server" value="wss://s.altnet.rippletest.net:51233">
 | 
			
		||||
        <label for="tn">Testnet</label>
 | 
			
		||||
        <br /><br />
 | 
			
		||||
        <table>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                <td>
 | 
			
		||||
                  <button type="button" onClick="getAccount('left')">Get New Left Account</button>
 | 
			
		||||
                  <table>
 | 
			
		||||
                    <tr valign="top">
 | 
			
		||||
                      <td align="right">
 | 
			
		||||
                        Left Account
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td>
 | 
			
		||||
                        <input type="text" id="leftAccountField" size="40"></input>
 | 
			
		||||
                        <br>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                      <td align="right">
 | 
			
		||||
                        Seed
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td>
 | 
			
		||||
                        <input type="text" id="leftSeedField" size="40"></input>
 | 
			
		||||
                        <br>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                      <td align="right">
 | 
			
		||||
                        XRP Balance
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td>
 | 
			
		||||
                        <input type="text" id="leftBalanceField" size="40"></input>
 | 
			
		||||
                        <br>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                      <td align="right">
 | 
			
		||||
                        Quantity
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td>
 | 
			
		||||
                        <input type="text" id="leftQuantityField" size="40"></input>
 | 
			
		||||
                        <br>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                      <td align="right">
 | 
			
		||||
                        Destination
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td>
 | 
			
		||||
                        <input type="text" id="leftDestinationField" size="40"></input>
 | 
			
		||||
                        <br>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                      <td align="right">
 | 
			
		||||
                        MPT Issuance ID
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td>
 | 
			
		||||
                        <input type="text" id="leftIssuanceIdField" size="40"></input>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                  </table>
 | 
			
		||||
                  <p align="left">
 | 
			
		||||
                    <textarea id="leftResultField" cols="80" rows="20" ></textarea>
 | 
			
		||||
                  </p>
 | 
			
		||||
                </td>
 | 
			
		||||
                    <button type="button" onClick="getNewAccount1()">Get New Account 1</button>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                  <table>
 | 
			
		||||
                    <tr valign="top">
 | 
			
		||||
                      <td align="center" valign="top">
 | 
			
		||||
                        <button type="button" onClick="MPTAuthorize()">Authorize MPTs</button>
 | 
			
		||||
                         <br/>
 | 
			
		||||
                         <button type="button" onClick="sendMPT()">Send MPT</button>
 | 
			
		||||
                        <br/>
 | 
			
		||||
                         <button type="button" onClick="getMPTs()">Get MPTs</button>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                  </table>
 | 
			
		||||
                    <button type="button" onClick="getAccountFromSeed1()">Get Account 1 From Seed</button>
 | 
			
		||||
                </td>
 | 
			
		||||
              </tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="getNewAccount2()">Get New Account 2</button>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="getAccountFromSeed2()">Get Account 2 From Seed</button>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                        <span class="tooltip" tooltip-data="Arbitrary human-readable name for the account."><label for="account1name">Account 1 Name</label>
 | 
			
		||||
                        </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account1name" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Arbitrary human-readable name for the account.">
 | 
			
		||||
                        <label for="account2name">Account 2 Name</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account2name" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Identifying address for the account.">
 | 
			
		||||
                        <label for="account1address">Account 1 Address</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td> 
 | 
			
		||||
                    <input type="text" id="account1address" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Identifying address for the account.">
 | 
			
		||||
                        <label for="account2address">Account 2 Address</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account2address" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Seed for deriving public and private keys for the account.">
 | 
			
		||||
                        <label for="account1seed">Account 1 Seed</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account1seed" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Seed for deriving public and private keys for the account.">
 | 
			
		||||
                        <label for="account2seed">Account 2 Seed</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account2seed" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            </table>
 | 
			
		||||
          </td>
 | 
			
		||||
          <td>
 | 
			
		||||
            <hr />
 | 
			
		||||
            <table>
 | 
			
		||||
              <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                <td>
 | 
			
		||||
                  <table>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                      <td align="center" valign="top">
 | 
			
		||||
                        <button type="button" onClick="rightMPTAuthorize()">Authorize MPTs</button>
 | 
			
		||||
                         <br/>
 | 
			
		||||
                        <button type="button" onClick="rightSendMPT()">Send MPT</button>
 | 
			
		||||
                        <br/>
 | 
			
		||||
                        <button type="button" onClick="rightGetMPTs()">Get MPTs</button>
 | 
			
		||||
                      </td>
 | 
			
		||||
                      <td valign="top" align="right">
 | 
			
		||||
                        <button type="button" onClick="getAccount('right')">Get New Right Account</button>
 | 
			
		||||
                        <table>
 | 
			
		||||
                          <tr valign="top">
 | 
			
		||||
                            <td align="right">
 | 
			
		||||
                              Right Account
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                              <input type="text" id="rightAccountField" size="40"></input>
 | 
			
		||||
                              <br>
 | 
			
		||||
                            </td>
 | 
			
		||||
                          </tr>
 | 
			
		||||
                          <tr>
 | 
			
		||||
                            <td align="right">
 | 
			
		||||
                              Seed
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                              <input type="text" id="rightSeedField" size="40"></input>
 | 
			
		||||
                              <br>
 | 
			
		||||
                            </td>
 | 
			
		||||
                          </tr>
 | 
			
		||||
                          <tr>
 | 
			
		||||
                            <td align="right">
 | 
			
		||||
                              XRP Balance
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                              <input type="text" id="rightBalanceField" size="40"></input>
 | 
			
		||||
                              <br>
 | 
			
		||||
                            </td>
 | 
			
		||||
                          </tr>
 | 
			
		||||
                          <tr>
 | 
			
		||||
                            <td align="right">
 | 
			
		||||
                              Quantity
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                              <input type="text" id="rightQuantityField" size="40"></input>
 | 
			
		||||
                              <br>
 | 
			
		||||
                            </td>
 | 
			
		||||
                          </tr>
 | 
			
		||||
                          <tr>
 | 
			
		||||
                            <td align="right">
 | 
			
		||||
                              Destination
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                              <input type="text" id="rightDestinationField" size="40"></input>
 | 
			
		||||
                              <br>
 | 
			
		||||
                            </td>
 | 
			
		||||
                          </tr>
 | 
			
		||||
                          <tr>
 | 
			
		||||
                            <td align="right">
 | 
			
		||||
                              MPT Issuance ID
 | 
			
		||||
                            </td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                              <input type="text" id="rightIssuanceIdField" size="40"></input>
 | 
			
		||||
                            </td>
 | 
			
		||||
                          </tr>
 | 
			
		||||
                        </table>
 | 
			
		||||
                        <p align="right">
 | 
			
		||||
                          <textarea id="rightResultField" cols="80" rows="20" ></textarea>
 | 
			
		||||
                        </p>
 | 
			
		||||
                      </td>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                  </table>
 | 
			
		||||
            <tr valign="top">
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Name of the currently selected account.">
 | 
			
		||||
                        <label for="accountNameField">Account Name</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
              </tr>
 | 
			
		||||
            </table>
 | 
			
		||||
          </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
      </table>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="accountNameField" size="40" readonly></input>
 | 
			
		||||
                    <input type="radio" id="account1" name="accounts" value="account1">
 | 
			
		||||
                    <label for="account1">Account 1</label>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr valign="top">
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Address of the currently selected account.">
 | 
			
		||||
                        <label for="accountAddressField">Account Address</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="accountAddressField" size="40" readonly></input>
 | 
			
		||||
                    <input type="radio" id="account2" name="accounts" value="account2">
 | 
			
		||||
                    <label for="account2">Account 2</label>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr valign="top">
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Seed of the currently selected account.">
 | 
			
		||||
                        <label for="accountSeedField">Account Seed</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="accountSeedField" size="40" readonly></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="XRP balance for the currently selected account.">
 | 
			
		||||
                        <label for="xrpBalanceField">XRP Balance</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="xrpBalanceField" size="40" readonly></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Issuance ID of the MPT you want to trade.">
 | 
			
		||||
                    <lable for="mptIdField">MPT Issuance ID</lable>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="mptIdField" size="40"></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td> 
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="authorizeMPT()">Authorize MPT</button>
 | 
			
		||||
                </td>               
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Number of MPTs to send.">
 | 
			
		||||
                        <label for="amountField">Amount</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="amountField" size="40"></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="sendMPT()">Send MPT</button>
 | 
			
		||||
                </td>  
 | 
			
		||||
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Destination account address for MPT transfer.">
 | 
			
		||||
                    <lable for="destinationField">Destination</lable>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="destinationField" size="40"></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td align="left" valign="top">
 | 
			
		||||
                    <button type="button" onClick="getMPTs()">Get MPTs</button>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td colspan="2">
 | 
			
		||||
                    <p align="right">
 | 
			
		||||
                        <textarea id="resultField" cols="80" rows="20"></textarea>
 | 
			
		||||
                    </p>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td align="left" valign="top">
 | 
			
		||||
                    <button type="button" onClick="gatherAccountInfo()">Gather Account Info</button><br/>
 | 
			
		||||
                    <button type="button" onClick="distributeAccountInfo()">Distribute Account Info</button>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </table>
 | 
			
		||||
    </form>
 | 
			
		||||
  </body>
 | 
			
		||||
</body>
 | 
			
		||||
<script>
 | 
			
		||||
    let radioButtons = document.querySelectorAll('input[type="radio"]');
 | 
			
		||||
    radioButtons.forEach(radio => {
 | 
			
		||||
        radio.addEventListener('change', function() {
 | 
			
		||||
            if (this.value === 'account1') {
 | 
			
		||||
                populate1()
 | 
			
		||||
            } else if (this.value === 'account2') {
 | 
			
		||||
                populate2()
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -5,42 +5,34 @@
 | 
			
		||||
async function sendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  document.getElementById('leftResultField').value = results
 | 
			
		||||
 | 
			
		||||
  await client.connect()
 | 
			
		||||
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
          
 | 
			
		||||
  const left_wallet = xrpl.Wallet.fromSeed(leftSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = leftIssuanceIdField.value
 | 
			
		||||
  const mpt_quantity = leftQuantityField.value
 | 
			
		||||
        
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
  const mpt_quantity = amountField.value
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": left_wallet.address,
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": leftDestinationField.value,
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
  }
 | 
			
		||||
      
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = left_wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${leftDestinationField.value} ...`
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
  const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${destinationField.value} ...`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    
 | 
			
		||||
        results += 'Transaction succeeded.\n\n'
 | 
			
		||||
        results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    results += `\nTransaction failed: ${pay_result.result.meta.TransactionResult}\n\n`
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendMPT()
 | 
			
		||||
@@ -52,31 +44,27 @@ async function sendMPT() {
 | 
			
		||||
async function getMPTs() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const left_wallet = xrpl.Wallet.fromSeed(leftSeedField.value)
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
  const left_mpts = await client.request({
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: left_wallet.address,
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
  let JSONString = JSON.stringify(left_mpts.result, null, 2)
 | 
			
		||||
  let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
  console.log("length: " + numberOfMPTs)
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
  results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
    results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  }
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getMPTs()
 | 
			
		||||
 | 
			
		||||
@@ -84,152 +72,30 @@ async function getMPTs() {
 | 
			
		||||
// ****** MPTAuthorize Transaction ***************************************
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
 | 
			
		||||
async function MPTAuthorize() {
 | 
			
		||||
async function authorizeMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  document.getElementById('leftResultField').value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
 | 
			
		||||
  const left_wallet = xrpl.Wallet.fromSeed(leftSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = leftIssuanceIdField.value
 | 
			
		||||
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
  const auth_mpt_tx = {
 | 
			
		||||
    "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
    "Account": left_wallet.address,
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
  }
 | 
			
		||||
  const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
  const auth_signed = left_wallet.sign(auth_prepared)
 | 
			
		||||
  const auth_signed = wallet.sign(auth_prepared)
 | 
			
		||||
  results += `\n\nSending authorization...`
 | 
			
		||||
  leftResultField.value = results
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
 | 
			
		||||
  if (auth_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `Transaction succeeded`
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
    results += `\nTransaction succeeded`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    leftResultField.value = results
 | 
			
		||||
    results += `\nTransaction failed: ${auth_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of MPTAuthorize()
 | 
			
		||||
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
// ****** Reciprocal Transactions ***************************************
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
       
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ************* Right Send MPT ********
 | 
			
		||||
// *******************************************************
 | 
			
		||||
      
 | 
			
		||||
async function rightSendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
 | 
			
		||||
  await client.connect()
 | 
			
		||||
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
          
 | 
			
		||||
  const right_wallet = xrpl.Wallet.fromSeed(rightSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = rightIssuanceIdField.value
 | 
			
		||||
  const mpt_quantity = rightQuantityField.value
 | 
			
		||||
        
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": right_wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": rightDestinationField.value,
 | 
			
		||||
  }
 | 
			
		||||
      
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = right_wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${rightDestinationField.value} ...`
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded.\n\n'
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of rightSendMPT()
 | 
			
		||||
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
// ****** MPTAuthorize Transaction ***************************************
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
 | 
			
		||||
async function rightMPTAuthorize() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  document.getElementById('rightResultField').value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
 | 
			
		||||
  const right_wallet = xrpl.Wallet.fromSeed(rightSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = rightIssuanceIdField.value
 | 
			
		||||
  const auth_mpt_tx = {
 | 
			
		||||
    "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
    "Account": right_wallet.address,
 | 
			
		||||
    "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
  }
 | 
			
		||||
  const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
  const auth_signed = right_wallet.sign(auth_prepared)
 | 
			
		||||
  results += `\n\nSending authorization...`
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
  const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
  console.log(JSON.stringify(auth_result.result, null, 2))
 | 
			
		||||
 | 
			
		||||
  if (auth_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `Transaction succeeded`
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    rightResultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of rightMPTAuthorize()
 | 
			
		||||
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
// ****** Right Get MPTs          ***************************************
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
 | 
			
		||||
async function rightGetMPTs() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const right_wallet = xrpl.Wallet.fromSeed(rightSeedField.value)
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
  const right_mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: right_wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
  let JSONString = JSON.stringify(right_mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
  results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  }
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  rightResultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of rightGetMPTs()
 | 
			
		||||
} // end of MPTAuthorize()
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								_code-samples/mpt-sender/send-mpt.zip
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								docs/img/tut-send-mpt-0-empty-form.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 202 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/tut-send-mpt-1-gathered-info.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 247 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/tut-send-mpt-2-account-2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 254 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/tut-send-mpt-2-authorize-mpt.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 305 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/tut-send-mpt-3-send-mpt.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 424 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/tut-send-mpt-4-get-mpts.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 411 KiB  | 
| 
		 Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 200 KiB  | 
| 
		 Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 449 KiB  | 
| 
		 Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 585 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/img/uc-mpt1-t-bill-gather-mpt-info.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 397 KiB  | 
| 
		 Before Width: | Height: | Size: 224 KiB After Width: | Height: | Size: 224 KiB  | 
| 
		 Before Width: | Height: | Size: 440 KiB After Width: | Height: | Size: 552 KiB  | 
| 
		 Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 343 KiB  | 
| 
		 Before Width: | Height: | Size: 277 KiB  | 
| 
		 Before Width: | Height: | Size: 281 KiB  | 
| 
		 Before Width: | Height: | Size: 455 KiB  | 
| 
		 Before Width: | Height: | Size: 206 KiB  | 
| 
		 Before Width: | Height: | Size: 166 KiB  | 
| 
		 Before Width: | Height: | Size: 259 KiB  | 
| 
		 Before Width: | Height: | Size: 393 KiB  | 
							
								
								
									
										823
									
								
								docs/tutorials/javascript/send-payments/sending-mpts.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,823 @@
 | 
			
		||||
---
 | 
			
		||||
seo:
 | 
			
		||||
    description: Issue an asset-backed token such as a US Treasury bill using multi-purpose tokens.
 | 
			
		||||
labels:
 | 
			
		||||
  - Tokens
 | 
			
		||||
  - MPT
 | 
			
		||||
---
 | 
			
		||||
# Sending MPTs
 | 
			
		||||
 | 
			
		||||
_As an XRPL holder, I want to send multi-purpose tokens to another account in order to complete an offline transaction._
 | 
			
		||||
 | 
			
		||||
To send an MPT to another account, the receiving account must first authorize the receipt of the MPT, based on its MPToken Issuance ID. This is to prevent malicious users from spamming accounts with unwanted tokens that could negatively impact storage and XRP reserves.
 | 
			
		||||
 | 
			
		||||
Once an account receives an MPT, it can send the MPT to another account, provided the MPT was created with the _Can Transfer_ flag set, and the receiving account authorizes the MPT.
 | 
			
		||||
 | 
			
		||||
## Send MPT Utility
 | 
			
		||||
 | 
			
		||||
The Send MPT utility <!-- embedded below -->lets you create an account, authorize it to receive a specific MPT issuance, then send it the authorized MPT from an issuer or holder account. (You can issue an MPT using the [MPT Generator](../../../use-cases/tokenization/creating-an-asset-backed-multi-purpose-token.md) utility.)
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
You can download a [standalone version of the MPT Sender](../../../../_code-samples/mpt-sender/send-mpt.zip) as sample code<!--, or use the embedded form that follows-->.
 | 
			
		||||
 | 
			
		||||
## Get Accounts
 | 
			
		||||
 | 
			
		||||
To send an MPT, you need the **Seed** value for the MPT issuer to retrieve its account, then you need either a new account or an account seed for the target account. You can use the [MPT Generator](../../../use-cases/tokenization/creating-an-asset-backed-multi-purpose-token.md) to create a new MPT for transfer.
 | 
			
		||||
 | 
			
		||||
To get the accounts:
 | 
			
		||||
 | 
			
		||||
1. Open <tt>send-mpt.html</tt> in a browser.
 | 
			
		||||
2. Choose your ledger instance (**Devnet** or **Testnet**).
 | 
			
		||||
3. If you used the MPT Generator:
 | 
			
		||||
   1. Paste the gathered info in the **Result** field.
 | 
			
		||||
   
 | 
			
		||||
   2. Cut and paste the MPT Issuance ID to the **MPT Issuance ID** field.
 | 
			
		||||
   3. Click **Distribute Account Info** to populate the **Account 1** fields.<br/><br/>
 | 
			
		||||
   (If you did not use the MPT Generator, enter the **Account 1 Name**, **Account 1 Address**, **Account 1 Seed**, and **MPT Issuance ID** in the corresponding fields.)
 | 
			
		||||
4. Click **Get New Account 2**.
 | 
			
		||||
5. Optionally, add the **Account 2 Name**, an arbitrary human-readable name that helps to differentiate the accounts.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Authorize MPT
 | 
			
		||||
 | 
			
		||||
To receive MPTs, an account needs to authorize the MPT.
 | 
			
		||||
 | 
			
		||||
To authorize Account 2 to accept MPTs:
 | 
			
		||||
 | 
			
		||||
1. Click the **Account 2** radio button.
 | 
			
		||||
2. Enter an **Amount**, the maximum number of MPTs the account will accept.
 | 
			
		||||
2. Click **Authorize MPTs**.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Send MPT
 | 
			
		||||
 | 
			
		||||
To send an MPT:
 | 
			
		||||
 | 
			
		||||
1. Click the **Account 1** radio button.
 | 
			
		||||
3. Enter the **MPT Issuance ID**.
 | 
			
		||||
2. Enter an **Amount** of MPTs to send.
 | 
			
		||||
3. Enter the **Destination** (likely the value in the **Account 2 Address** field, but it can be any account on the same ledger instance).
 | 
			
		||||
4. Click **Send MPT**.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Get MPTs
 | 
			
		||||
 | 
			
		||||
To verify receipt of the MPTs:
 | 
			
		||||
 | 
			
		||||
1. Click the **Account 2** radio button.
 | 
			
		||||
2. Click **Get MPTs**.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
# Code Walkthrough
 | 
			
		||||
 | 
			
		||||
You can download a [standalone version of the MPT Sender](../../../../_code-samples/mpt-sender/send-mpt.zip) as sample code.
 | 
			
		||||
 | 
			
		||||
## send-mpt.js
 | 
			
		||||
 | 
			
		||||
The code that supports the MPT features is in the `send-mpt.js` file. Standard support for connecting to the XRP Ledger is included in the `account-support.js` file.
 | 
			
		||||
 | 
			
		||||
### sendMPT()
 | 
			
		||||
 | 
			
		||||
Connect to the network and instantiate the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript    
 | 
			
		||||
async function sendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Instantiate the parameter variables.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
  const mpt_quantity = amountField.value
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create a Payment transaction using the MPT for the Amount.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare and sign the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send the prepared transaction and report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${destinationField.value} ...`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += 'Transaction succeeded.\n\n'
 | 
			
		||||
        results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${pay_result.result.meta.TransactionResult}\n\n`
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendMPT()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## getMPTs
 | 
			
		||||
 | 
			
		||||
Get all of the MPTs for the selected account by filtering for MPT objects and looping through the array to display them one at a time.
 | 
			
		||||
 | 
			
		||||
Connect to the XRPL instance and get the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function getMPTs() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send an `account_objects` request, specifying the type _mptoken_.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Stringify and parse the JSON result string.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Loop through the filtered array of account_objects to list all of the MPTs held by the account.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
    results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Return the parsed results, followed by the raw results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getMPTs()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## authorizeMPT
 | 
			
		||||
 | 
			
		||||
Before you can send an MPT to another account, the target account must authorize the MPT.
 | 
			
		||||
 | 
			
		||||
Connect to the XRPL and instantiate the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function authorizeMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Capture the MPT issuance ID in a variable.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create the MPTokenAuthorize transaction, passing the target account's address and the MPT Issuance ID.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const auth_mpt_tx = {
 | 
			
		||||
    "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare, sign, and send the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
  const auth_signed = wallet.sign(auth_prepared)
 | 
			
		||||
  results += `\n\nSending authorization...`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (auth_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `\nTransaction succeeded`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${auth_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of MPTAuthorize()
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## send-mpt.html
 | 
			
		||||
 | 
			
		||||
```html
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
    <title>Send MPT</title>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <link href="modular-tutorials.css" rel="stylesheet">
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script>
 | 
			
		||||
    <script src="account-support.js"></script>
 | 
			
		||||
    <script src='send-mpt.js'></script>
 | 
			
		||||
    <script>
 | 
			
		||||
        if (typeof module !== "undefined") {
 | 
			
		||||
            const xrpl = require('xrpl')
 | 
			
		||||
        }
 | 
			
		||||
    </script>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<!-- ************************************************************** -->
 | 
			
		||||
<!-- ********************** The Form ****************************** -->
 | 
			
		||||
<!-- ************************************************************** -->
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
    <h1>Send MPT</h1>
 | 
			
		||||
    <form id="theForm">
 | 
			
		||||
        <span class="tooltip" tooltip-data="Choose the XRPL host server for your account.">
 | 
			
		||||
            Choose your ledger instance:
 | 
			
		||||
        </span>
 | 
			
		||||
          
 | 
			
		||||
        <input type="radio" id="dn" name="server" value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
        <label for="dn">Devnet</label>
 | 
			
		||||
          
 | 
			
		||||
        <input type="radio" id="tn" name="server" value="wss://s.altnet.rippletest.net:51233">
 | 
			
		||||
        <label for="tn">Testnet</label>
 | 
			
		||||
        <br /><br />
 | 
			
		||||
        <table>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="getNewAccount1()">Get New Account 1</button>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="getAccountFromSeed1()">Get Account 1 From Seed</button>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="getNewAccount2()">Get New Account 2</button>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="getAccountFromSeed2()">Get Account 2 From Seed</button>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                        <span class="tooltip" tooltip-data="Arbitrary human-readable name for the account."><label for="account1name">Account 1 Name</label>
 | 
			
		||||
                        </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account1name" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Arbitrary human-readable name for the account.">
 | 
			
		||||
                        <label for="account2name">Account 2 Name</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account2name" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Identifying address for the account.">
 | 
			
		||||
                        <label for="account1address">Account 1 Address</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td> 
 | 
			
		||||
                    <input type="text" id="account1address" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Identifying address for the account.">
 | 
			
		||||
                        <label for="account2address">Account 2 Address</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account2address" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Seed for deriving public and private keys for the account.">
 | 
			
		||||
                        <label for="account1seed">Account 1 Seed</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account1seed" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Seed for deriving public and private keys for the account.">
 | 
			
		||||
                        <label for="account2seed">Account 2 Seed</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="account2seed" size="40"></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            </table>
 | 
			
		||||
            <hr />
 | 
			
		||||
            <table>
 | 
			
		||||
            <tr valign="top">
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Name of the currently selected account.">
 | 
			
		||||
                        <label for="accountNameField">Account Name</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="accountNameField" size="40" readonly></input>
 | 
			
		||||
                    <input type="radio" id="account1" name="accounts" value="account1">
 | 
			
		||||
                    <label for="account1">Account 1</label>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr valign="top">
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Address of the currently selected account.">
 | 
			
		||||
                        <label for="accountAddressField">Account Address</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="accountAddressField" size="40" readonly></input>
 | 
			
		||||
                    <input type="radio" id="account2" name="accounts" value="account2">
 | 
			
		||||
                    <label for="account2">Account 2</label>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr valign="top">
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Seed of the currently selected account.">
 | 
			
		||||
                        <label for="accountSeedField">Account Seed</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="accountSeedField" size="40" readonly></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="XRP balance for the currently selected account.">
 | 
			
		||||
                        <label for="xrpBalanceField">XRP Balance</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="xrpBalanceField" size="40" readonly></input>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Issuance ID of the MPT you want to trade.">
 | 
			
		||||
                    <lable for="mptIdField">MPT Issuance ID</lable>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="mptIdField" size="40"></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td> 
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="authorizeMPT()">Authorize MPT</button>
 | 
			
		||||
                </td>               
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Number of MPTs to send.">
 | 
			
		||||
                        <label for="amountField">Amount</label>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="amountField" size="40"></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <button type="button" onClick="sendMPT()">Send MPT</button>
 | 
			
		||||
                </td>  
 | 
			
		||||
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td align="right">
 | 
			
		||||
                    <span class="tooltip" tooltip-data="Destination account address for MPT transfer.">
 | 
			
		||||
                    <lable for="destinationField">Destination</lable>
 | 
			
		||||
                    </span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="text" id="destinationField" size="40"></input>
 | 
			
		||||
                    <br>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td align="left" valign="top">
 | 
			
		||||
                    <button type="button" onClick="getMPTs()">Get MPTs</button>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td colspan="2">
 | 
			
		||||
                    <p align="right">
 | 
			
		||||
                        <textarea id="resultField" cols="80" rows="20"></textarea>
 | 
			
		||||
                    </p>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td align="left" valign="top">
 | 
			
		||||
                    <button type="button" onClick="gatherAccountInfo()">Gather Account Info</button><br/>
 | 
			
		||||
                    <button type="button" onClick="distributeAccountInfo()">Distribute Account Info</button>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </table>
 | 
			
		||||
    </form>
 | 
			
		||||
</body>
 | 
			
		||||
<script>
 | 
			
		||||
    let radioButtons = document.querySelectorAll('input[type="radio"]');
 | 
			
		||||
    radioButtons.forEach(radio => {
 | 
			
		||||
        radio.addEventListener('change', function() {
 | 
			
		||||
            if (this.value === 'account1') {
 | 
			
		||||
                populate1()
 | 
			
		||||
            } else if (this.value === 'account2') {
 | 
			
		||||
                populate2()
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
</html>
 | 
			
		||||
```
 | 
			
		||||
<!--
 | 
			
		||||
<div>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script> 
 | 
			
		||||
<script>
 | 
			
		||||
    if (typeof module !== "undefined") {
 | 
			
		||||
    const xrpl = require("xrpl")
 | 
			
		||||
}
 | 
			
		||||
    document.addEventListener("DOMContentLoaded", function() {
 | 
			
		||||
        getHolderAccountFromSeedButton.addEventListener("click", getHolderFromSeed)
 | 
			
		||||
        getReceiverAccountButton.addEventListener("click", getAccount)
 | 
			
		||||
        getReceiverFromSeedButton.addEventListener("click", getReceiverFromSeed)
 | 
			
		||||
        authorizeMPTButton.addEventListener("click", authorizeMPT)
 | 
			
		||||
        sendMPTButton.addEventListener("click", sendMPT)
 | 
			
		||||
        getMPTsButton.addEventListener("click", getMPTs)
 | 
			
		||||
 })
 | 
			
		||||
function getNet() {
 | 
			
		||||
    let net
 | 
			
		||||
    if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
 | 
			
		||||
    if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
 | 
			
		||||
    return net
 | 
			
		||||
  } // End of getNet()           
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // ************* Get Account *****************************
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  async function getAccount() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    receiverAccountField.value = "Getting a new account..."
 | 
			
		||||
    results = 'Connecting to ' + net + '....'
 | 
			
		||||
  //-------------------------------This uses the default faucet for Testnet/Devnet.
 | 
			
		||||
    let faucetHost = null
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, funding wallet.'
 | 
			
		||||
  // ----------------------------------------Create and fund a test account wallet.
 | 
			
		||||
    const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
 | 
			
		||||
    results += '\nGot a wallet.'
 | 
			
		||||
  // ------------------------------------------------------Get the current balance.
 | 
			
		||||
    receiverAccountField.value = my_wallet.address
 | 
			
		||||
    receiverSeedField.value = my_wallet.seed
 | 
			
		||||
    results += '\nAccount created.'
 | 
			
		||||
    console.log(results)
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getAccount()
 | 
			
		||||
// **********************************************************
 | 
			
		||||
// *********** Get Holder from Seed *************************
 | 
			
		||||
// **********************************************************
 | 
			
		||||
  async function getHolderFromSeed() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    holderAccountField.value = "Getting holder account from seed..."
 | 
			
		||||
    results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, finding wallets.\n'
 | 
			
		||||
    console.log(results)
 | 
			
		||||
  // --------------------------------------------------Find the test account wallet.    
 | 
			
		||||
    const my_wallet = xrpl.Wallet.fromSeed(holderSeedField.value)    
 | 
			
		||||
  // -------------------------------------------------------Get the current balance.
 | 
			
		||||
    holderAccountField.value = my_wallet.address
 | 
			
		||||
    holderSeedField.value = my_wallet.seed      
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getHolderFromSeed()
 | 
			
		||||
// **********************************************************
 | 
			
		||||
// *********** Get Receiver from Seed *************************
 | 
			
		||||
// **********************************************************
 | 
			
		||||
  async function getReceiverFromSeed() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    receiverAccountField.value = "Getting receiver account from seed..."
 | 
			
		||||
    results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, finding wallets.\n'
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  // --------------------------------------------------Find the test account wallet.    
 | 
			
		||||
    const my_wallet = xrpl.Wallet.fromSeed(receiverSeedField.value)    
 | 
			
		||||
  // -------------------------------------------------------Get the current balance.
 | 
			
		||||
    receiverAccountField.value = my_wallet.address
 | 
			
		||||
    receiverSeedField.value = my_wallet.seed 
 | 
			
		||||
    resultsArea.value = results     
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getReceiverFromSeed()
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // *************** Send MPT **********************
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
async function sendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultsArea.value = results  
 | 
			
		||||
  const holder_wallet = xrpl.Wallet.fromSeed(holderSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIssuanceIDField.value
 | 
			
		||||
  const mpt_quantity = quantityField.value
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": holder_wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": receiverAccountField.value,
 | 
			
		||||
  }
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = holder_wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${receiverAccountField.value} ...`
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += 'Transaction succeeded.\n\n'
 | 
			
		||||
        results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendMPT()
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ******************** Get MPTs *************************
 | 
			
		||||
// *******************************************************
 | 
			
		||||
async function getMPTs() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const receiver_wallet = xrpl.Wallet.fromSeed(receiverSeedField.value)
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  const mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: receiver_wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
  let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
  results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  }
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getMPTs()
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
// ****** MPTAuthorize Transaction ***************************************
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
async function authorizeMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const receiver_wallet = xrpl.Wallet.fromSeed(receiverSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIssuanceIDField.value
 | 
			
		||||
  const auth_mpt_tx = {
 | 
			
		||||
    "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
    "Account": receiver_wallet.address,
 | 
			
		||||
    "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
  }
 | 
			
		||||
  const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
  const auth_signed = receiver_wallet.sign(auth_prepared)
 | 
			
		||||
  results += `\n\nSending authorization...`
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
  console.log(JSON.stringify(auth_result.result, null, 2))
 | 
			
		||||
  if (auth_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `Transaction succeeded`
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of MPTAuthorize()
 | 
			
		||||
</script>
 | 
			
		||||
<div>
 | 
			
		||||
<form>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script> 
 | 
			
		||||
<!-- Required meta tags - - >
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 | 
			
		||||
    <div class="container">
 | 
			
		||||
      <div class="row">
 | 
			
		||||
        <div class="col align-self-start">
 | 
			
		||||
        <h4>MPT Sender</h4>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <b>1. Choose your preferred network.</b>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col align-self-center">
 | 
			
		||||
              <input type="radio" id="tn" name="server"
 | 
			
		||||
                  value="wss://s.altnet.rippletest.net:51233">
 | 
			
		||||
              <label for="tn">Testnet</label>
 | 
			
		||||
              <br/>
 | 
			
		||||
              <input type="radio" id="dn" name="server"
 | 
			
		||||
                  value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
              <label for="dn">Devnet</label>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <b>2. Get the holder (or issuer) account from its seed.<br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="holderSeedField">Holder Seed</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="holderSeedField" size="40"></input>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="holderAccountField">Holder Account</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="holderAccountField" size="40"></input>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <br/>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <button type="button" id="getHolderAccountFromSeedButton" class="btn btn-primary">Get Holder Account From Seed</button>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <b>3. Get a new receiver account or retrieve one from its seed.</b>
 | 
			
		||||
                  <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="receiverSeedField">Receiver Seed</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="receiverSeedField" size="40"></input>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="receiverAccountField">Receiver Account</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="receiverAccountField" size="40"></input>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <button type="button" id="getReceiverAccountButton" class="btn btn-primary">Get New Receiver Account</button>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div class="col align-self-start">
 | 
			
		||||
              <button type="button" id="getReceiverFromSeedButton" class="btn btn-primary">Get Receiver Account From Seed</button>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col align-self-start">
 | 
			
		||||
            <b>4. Enter the <i>MPT Issuance ID</i>.</b>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
                <label for="mptIssuanceIDField">MPT Issuance ID</label>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="mptIssuanceIDField" size="40"></input>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col align-self-start">
 | 
			
		||||
            <b>5. Click <i>Authorize MPT</i> to authorize the MPT for the receiver.</b>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <button type="button" id="authorizeMPTButton" class="btn btn-primary">Authorize MPT</button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <br/>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col align-self-start">
 | 
			
		||||
            <b>5. Enter the <i>Quantity</i> of MPTs to send.</b>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
                <label for="quantity">Quantity</label>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
                <input type="text" id="quantityField" size="40"></input>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-align-items-left">
 | 
			
		||||
        <br/>
 | 
			
		||||
          <p><b>6. Click Send MPTs</b><br/>
 | 
			
		||||
             <button type="button" id="sendMPTButton" class="btn btn-primary">Send MPTs</button>
 | 
			
		||||
          </p>
 | 
			
		||||
          </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-align-self-start">
 | 
			
		||||
          <p><b>Results</b></p>
 | 
			
		||||
          <textarea class="form-control" id="resultsArea" rows="18" cols="40"></textarea>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-align-self-start">
 | 
			
		||||
            <br/>
 | 
			
		||||
            <p><b>7. Click Get MPTs</b><br/>
 | 
			
		||||
            <button type = "button" id="getMPTsButton" class="btn btn-primary">Get MPTs</button>
 | 
			
		||||
          </p>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
</form>
 | 
			
		||||
</div>
 | 
			
		||||
<hr/>
 | 
			
		||||
 | 
			
		||||
==>
 | 
			
		||||
@@ -21,13 +21,11 @@ To learn more, see [Multi-purpose Tokens](../../concepts/tokens/fungible-tokens/
 | 
			
		||||
 | 
			
		||||
## MPT Generator
 | 
			
		||||
 | 
			
		||||
The MPT Generator utility embedded on the page below lets you experiment with an MPT configuration in a sandbox environment. When you are satisfied with the settings, you can generate the transaction code required to create your MPT on Mainnet.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
You can download a [standalone version of the MPT Generator](../../../_code-samples/mpt-generator/mpt-generator.zip) as sample code<!--, or use the embedded form that follows-->.
 | 
			
		||||
 | 
			
		||||
In practice, you want to use an Issuer account configuration to issue an MPT, but you can try the form below with a new account and the transaction works fine. See [Creating a US Treasury Bill](#creating-a-us-treasury-bill) for a full description of the issuance process. The form is populated with sample values, but you can change the parameters for your own experiments. A T-bill is just one example of the many types of asset you can create and trade on the XRP Ledger.
 | 
			
		||||
In practice, you want to use an Issuer account configuration to issue an MPT, but you can try the form  with a new, unconfigured account and the transaction works fine.<!--  See [Creating a US Treasury Bill](#creating-a-us-treasury-bill) for a full description of the issuance process.The form is populated with sample values, but you can change the parameters for your own experiments.--> A T-bill is one example of the many types of asset you can create and trade on the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
<!--
 | 
			
		||||
<hr/>
 | 
			
		||||
@@ -357,8 +355,6 @@ const transactionJson = {
 | 
			
		||||
 | 
			
		||||
A US Treasury bill (T-bill) is a short-term debt security issued by the US government. T-bills are considered a safe investment because they're backed by the US government. T-bills are appealing to investors in American states that have high income tax because the interest earned is exempt from state and local taxes. See [Treasury Bills In Depth](https://www.treasurydirect.gov/research-center/history-of-marketable-securities/bills/t-bills-indepth/).
 | 
			
		||||
 | 
			
		||||
A T-bill is just one of the many asset-backed tokens you can create and trade as an MPT on the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
### Creating an Issuing Account
 | 
			
		||||
 | 
			
		||||
You can use the Account Configurator to experiment with the settings for a T-bill issuing account in a sandbox environment. When you are satisfied with your configuration, you can create an account on XRPL Mainnet to begin trading.
 | 
			
		||||
@@ -442,12 +438,14 @@ Once you've set your preferred values, click **Generate Transaction** to see the
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
To create your T-bill MPT, click **Send Transaction**. When your transaction succeeds, a link to the record in the XRPL Explorer is displayed in the Code field.
 | 
			
		||||
To create your T-bill MPT, click **Send Transaction**. When your transaction succeeds, a link to the record in the XRPL Explorer is displayed in the result field.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
Be sure to copy and save the **Seed** field and the **MPT Issuance ID** so that you can try transferring the MPT to another account as shown in [Sending an MPT](./send-an-mpt.md).
 | 
			
		||||
Follow the link and scroll down to find the `MPTokenIssuanceCreate` transaction for your new T-bill in the Explorer.
 | 
			
		||||
 | 
			
		||||
Follow the link appended to the result field and scroll down to find the `MPTokenIssuanceCreate` transaction for your new T-bill in the Explorer.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
Click **Gather MPT Information** to copy the account information and MPT Issuance ID to the result field. Copy the information and save it to send the MPT to another account as shown in [Sending MPTs](../../tutorials/javascript/send-payments/sending-mpts.md).
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 
 | 
			
		||||
@@ -21,8 +21,8 @@ const useCases = [
 | 
			
		||||
    link: "/docs/use-cases/tokenization/nftoken-marketplace/",
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    description: "MPT Overview",
 | 
			
		||||
    link: "/docs/use-cases/tokenization/mpt-overview/"
 | 
			
		||||
    description: "Multi-purpose Token Issuer",
 | 
			
		||||
    link: "/docs/use-cases/tokenization/creating-an-asset-backed-multi-purpose-token"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    description: "Authorized Minter",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,26 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
seo:
 | 
			
		||||
    description: Overview of Multi-purpose Token use cases.
 | 
			
		||||
labels:
 | 
			
		||||
  - Tokenization
 | 
			
		||||
  - MPT
 | 
			
		||||
  - Multi-purpose Token
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Multi-purpose Tokens Overview
 | 
			
		||||
 | 
			
		||||
Multi-purpose Tokens (MPTs) let you take advantage of ready-to-use tokenization features with a few lines of code. You can create many token experiences from one token program itself. Notable features include:
 | 
			
		||||
 | 
			
		||||
- MPTs store their metadata directly on the XRPL blockchain.
 | 
			
		||||
- A 1024-byte URI field provides a metadata pointer that allows you to use an off-chain source for metadata in addition to the on-chain source. This lets your application access necessary information directly from the chain, prompting higher interoperability for tokens, without losing the ability to attach additional information. 
 | 
			
		||||
- MPTs can have a fixed token supply where you set a cap on the maximum number of tokens that can be minted. 
 | 
			
		||||
- You can define MPTs as non-transferable, tokens that can only be transferred back to the issuer, but not among tokenholders. Useful for cases such as issuing airline credits or loyalty rewards.
 | 
			
		||||
- Issuers can set transfer fees to collect on-chain revenue each time the token is traded among tokenholders. 
 | 
			
		||||
- MPTs also have advanced compliance features: 
 | 
			
		||||
    - The ability to lock tokens held by a tokenholder to support compliance requirements.
 | 
			
		||||
    - The ability to set a global lock for all MPT balances across all tokenholders.
 | 
			
		||||
    - The issuer can configure MPTs that can be clawed back from tokenholder wallets, either to revoke them, or to reassign them in the case of lost wallet keys. 
 | 
			
		||||
    - An opt-in feature can allow only wallets authorized by the issuer to hold issued tokens.
 | 
			
		||||
 | 
			
		||||
- [Creating an Asset-based Multi-purpose Token](./creating-an-asset-backed-multi-purpose-token.md)
 | 
			
		||||
- [Sending an MPT](./send-an-mpt.md)
 | 
			
		||||
@@ -1,411 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
seo:
 | 
			
		||||
    description: Issue an asset-backed token such as a US Treasury bill using multi-purpose tokens.
 | 
			
		||||
labels:
 | 
			
		||||
  - Tokens
 | 
			
		||||
  - MPT
 | 
			
		||||
---
 | 
			
		||||
# Sending an MPT
 | 
			
		||||
 | 
			
		||||
_As an XRPL holder, I want to send multi-purpose tokens to another account in order to complete an offline transaction._
 | 
			
		||||
 | 
			
		||||
To send an MPT to another account, the receiving account must first authorize the receipt of the MPT, based on its MPToken Issuance ID. This is to prevent malicious users from spamming accounts with unwanted tokens that could negatively impact storage and XRP reserves.
 | 
			
		||||
 | 
			
		||||
Once an account receives an MPT, it can send the MPT to another account, provided the MPT was created with the _Can Transfer_ flag set, and the receiving account authorizes the MPT.
 | 
			
		||||
 | 
			
		||||
## Send MPT Utility
 | 
			
		||||
 | 
			
		||||
The Send MPT utility <!-- embedded below -->lets you create an account, authorize it to receive a specific MPT issuance, then send it the authorized MPT from an issuer or holder account. (You can issue an MPT using the [MPT Generator](./creating-an-asset-backed-multi-purpose-token.md) utility.)
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
You can download a [standalone version of the MPT Sender](../../../_code-samples/mpt-sender/mpt-sender.zip) as sample code<!--, or use the embedded form that follows-->.
 | 
			
		||||
 | 
			
		||||
## Get Accounts
 | 
			
		||||
 | 
			
		||||
To send an MPT, you need the **Seed** value for the MPT issuer to retrieve its account, then you need either a new account or an account seed for the target account.
 | 
			
		||||
 | 
			
		||||
To get the accounts:
 | 
			
		||||
 | 
			
		||||
1. Open <tt>send-mpt.html</tt> in a browser.
 | 
			
		||||
2. Choose your ledger instance (**Devnet** or **Testnet**).
 | 
			
		||||
3. Paste the issuer seed in the left **Seed** field.
 | 
			
		||||

 | 
			
		||||
4. On the _right_ side of the form, click **Get New Right Account**. This will populate the **Seeds** field with seeds for both accounts.
 | 
			
		||||

 | 
			
		||||
5. Click **Get Accounts From Seeds**.
 | 
			
		||||

 | 
			
		||||
## Authorize MPT
 | 
			
		||||
 | 
			
		||||
To receive MPTs, the right account needs to authorize the MPT.
 | 
			
		||||
 | 
			
		||||
To authorize MPTs:
 | 
			
		||||
 | 
			
		||||
1. On the right side of the form, enter the **MPT Issuance ID**.
 | 
			
		||||
2. Click **Authorize MPTs**.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Send MPT
 | 
			
		||||
 | 
			
		||||
To send an MPT:
 | 
			
		||||
 | 
			
		||||
1. On the left side of the form, enter the **Quantity** of MPTs to send.
 | 
			
		||||
2. Enter the **Destination** (likely the **Right Account** field, but it can be any account on the same ledger instance).
 | 
			
		||||
3. Enter the **MPT Issuance ID**.
 | 
			
		||||
4. Click **Send MPT**.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Get MPTs
 | 
			
		||||
 | 
			
		||||
To verify receipt of the MPTs, click **Get MPTs** for the right account.
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<!--
 | 
			
		||||
<div>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script> 
 | 
			
		||||
<script>
 | 
			
		||||
    if (typeof module !== "undefined") {
 | 
			
		||||
    const xrpl = require("xrpl")
 | 
			
		||||
}
 | 
			
		||||
    document.addEventListener("DOMContentLoaded", function() {
 | 
			
		||||
        getHolderAccountFromSeedButton.addEventListener("click", getHolderFromSeed)
 | 
			
		||||
        getReceiverAccountButton.addEventListener("click", getAccount)
 | 
			
		||||
        getReceiverFromSeedButton.addEventListener("click", getReceiverFromSeed)
 | 
			
		||||
        authorizeMPTButton.addEventListener("click", authorizeMPT)
 | 
			
		||||
        sendMPTButton.addEventListener("click", sendMPT)
 | 
			
		||||
        getMPTsButton.addEventListener("click", getMPTs)
 | 
			
		||||
 })
 | 
			
		||||
function getNet() {
 | 
			
		||||
    let net
 | 
			
		||||
    if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
 | 
			
		||||
    if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
 | 
			
		||||
    return net
 | 
			
		||||
  } // End of getNet()           
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // ************* Get Account *****************************
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  async function getAccount() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    receiverAccountField.value = "Getting a new account..."
 | 
			
		||||
    results = 'Connecting to ' + net + '....'
 | 
			
		||||
  //-------------------------------This uses the default faucet for Testnet/Devnet.
 | 
			
		||||
    let faucetHost = null
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, funding wallet.'
 | 
			
		||||
  // ----------------------------------------Create and fund a test account wallet.
 | 
			
		||||
    const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
 | 
			
		||||
    results += '\nGot a wallet.'
 | 
			
		||||
  // ------------------------------------------------------Get the current balance.
 | 
			
		||||
    receiverAccountField.value = my_wallet.address
 | 
			
		||||
    receiverSeedField.value = my_wallet.seed
 | 
			
		||||
    results += '\nAccount created.'
 | 
			
		||||
    console.log(results)
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getAccount()
 | 
			
		||||
// **********************************************************
 | 
			
		||||
// *********** Get Holder from Seed *************************
 | 
			
		||||
// **********************************************************
 | 
			
		||||
  async function getHolderFromSeed() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    holderAccountField.value = "Getting holder account from seed..."
 | 
			
		||||
    results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, finding wallets.\n'
 | 
			
		||||
    console.log(results)
 | 
			
		||||
  // --------------------------------------------------Find the test account wallet.    
 | 
			
		||||
    const my_wallet = xrpl.Wallet.fromSeed(holderSeedField.value)    
 | 
			
		||||
  // -------------------------------------------------------Get the current balance.
 | 
			
		||||
    holderAccountField.value = my_wallet.address
 | 
			
		||||
    holderSeedField.value = my_wallet.seed      
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getHolderFromSeed()
 | 
			
		||||
// **********************************************************
 | 
			
		||||
// *********** Get Receiver from Seed *************************
 | 
			
		||||
// **********************************************************
 | 
			
		||||
  async function getReceiverFromSeed() {
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    receiverAccountField.value = "Getting receiver account from seed..."
 | 
			
		||||
    results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results += '\nConnected, finding wallets.\n'
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  // --------------------------------------------------Find the test account wallet.    
 | 
			
		||||
    const my_wallet = xrpl.Wallet.fromSeed(receiverSeedField.value)    
 | 
			
		||||
  // -------------------------------------------------------Get the current balance.
 | 
			
		||||
    receiverAccountField.value = my_wallet.address
 | 
			
		||||
    receiverSeedField.value = my_wallet.seed 
 | 
			
		||||
    resultsArea.value = results     
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  } // End of getReceiverFromSeed()
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
  // *************** Send MPT **********************
 | 
			
		||||
  // *******************************************************
 | 
			
		||||
async function sendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultsArea.value = results  
 | 
			
		||||
  const holder_wallet = xrpl.Wallet.fromSeed(holderSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIssuanceIDField.value
 | 
			
		||||
  const mpt_quantity = quantityField.value
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": holder_wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": receiverAccountField.value,
 | 
			
		||||
  }
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = holder_wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${receiverAccountField.value} ...`
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += 'Transaction succeeded.\n\n'
 | 
			
		||||
        results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendMPT()
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ******************** Get MPTs *************************
 | 
			
		||||
// *******************************************************
 | 
			
		||||
async function getMPTs() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const receiver_wallet = xrpl.Wallet.fromSeed(receiverSeedField.value)
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  const mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: receiver_wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
  let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
  results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  }
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getMPTs()
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
// ****** MPTAuthorize Transaction ***************************************
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
async function authorizeMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const receiver_wallet = xrpl.Wallet.fromSeed(receiverSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIssuanceIDField.value
 | 
			
		||||
  const auth_mpt_tx = {
 | 
			
		||||
    "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
    "Account": receiver_wallet.address,
 | 
			
		||||
    "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
  }
 | 
			
		||||
  const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
  const auth_signed = receiver_wallet.sign(auth_prepared)
 | 
			
		||||
  results += `\n\nSending authorization...`
 | 
			
		||||
  resultsArea.value = results
 | 
			
		||||
  const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
  console.log(JSON.stringify(auth_result.result, null, 2))
 | 
			
		||||
  if (auth_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `Transaction succeeded`
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += 'Transaction failed: See JavaScript console for details.'
 | 
			
		||||
    resultsArea.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of MPTAuthorize()
 | 
			
		||||
</script>
 | 
			
		||||
<div>
 | 
			
		||||
<form>
 | 
			
		||||
    <link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
 | 
			
		||||
    <script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script> 
 | 
			
		||||
<!-- Required meta tags - - >
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 | 
			
		||||
    <div class="container">
 | 
			
		||||
      <div class="row">
 | 
			
		||||
        <div class="col align-self-start">
 | 
			
		||||
        <h4>MPT Sender</h4>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <b>1. Choose your preferred network.</b>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col align-self-center">
 | 
			
		||||
              <input type="radio" id="tn" name="server"
 | 
			
		||||
                  value="wss://s.altnet.rippletest.net:51233">
 | 
			
		||||
              <label for="tn">Testnet</label>
 | 
			
		||||
              <br/>
 | 
			
		||||
              <input type="radio" id="dn" name="server"
 | 
			
		||||
                  value="wss://s.devnet.rippletest.net:51233" checked>
 | 
			
		||||
              <label for="dn">Devnet</label>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <b>2. Get the holder (or issuer) account from its seed.<br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="holderSeedField">Holder Seed</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="holderSeedField" size="40"></input>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="holderAccountField">Holder Account</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="holderAccountField" size="40"></input>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <br/>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <button type="button" id="getHolderAccountFromSeedButton" class="btn btn-primary">Get Holder Account From Seed</button>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <b>3. Get a new receiver account or retrieve one from its seed.</b>
 | 
			
		||||
                  <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="receiverSeedField">Receiver Seed</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="receiverSeedField" size="40"></input>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <label for="receiverAccountField">Receiver Account</label>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="receiverAccountField" size="40"></input>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <button type="button" id="getReceiverAccountButton" class="btn btn-primary">Get New Receiver Account</button>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div class="col align-self-start">
 | 
			
		||||
              <button type="button" id="getReceiverFromSeedButton" class="btn btn-primary">Get Receiver Account From Seed</button>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col align-self-start">
 | 
			
		||||
            <b>4. Enter the <i>MPT Issuance ID</i>.</b>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
                <label for="mptIssuanceIDField">MPT Issuance ID</label>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
              <input type="text" id="mptIssuanceIDField" size="40"></input>
 | 
			
		||||
              <br/><br/>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col align-self-start">
 | 
			
		||||
            <b>5. Click <i>Authorize MPT</i> to authorize the MPT for the receiver.</b>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <button type="button" id="authorizeMPTButton" class="btn btn-primary">Authorize MPT</button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <br/>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
          <div class="col align-self-start">
 | 
			
		||||
            <b>5. Enter the <i>Quantity</i> of MPTs to send.</b>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
                <label for="quantity">Quantity</label>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col align-self-start">
 | 
			
		||||
                <input type="text" id="quantityField" size="40"></input>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-align-items-left">
 | 
			
		||||
        <br/>
 | 
			
		||||
          <p><b>6. Click Send MPTs</b><br/>
 | 
			
		||||
             <button type="button" id="sendMPTButton" class="btn btn-primary">Send MPTs</button>
 | 
			
		||||
          </p>
 | 
			
		||||
          </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-align-self-start">
 | 
			
		||||
          <p><b>Results</b></p>
 | 
			
		||||
          <textarea class="form-control" id="resultsArea" rows="18" cols="40"></textarea>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
        <div class="col-align-self-start">
 | 
			
		||||
            <br/>
 | 
			
		||||
            <p><b>7. Click Get MPTs</b><br/>
 | 
			
		||||
            <button type = "button" id="getMPTsButton" class="btn btn-primary">Get MPTs</button>
 | 
			
		||||
          </p>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
</form>
 | 
			
		||||
</div>
 | 
			
		||||
<hr/>
 | 
			
		||||
 | 
			
		||||
==>
 | 
			
		||||
@@ -33,11 +33,7 @@
 | 
			
		||||
                - page: docs/use-cases/tokenization/authorized-minter.md
 | 
			
		||||
                - page: docs/use-cases/tokenization/digital-artist.md
 | 
			
		||||
            - page: docs/use-cases/tokenization/real-world-assets.page.tsx
 | 
			
		||||
            - page: docs/use-cases/tokenization/mpt-overview.md
 | 
			
		||||
              expanded: false
 | 
			
		||||
              items:
 | 
			
		||||
                - page: docs/use-cases/tokenization/creating-an-asset-backed-multi-purpose-token.md
 | 
			
		||||
                - page: docs/use-cases/tokenization/send-an-mpt.md
 | 
			
		||||
            - page: docs/use-cases/tokenization/creating-an-asset-backed-multi-purpose-token.md
 | 
			
		||||
        - page: docs/use-cases/defi/index.md
 | 
			
		||||
          expanded: false
 | 
			
		||||
          items:
 | 
			
		||||
@@ -193,6 +189,7 @@
 | 
			
		||||
                - page: docs/tutorials/javascript/send-payments/create-time-based-escrows.md
 | 
			
		||||
                - page: docs/tutorials/javascript/send-payments/create-conditional-escrows.md
 | 
			
		||||
                - page: docs/tutorials/javascript/send-payments/send-and-cash-checks.md
 | 
			
		||||
                - page: docs/tutorials/javascript/send-payments/sending-mpts.md
 | 
			
		||||
            - page: docs/tutorials/javascript/nfts/index.md
 | 
			
		||||
              expanded: false
 | 
			
		||||
              items:
 | 
			
		||||
 
 | 
			
		||||