{"templateId":"markdown","sharedDataIds":{},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"XRPL JavaScript Code Sample Conventions","siteUrl":"https://xrpl.org/","llmstxt":{"hide":false,"title":"XRPL Developer Portal & Documentation","description":"Explore XRP Ledger documentation, blogs, and other blockchain developer resources needed to start building and integrating with the ledger.","details":{"content":"XRP Ledger concepts, use cases, tutorials, references, and other blockchain developer resources. Also, stay up to date with release announcements and more through the XRPL Blog."},"sections":[{"title":"Introduction","description":"A high-level introduction to the XRP Ledger.","includeFiles":["docs/introduction/**/*.*","about/faq.md"],"excludeFiles":["docs/introduction/index.md"]},{"title":"Use Cases","description":"Real-world applications and business scenarios for the XRP Ledger.","includeFiles":["docs/use-cases/**/*.*"],"excludeFiles":["docs/use-cases/index.md","docs/use-cases/defi/index.md"]},{"title":"Concepts","description":"Core concepts including accounts, tokens, transactions, consensus, and more.","includeFiles":["docs/concepts/**/*.*"],"excludeFiles":["docs/concepts/index.md","docs/concepts/decentralized-storage/index.md","docs/concepts/payment-types/index.md"]},{"title":"Tutorials","description":"Step-by-step guides for building on the XRP Ledger in JavaScript, Python, Go, and more.","includeFiles":["docs/tutorials/**/*.*"],"excludeFiles":[]},{"title":"References","description":"Protocol specification, transaction types, ledger entries, and API methods.","includeFiles":["docs/references/**/*.*"],"excludeFiles":["docs/references/xrp-api.md","docs/references/data-api.md","docs/references/protocol/index.md","docs/references/protocol/ledger-data/ledger-entry-types/index.md","docs/references/protocol/transactions/index.md","docs/references/protocol/transactions/types/index.md","docs/references/http-websocket-apis/api-conventions/index.md","docs/references/http-websocket-apis/public-api-methods/*/index.md","docs/references/http-websocket-apis/admin-api-methods/*/index.md"]},{"title":"Infrastructure","description":"Install, configure, and troubleshoot rippled and Clio servers.","includeFiles":["docs/infrastructure/**/*.*"],"excludeFiles":["docs/infrastructure/index.md","docs/infrastructure/*/index.md","docs/infrastructure/installation/build-run-rippled-in-reporting-mode.md","docs/infrastructure/configuration/data-retention/index.md","docs/infrastructure/configuration/server-modes/index.md"]},{"title":"Blog (2023+)","description":"Recent XRPL Blog posts (showing 2023 and newer).","includeFiles":["blog/2023/**/*.*","blog/2024/**/*.*","blog/2025/**/*.*","blog/2026/**/*.*"],"excludeFiles":[]},{"title":"Resources","description":"Developer resources and contribution guidelines.","includeFiles":["resources/**/*.*"],"excludeFiles":["resources/index.md"]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"xrpl-javascript-code-sample-conventions","__idx":0},"children":["XRPL JavaScript Code Sample Conventions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Code samples come in ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["two flavors"]}," with very different conventions. Identify which you're writing first."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Flavor"},"children":["Flavor"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Filename pattern"},"children":["Filename pattern"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Audience"},"children":["Audience"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Priority"},"children":["Priority"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tutorial"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<verb><Thing>.js"]}," (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createLoanBroker.js"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A dev reading & learning the protocol"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Clarity over speed"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Setup"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<topic>Setup.js"]}," (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lendingSetup.js"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A dev who never opens this file — runs to prep network data (accounts, tokens, etc.) for all tutorials in the subject folder"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Speed over clarity"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a file isn't clearly one or the other, prompt the user for clarity."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"style","__idx":1},"children":["Style"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"formatting","__idx":2},"children":["Formatting"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["2-space indent"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Single quotes"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["No semicolons"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"naming","__idx":3},"children":["Naming"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["File names: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["camelCase"]}," (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createLoan.js"]},")"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Variables: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["camelCase"]}," with acronyms uppercased — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loanBroker"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mptID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["vaultID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loanBrokerID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["credentialIssuer"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Transaction object keys: XRPL native PascalCase (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Account"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Amount"]},") — never transform them"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Setup JSON keys: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["camelCase"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loanBroker"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["credentialIssuer"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mptID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["vaultID"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["loanBrokerID"]},")"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"structure","__idx":4},"children":["Structure"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"folder-layout","__idx":5},"children":["Folder layout"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each code sample lives at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_code-samples/<topic>/js/"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"_code-samples/<topic>/js/\n├── README.md\n├── package.json\n├── package-lock.json\n├── <topic>Setup.js          # Optional — runs once to prep network state\n├── <topic>Setup.json        # Auto-generated by the setup script and is gitignored\n└── <verb><Thing>.js         # Tutorial scripts (one per user action)\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"readme","__idx":6},"children":["README"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["README.md"]}," is the entry point for a reader running the samples."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Title: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["# <Topic> Examples (JavaScript)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["One-sentence description listing what the directory demonstrates"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["## Setup"]}," section with a single ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npm i"]}," fenced block"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["One ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["##"]}," section per tutorial script, in the order a reader should run them:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Heading describes the action (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["## Create a Loan Broker"]},"), not the filename"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Fenced ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sh"]}," block with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["node <file>.js"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["One-sentence summary of what the script will output"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Fenced ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sh"]}," block showing actual expected console output (real addresses, tx IDs, JSON dumps — captured from a successful sample code run)"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":5},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["---"]}," separator between tutorial sections"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The expected-output blocks document the golden path. Update them when a script's output format changes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"packagejson","__idx":7},"children":["package.json"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Minimal — no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scripts"]},", no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["devDependencies"]},", no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["version"]}," unless an external dep requires one:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"name\": \"<topic>-examples\",\n  \"description\": \"Example code for <one-line summary>.\",\n  \"dependencies\": {\n    \"xrpl\": \"^<latest-stable>\"\n  },\n  \"type\": \"module\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"tutorial-files","__idx":8},"children":["Tutorial files"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"structure-1","__idx":9},"children":["Structure"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Multi-line ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["// IMPORTANT:"]}," header explaining what the script demonstrates and any preconditions (e.g., \"uses an existing account that has a PRIVATE vault\")"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Imports"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Connect to the network:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"// Connect to the network ----------------------\nconst client = new xrpl.Client('wss://s.devnet.rippletest.net:51233')\nawait client.connect()\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":4},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["(Optional) If the tutorial is using setup script data:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"// This step checks for the necessary setup data to run the lending tutorials.\n// If missing, lendingSetup.js will generate the data.\nif (!fs.existsSync('lendingSetup.json')) {\n  console.log(`\\n=== Lending tutorial data doesn't exist. Running setup script... ===\\n`)\n  execSync('node lendingSetup.js', { stdio: 'inherit' })\n}\n\n// Load preconfigured accounts and VaultID.\nconst setupData = JSON.parse(fs.readFileSync('lendingSetup.json', 'utf8'))\n\n// You can replace these values with your own\nconst loanBroker = xrpl.Wallet.fromSeed(setupData.loanBroker.seed)\nconst vaultID = setupData.vaultID\n\nconsole.log(`\\nLoan broker/vault owner address: ${loanBroker.address}`)\nconsole.log(`Vault ID: ${vaultID}`)\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":5},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["(Optional) If no setup data is used, fund new wallets for the tutorial."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"const { wallet } = await client.fundWallet()\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If creating multiple wallets, parallelize the process:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"const [\n  { wallet: loanBroker },\n  { wallet: borrower },\n  { wallet: depositor },\n  { wallet: credentialIssuer }\n] = await Promise.all([\n  client.fundWallet(),\n  client.fundWallet(),\n  client.fundWallet(),\n  client.fundWallet()\n])\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":6},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tutorial code steps."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Disconnect at the end of the code sample."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"await client.disconnect()\n","lang":"js"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"tutorial-code-step-guide","__idx":10},"children":["Tutorial code step guide"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Before each major step, add a comment and print a section banner."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Build transactions as plain object literals and validate before submitting:",{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"// Prepare LoanBrokerSet transaction ----------------------\nconsole.log(`\\n=== Preparing LoanBrokerSet transaction ===\\n`)\nconst loanBrokerSetTx = {\n  TransactionType: 'LoanBrokerSet',\n  Account: loanBroker.address,\n  VaultID: vaultID,\n  ManagementFeeRate: 1000\n}\n\n// Validate the transaction structure before submitting\nxrpl.validate(loanBrokerSetTx)\nconsole.log(JSON.stringify(loanBrokerSetTx, null, 2))\n","lang":"js"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Autofill transactions and handle results by checking for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tesSUCCESS"]}," and exiting on failure:",{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"// Submit, sign, and wait for validation ----------------------\nconsole.log(`\\n=== Submitting LoanBrokerSet transaction ===\\n`)\nconst submitResponse = await client.submitAndWait(loanBrokerSetTx, {\n  wallet: loanBroker,\n  autofill: true\n})\nif (submitResponse.result.meta.TransactionResult !== 'tesSUCCESS') {\n  const resultCode = submitResponse.result.meta.TransactionResult\n  console.error('Error: Unable to create loan broker:', resultCode)\n  await client.disconnect()\n  process.exit(1)\n}\nconsole.log('Loan broker created successfully!')\n","lang":"js"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Extract metadata relevant to the tutorial:",{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"// Extract loan broker information from the transaction result\nconsole.log(`\\n=== Loan Broker Information ===\\n`)\nconst loanBrokerNode = submitResponse.result.meta.AffectedNodes.find(node =>\n  node.CreatedNode?.LedgerEntryType === 'LoanBroker'\n)\nconsole.log(`LoanBroker ID: ${loanBrokerNode.CreatedNode.LedgerIndex}`)\nconsole.log(`LoanBroker Pseudo-Account Address: ${loanBrokerNode.CreatedNode.NewFields.Account}`)\n","lang":"js"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"setup-files","__idx":11},"children":["Setup files"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"speed-first-patterns-when-possible","__idx":12},"children":["Speed-first patterns when possible"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Run independent transactions concurrently with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["await Promise.all([...])"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When fanning out parallel transactions from the same account, batch them first via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TicketCreate"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TicketCount: N"]},", then pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Sequence: 0"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TicketSequence: ticketArr[i]"]}," on each parallel tx"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Destructure response arrays: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["const [{ wallet: loanBroker }, { wallet: borrower }] = await Promise.all([client.fundWallet(), client.fundWallet()])"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"setup-code-guide","__idx":13},"children":["Setup code guide"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Top comment: single line, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["// Setup script for <topic> tutorials"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Only output is a carriage-return progress indicator: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["process.stdout.write('Setting up tutorial: N/D\\r')"]}," between phases, where N is the step number and D is the total steps"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["No ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["=== Section ==="]}," banners, no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["xrpl.validate(tx)"]},", no transaction dumps — the user never sees this file's output beyond the progress counter"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Section comments in code are short: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["// Section description"]}," (no dash visual)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If a library call emits a warning the reader doesn't need (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["LoanSet"]}," autofill warning), silence it locally with a one-line comment explaining why: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["console.warn = () => {}"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"output-file","__idx":14},"children":["Output file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["At the end, write all data the tutorials will need:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"const setupData = {\n  description: 'This file is auto-generated by lendingSetup.js. It stores XRPL account info for use in lending protocol tutorials.',\n  loanBroker: {\n    address: loanBroker.address,\n    seed: loanBroker.seed\n  },\n  domainID,\n  mptID\n}\n\nfs.writeFileSync('lendingSetup.json', JSON.stringify(setupData, null, 2))\n","lang":"js"},"children":[]}]},"headings":[{"value":"XRPL JavaScript Code Sample Conventions","id":"xrpl-javascript-code-sample-conventions","depth":1},{"value":"Style","id":"style","depth":2},{"value":"Formatting","id":"formatting","depth":3},{"value":"Naming","id":"naming","depth":3},{"value":"Structure","id":"structure","depth":2},{"value":"Folder layout","id":"folder-layout","depth":3},{"value":"README","id":"readme","depth":3},{"value":"package.json","id":"packagejson","depth":3},{"value":"Tutorial files","id":"tutorial-files","depth":2},{"value":"Structure","id":"structure-1","depth":3},{"value":"Tutorial code step guide","id":"tutorial-code-step-guide","depth":3},{"value":"Setup files","id":"setup-files","depth":2},{"value":"Speed-first patterns when possible","id":"speed-first-patterns-when-possible","depth":3},{"value":"Setup code guide","id":"setup-code-guide","depth":3},{"value":"Output file","id":"output-file","depth":3}],"frontmatter":{"paths":["_code-samples/**/*.js"],"seo":{"title":"XRPL JavaScript Code Sample Conventions"}},"editPage":{"to":"https://github.com/XRPLF/xrpl-dev-portal/tree/master/.claude/rules/javascript-code-samples.md"},"lastModified":"2026-06-05T19:13:01.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/.claude/rules/javascript-code-samples","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}