From de3e2a9867fe0361c2509f4cbeb303fe5750bbb0 Mon Sep 17 00:00:00 2001 From: Elliot Lee Date: Fri, 17 Jan 2020 15:24:23 -0800 Subject: [PATCH] Docs: Fix whitespace Do not use newline-trimming ending tag Fix #1175 (bug introduced in #1153) --- docs/index.md | 67 +++++++++++++++++++++ docs/src/index.md.ejs | 134 +++++++++++++++++++++--------------------- 2 files changed, 134 insertions(+), 67 deletions(-) diff --git a/docs/index.md b/docs/index.md index 53d71d06..c8c63300 100644 --- a/docs/index.md +++ b/docs/index.md @@ -119,6 +119,7 @@ Using RippleAPI, you can: This page contains documentation for ripple-lib. To use ripple-lib with npm/yarn, begin with the [Getting Started](https://github.com/ripple/ripple-lib#getting-started) steps. **What is ripple-lib used for?** Here's a [list of applications that use `ripple-lib`](https://github.com/ripple/ripple-lib/blob/develop/APPLICATIONS.md). Open a PR to add your app or project to the list! + ## Boilerplate Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI. @@ -194,6 +195,7 @@ If you omit the `server` parameter, RippleAPI operates [offline](#offline-functi After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using the Node.js executable, typically named `node`: `node script.js` + ## Offline functionality RippleAPI can also function without internet connectivity. This can be useful in order to generate secrets and sign transactions from a secure, isolated machine. @@ -221,6 +223,7 @@ Methods that depend on the state of the XRP Ledger are unavailable in offline mo * [generateAddress](#generateaddress) * [generateXAddress](#generatexaddress) * [computeLedgerHash](#computeledgerhash) + # Basic Types ## Address @@ -292,6 +295,7 @@ Name | Type | Description currency | [currency](#currency) | The three-character code or hexadecimal string used to denote currencies, or "drops" for the smallest unit of XRP. counterparty | [address](#address) | *Optional* The XRP Ledger address of the account that owes or is owed the funds (omitted if `currency` is "XRP" or "drops") value | [value](#value) | *Optional* The quantity of the currency, denoted as a string to retain floating point precision + # Transaction Overview ## Transaction Types @@ -378,6 +382,7 @@ Name | Type | Description data | string | *Optional* Arbitrary string, conventionally containing the content of the memo. format | string | *Optional* Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted. type | string | *Optional* Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted. + # Transaction Specifications A *transaction specification* specifies what a transaction should do. Each [Transaction Type](#transaction-types) has its own type of specification. @@ -788,6 +793,7 @@ signature | string | *Optional* Signed claim authorizing withdrawal of XRP from } ``` + # rippled APIs ripple-lib relies on [rippled APIs](https://ripple.com/build/rippled-apis/) for online functionality. In addition to ripple-lib's own methods, you can also access rippled APIs through ripple-lib. Use the `request()`, `hasNextPage()`, and `requestNextPage()` methods: @@ -860,6 +866,7 @@ api.connect().then(() => { // Omit this if you are already connected The subscription ends when you unsubscribe or the WebSocket connection is closed. For full details, see [rippled Subscriptions](https://ripple.com/build/rippled-apis/#subscriptions). + ## request `request(command: string, options: object): Promise` @@ -913,6 +920,7 @@ return api.request('ledger', { } ``` + ## hasNextPage `hasNextPage(currentResponse): boolean` @@ -940,6 +948,7 @@ return api.request('ledger_data', { } }).catch(console.error); ``` + ## requestNextPage `requestNextPage(command: string, params: object = {}, currentResponse: object): Promise` @@ -970,7 +979,9 @@ return api.request(command, params).then(response => { }).catch(console.error); ``` + # Static Methods + ## renameCounterpartyToIssuer `renameCounterpartyToIssuer(issue: {currency: string, counterparty: address}): {currency: string, issuer: address}` @@ -1008,6 +1019,7 @@ console.log(RippleAPI.renameCounterpartyToIssuer(orderbookInfo.counter)) { currency: 'USD', issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' } { currency: 'BTC', issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' } ``` + ## formatBidsAndAsks `formatBidsAndAsks(orderbookInfo: {base: Issue, counter: Issue}, offers: BookOffer[]): orderbook` @@ -1286,7 +1298,9 @@ return Promise.all( } ``` + # API Methods + ## connect `connect(): Promise` @@ -1304,6 +1318,7 @@ This method returns a promise that resolves with a void value when a connection ### Example See [Boilerplate](#boilerplate) for code sample. + ## disconnect `disconnect(): Promise` @@ -1321,6 +1336,7 @@ This method returns a promise that resolves with a void value when a connection ### Example See [Boilerplate](#boilerplate) for code sample + ## isConnected `isConnected(): boolean` @@ -1344,6 +1360,7 @@ return api.isConnected(); ```json true ``` + ## getServerInfo `getServerInfo(): Promise` @@ -1417,6 +1434,7 @@ return api.getServerInfo().then(info => {/* ... */}); } ``` + ## getFee `getFee(): Promise` @@ -1444,6 +1462,7 @@ return api.getFee().then(fee => {/* ... */}); ```json "0.000012" ``` + ## getLedgerVersion `getLedgerVersion(): Promise` @@ -1470,6 +1489,7 @@ return api.getLedgerVersion().then(ledgerVersion => { 16869039 ``` + ## getTransaction `getTransaction(id: string, options: object): Promise` @@ -1621,6 +1641,7 @@ return api.getTransaction(id).then(transaction => { } ``` + ## getTransactions `getTransactions(address: string, options: object): Promise>` @@ -1854,6 +1875,7 @@ return api.getTransactions(address).then(transaction => { ] ``` + ## getTrustlines `getTrustlines(address: string, options: object): Promise>` @@ -1998,6 +2020,7 @@ return api.getTrustlines(address).then(trustlines => ] ``` + ## getBalances `getBalances(address: string, options: object): Promise>` @@ -2164,6 +2187,7 @@ return api.getBalances(address).then(balances => ] ``` + ## getBalanceSheet `getBalanceSheet(address: string, options: object): Promise` @@ -2259,6 +2283,7 @@ return api.getBalanceSheet(address).then(balanceSheet => } ``` + ## getPaths `getPaths(pathfind: object): Promise>` @@ -2379,6 +2404,7 @@ return api.getPaths(pathfind) ] ``` + ## getOrders `getOrders(address: string, options: object): Promise>` @@ -2759,6 +2785,7 @@ return api.getOrders(address).then(orders => ] ``` + ## getOrderbook `getOrderbook(address: string, orderbook: object, options: object): Promise` @@ -3864,6 +3891,7 @@ return api.getOrderbook(address, orderbook) } ``` + ## getSettings `getSettings(address: string, options: object): Promise` @@ -3946,6 +3974,7 @@ return api.getSettings(address).then(settings => } ``` + ## getAccountInfo `getAccountInfo(address: string, options: object): Promise` @@ -3994,6 +4023,7 @@ return api.getAccountInfo(address).then(info => } ``` + ## getAccountObjects `getAccountObjects(address: string, options: object): Promise` @@ -4318,6 +4348,7 @@ return api.getAccountObjects(address: address).then(objects => } ``` + ## getPaymentChannel `getPaymentChannel(id: string): Promise` @@ -4373,6 +4404,7 @@ return api.getPaymentChannel(channelId).then(channel => } ``` + ## getLedger `getLedger(options: object): Promise` @@ -4436,6 +4468,7 @@ return api.getLedger() } ``` + ## parseAccountFlags `parseAccountFlags(Flags: number): object` @@ -4471,6 +4504,7 @@ console.log(JSON.stringify(flags, null, 2)) "defaultRipple": false } ``` + ## prepareTransaction `prepareTransaction(transaction: object, instructions: object): Promise` @@ -4528,6 +4562,7 @@ async function preparedPreauth() { } } ``` + ## preparePayment `preparePayment(address: string, payment: object, instructions: object): Promise` @@ -4600,6 +4635,7 @@ return api.preparePayment(address, payment).then(prepared => { } ``` + ## prepareTrustline `prepareTrustline(address: string, trustline: object, instructions: object): Promise` @@ -4667,6 +4703,7 @@ return api.prepareTrustline(address, trustline).then(prepared => } ``` + ## prepareOrder `prepareOrder(address: string, order: object, instructions: object): Promise` @@ -4734,6 +4771,7 @@ return api.prepareOrder(address, order) } ``` + ## prepareOrderCancellation `prepareOrderCancellation(address: string, orderCancellation: object, instructions: object): Promise` @@ -4786,6 +4824,7 @@ return api.prepareOrderCancellation(address, orderCancellation) } ``` + ## prepareSettings `prepareSettings(address: string, settings: object, instructions: object): Promise` @@ -4849,6 +4888,7 @@ return api.prepareSettings(address, settings) } ``` + ## prepareEscrowCreation `prepareEscrowCreation(address: string, escrowCreation: object, instructions: object): Promise` @@ -4912,6 +4952,7 @@ return api.prepareEscrowCreation(address, escrowCreation).then(prepared => } ``` + ## prepareEscrowCancellation `prepareEscrowCancellation(address: string, escrowCancellation: object, instructions: object): Promise` @@ -4967,6 +5008,7 @@ return api.prepareEscrowCancellation(address, escrowCancellation).then(prepared } ``` + ## prepareEscrowExecution `prepareEscrowExecution(address: string, escrowExecution: object, instructions: object): Promise` @@ -5024,6 +5066,7 @@ return api.prepareEscrowExecution(address, escrowExecution).then(prepared => } ``` + ## preparePaymentChannelCreate `preparePaymentChannelCreate(address: string, paymentChannelCreate: object, instructions: object): Promise` @@ -5081,6 +5124,7 @@ return api.preparePaymentChannelCreate(address, paymentChannelCreate).then(prepa } ``` + ## preparePaymentChannelClaim `preparePaymentChannelClaim(address: string, paymentChannelClaim: object, instructions: object): Promise` @@ -5135,6 +5179,7 @@ return api.preparePaymentChannelClaim(address, paymentChannelClaim).then(prepare } ``` + ## preparePaymentChannelFund `preparePaymentChannelFund(address: string, paymentChannelFund: object, instructions: object): Promise` @@ -5190,6 +5235,7 @@ return api.preparePaymentChannelFund(address, paymentChannelFund).then(prepared } ``` + ## prepareCheckCreate `prepareCheckCreate(address: string, checkCreate: object, instructions: object): Promise` @@ -5248,6 +5294,7 @@ return api.prepareCheckCreate(address, checkCreate).then(prepared => } ``` + ## prepareCheckCancel `prepareCheckCancel(address: string, checkCancel: object, instructions: object): Promise` @@ -5302,6 +5349,7 @@ return api.prepareCheckCancel(address, checkCancel).then(prepared => } ``` + ## prepareCheckCash `prepareCheckCash(address: string, checkCash: object, instructions: object): Promise` @@ -5360,6 +5408,7 @@ return api.prepareCheckCash(address, checkCash).then(prepared => } ``` + ## sign ``` @@ -5501,6 +5550,7 @@ If any of `{signAs: some_address}` options were missing the code will return a v ``` [ValidationError(txJSON is not the same for all signedTransactions)] ``` + ## combine `combine(signedTransactions: Array): {signedTransaction: string, id: string}` @@ -5538,6 +5588,7 @@ return api.combine(signedTransactions); } ``` + ## submit `submit(signedTransaction: string): Promise` @@ -5600,6 +5651,7 @@ return api.submit(signedTransaction) } ``` + ## generateXAddress `generateXAddress(options?: object): {address: string, secret: string}` @@ -5639,6 +5691,7 @@ return api.generateAddress(); } ``` + ## generateAddress `generateAddress(options?: object): {address: string, secret: string}` @@ -5684,6 +5737,7 @@ return api.generateAddress(); } ``` + ## isValidAddress `isValidAddress(address: string): boolean` @@ -5703,6 +5757,7 @@ This method returns `true` if the address is valid and `false` if it is not. ```javascript return api.isValidAddress("address") ``` + ## isValidSecret `isValidSecret(secret: string): boolean` @@ -5722,6 +5777,7 @@ This method returns `true` if the secret is valid and `false` if it is not. ```javascript return api.isValidSecret("secret") ``` + ## deriveKeypair `deriveKeypair(seed: string): {privateKey: string, publicKey: string}` @@ -5743,6 +5799,7 @@ var keypair = api.deriveKeypair(seed) var public_key = keypair.publicKey; var private_key = keypair.privateKey; ``` + ## deriveAddress `deriveAddress(publicKey: string): string` @@ -5762,6 +5819,7 @@ This method returns a string corresponding to the address derived from the publi ```javascript var address = api.deriveAddress(public_key); ``` + ## signPaymentChannelClaim `signPaymentChannelClaim(channel: string, amount: string, privateKey: string): string` @@ -5800,6 +5858,7 @@ return api.signPaymentChannelClaim(channel, amount, privateKey); "3045022100B5C54654221F154347679B97AE7791CBEF5E6772A3F894F9C781B8F1B400F89F022021E466D29DC5AEB5DFAFC76E8A88D2E388EBD25A84143B6AC3B647F479CB89B7" ``` + ## verifyPaymentChannelClaim `verifyPaymentChannelClaim(channel: string, amount: string, signature: string, publicKey: string): boolean` @@ -5838,6 +5897,7 @@ return api.verifyPaymentChannelClaim(channel, amount, signature, publicKey); ```json true ``` + ## computeLedgerHash `computeLedgerHash(ledger: object): string` @@ -5893,6 +5953,7 @@ return api.computeLedgerHash(ledger); ```json "F4D865D83EB88C1A1911B9E90641919A1314F36E1B099F8E95FE3B7C77BE3349" ``` + ## xrpToDrops `xrpToDrops(xrp: string | BigNumber): string` @@ -5940,6 +6001,7 @@ return api.dropsToXrp('1'); ```json '0.000001' ``` + ## iso8601ToRippleTime `iso8601ToRippleTime(iso8601: string): number` @@ -5967,6 +6029,7 @@ api.iso8601ToRippleTime('2017-02-17T15:04:57Z'); ```json 540659097 ``` + ## rippleTimeToISO8601 `rippleTimeToISO8601(rippleTime: number): string` @@ -5994,6 +6057,7 @@ api.rippleTimeToISO8601(540659097); ```json '2017-02-17T15:04:57.000Z' ``` + ## txFlags `txFlags.TRANSACTION_TYPE.FLAG` @@ -6075,6 +6139,7 @@ The remaining transaction types do not have any flags at this time. * EscrowCancel * PaymentChannelCreate * PaymentChannelFund + ## schemaValidator Unlike the rest of the ripple-lib API, schemaValidator is a static object on RippleAPI. It provides utility methods that do not use a server. @@ -6110,6 +6175,7 @@ RippleAPI.schemaValidator.schemaValidate('sign', { ``` [ValidationError(instance.id does not match pattern "^[A-F0-9]{64}$")] ``` + # API Events ## ledger @@ -6214,3 +6280,4 @@ api.on('disconnected', (code) => { } }); ``` + diff --git a/docs/src/index.md.ejs b/docs/src/index.md.ejs index 021ea53d..46070865 100644 --- a/docs/src/index.md.ejs +++ b/docs/src/index.md.ejs @@ -1,69 +1,69 @@ -<%- include('introduction.md.ejs') -%> -<%- include('boilerplate.md.ejs') -%> -<%- include('offline.md.ejs') -%> -<%- include('basictypes.md.ejs') -%> -<%- include('transactions.md.ejs') -%> -<%- include('specifications.md.ejs') -%> -<%- include('rippledAPIs.md.ejs') -%> -<%- include('request.md.ejs') -%> -<%- include('hasNextPage.md.ejs') -%> -<%- include('requestNextPage.md.ejs') -%> +<%- include('introduction.md.ejs') %> +<%- include('boilerplate.md.ejs') %> +<%- include('offline.md.ejs') %> +<%- include('basictypes.md.ejs') %> +<%- include('transactions.md.ejs') %> +<%- include('specifications.md.ejs') %> +<%- include('rippledAPIs.md.ejs') %> +<%- include('request.md.ejs') %> +<%- include('hasNextPage.md.ejs') %> +<%- include('requestNextPage.md.ejs') %> -<%- include('staticMethods.md.ejs') -%> -<%- include('renameCounterpartyToIssuer.md.ejs') -%> -<%- include('formatBidsAndAsks.md.ejs') -%> +<%- include('staticMethods.md.ejs') %> +<%- include('renameCounterpartyToIssuer.md.ejs') %> +<%- include('formatBidsAndAsks.md.ejs') %> -<%- include('methods.md.ejs') -%> -<%- include('connect.md.ejs') -%> -<%- include('disconnect.md.ejs') -%> -<%- include('isConnected.md.ejs') -%> -<%- include('getServerInfo.md.ejs') -%> -<%- include('getFee.md.ejs') -%> -<%- include('getLedgerVersion.md.ejs') -%> -<%- include('getTransaction.md.ejs') -%> -<%- include('getTransactions.md.ejs') -%> -<%- include('getTrustlines.md.ejs') -%> -<%- include('getBalances.md.ejs') -%> -<%- include('getBalanceSheet.md.ejs') -%> -<%- include('getPaths.md.ejs') -%> -<%- include('getOrders.md.ejs') -%> -<%- include('getOrderbook.md.ejs') -%> -<%- include('getSettings.md.ejs') -%> -<%- include('getAccountInfo.md.ejs') -%> -<%- include('getAccountObjects.md.ejs') -%> -<%- include('getPaymentChannel.md.ejs') -%> -<%- include('getLedger.md.ejs') -%> -<%- include('parseAccountFlags.md.ejs') -%> -<%- include('prepareTransaction.md.ejs') -%> -<%- include('preparePayment.md.ejs') -%> -<%- include('prepareTrustline.md.ejs') -%> -<%- include('prepareOrder.md.ejs') -%> -<%- include('prepareOrderCancellation.md.ejs') -%> -<%- include('prepareSettings.md.ejs') -%> -<%- include('prepareEscrowCreation.md.ejs') -%> -<%- include('prepareEscrowCancellation.md.ejs') -%> -<%- include('prepareEscrowExecution.md.ejs') -%> -<%- include('preparePaymentChannelCreate.md.ejs') -%> -<%- include('preparePaymentChannelClaim.md.ejs') -%> -<%- include('preparePaymentChannelFund.md.ejs') -%> -<%- include('prepareCheckCreate.md.ejs') -%> -<%- include('prepareCheckCancel.md.ejs') -%> -<%- include('prepareCheckCash.md.ejs') -%> -<%- include('sign.md.ejs') -%> -<%- include('combine.md.ejs') -%> -<%- include('submit.md.ejs') -%> -<%- include('generateXAddress.md.ejs') -%> -<%- include('generateAddress.md.ejs') -%> -<%- include('isValidAddress.md.ejs') -%> -<%- include('isValidSecret.md.ejs') -%> -<%- include('deriveKeypair.md.ejs') -%> -<%- include('deriveAddress.md.ejs') -%> -<%- include('signPaymentChannelClaim.md.ejs') -%> -<%- include('verifyPaymentChannelClaim.md.ejs') -%> -<%- include('computeLedgerHash.md.ejs') -%> -<%- include('xrpToDropsAndDropsToXrp.md.ejs') -%> -<%- include('iso8601ToRippleTime.md.ejs') -%> -<%- include('rippleTimeToISO8601.md.ejs') -%> -<%- include('txFlags.md.ejs') -%> -<%- include('schemaValidator.md.ejs') -%> -<%- include('events.md.ejs') -%> +<%- include('methods.md.ejs') %> +<%- include('connect.md.ejs') %> +<%- include('disconnect.md.ejs') %> +<%- include('isConnected.md.ejs') %> +<%- include('getServerInfo.md.ejs') %> +<%- include('getFee.md.ejs') %> +<%- include('getLedgerVersion.md.ejs') %> +<%- include('getTransaction.md.ejs') %> +<%- include('getTransactions.md.ejs') %> +<%- include('getTrustlines.md.ejs') %> +<%- include('getBalances.md.ejs') %> +<%- include('getBalanceSheet.md.ejs') %> +<%- include('getPaths.md.ejs') %> +<%- include('getOrders.md.ejs') %> +<%- include('getOrderbook.md.ejs') %> +<%- include('getSettings.md.ejs') %> +<%- include('getAccountInfo.md.ejs') %> +<%- include('getAccountObjects.md.ejs') %> +<%- include('getPaymentChannel.md.ejs') %> +<%- include('getLedger.md.ejs') %> +<%- include('parseAccountFlags.md.ejs') %> +<%- include('prepareTransaction.md.ejs') %> +<%- include('preparePayment.md.ejs') %> +<%- include('prepareTrustline.md.ejs') %> +<%- include('prepareOrder.md.ejs') %> +<%- include('prepareOrderCancellation.md.ejs') %> +<%- include('prepareSettings.md.ejs') %> +<%- include('prepareEscrowCreation.md.ejs') %> +<%- include('prepareEscrowCancellation.md.ejs') %> +<%- include('prepareEscrowExecution.md.ejs') %> +<%- include('preparePaymentChannelCreate.md.ejs') %> +<%- include('preparePaymentChannelClaim.md.ejs') %> +<%- include('preparePaymentChannelFund.md.ejs') %> +<%- include('prepareCheckCreate.md.ejs') %> +<%- include('prepareCheckCancel.md.ejs') %> +<%- include('prepareCheckCash.md.ejs') %> +<%- include('sign.md.ejs') %> +<%- include('combine.md.ejs') %> +<%- include('submit.md.ejs') %> +<%- include('generateXAddress.md.ejs') %> +<%- include('generateAddress.md.ejs') %> +<%- include('isValidAddress.md.ejs') %> +<%- include('isValidSecret.md.ejs') %> +<%- include('deriveKeypair.md.ejs') %> +<%- include('deriveAddress.md.ejs') %> +<%- include('signPaymentChannelClaim.md.ejs') %> +<%- include('verifyPaymentChannelClaim.md.ejs') %> +<%- include('computeLedgerHash.md.ejs') %> +<%- include('xrpToDropsAndDropsToXrp.md.ejs') %> +<%- include('iso8601ToRippleTime.md.ejs') %> +<%- include('rippleTimeToISO8601.md.ejs') %> +<%- include('txFlags.md.ejs') %> +<%- include('schemaValidator.md.ejs') %> +<%- include('events.md.ejs') %>