Components
Submitxdr

Submit XDR

The "Submit XDR" component submits an xdr envelope string to the Stellar network.

Features

  • Collects the xdr envelope string.
  • Upon Submission, The a success message is displayed.
  • Provides a straightforward way to submit an xdr string.

Additional Resources

Stellar uses a binary format called External Data Representation (XDR) to store and transmit ledger data, transactions, results, history, and messages. XDR is designed to be efficient for network communication but is not readable by humans.

To make XDR data more accessible, tools like Horizon and the Stellar SDKs are used to convert XDR into formats that are easier to understand and work with. These conversions help developers interact with Stellar's data and integrate it into applications more effectively.

C#

Install the Pakana.Stellar.Components NuGet package via the NuGet Package Manager Console.

.Net8.0 or greater is required.

dotnet add package Pakana.Stellar.Components
ℹ️

StellarSDK Dependency will install automatically

NuGet Package Implementation
<pakana.stellar.components.Pages.SubmitXdr/>
C#
@page "/SubmitXDR"
@rendermode InteractiveAuto
 
<h2>Submit Stellar XDR Transaction</h2>
<div>
    <textarea id="xdrInputanother" placeholder="Enter XDR string here" rows="4"cols="50"></textarea>
    <button onclick="submitXdrtwo()">Submit XDR</button>
    <p id="submissionResult"></p>
</div>
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/stellar-sdk/11.2.2/stellar-sdk.min.js"></script>
<script src="your-file-path/xdrSubmit.js"></script>

Javascript

We've provided simple HTML and JavaScript that can be used in your project as partial-components or be customized and integrated into your existing codebase.

Stellar CDN
*Current Version as of 2024-24-02*
<script src="https://cdnjs.cloudflare.com/ajax/libs/stellar-sdk/11.2.2/stellar-sdk.js"></script>
JavaScript
 
<script>
    function submitXdr() {
            const xdrString = document.getElementById('xdrInput').value;
    const serverUrl = 'https://horizon-testnet.stellar.org/transactions';
    fetch(serverUrl, {
        method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
                },
    body: 'tx=' + encodeURIComponent(xdrString)
            })
                .then(response => response.json())
                .then(data => {
        console.log('Transaction submitted:', data);
    document.getElementById('submissionResult').textContent =
    'Transaction submitted successfully!';
                })
                .catch(error => {
        console.error('Error submitting transaction:', error);
    document.getElementById('submissionResult').textContent =
    'Failed to submit transaction. Error: ' + error.message;
                });
        }
</script>
 
 
HTML
 
<body>
    <h2>Submit Stellar XDR Transaction</h2>
    <div>
        <textarea id="xdrInput" placeholder="Enter XDR string here" rows="4"
                  cols="50"></textarea>
        <button onclick="submitXdr()">Submit XDR</button>
        <p id="submissionResult"></p>
    </div>
</body>