Options
All
  • Public
  • Public/Protected
  • All
Menu

xrpl

Index

Clients

Signing

Transaction Models

Transaction Flags

Utilities

Requests

Responses

Streams

Errors

Other

Signing

  • multisign(transactions: (string | Transaction)[]): string
  • Takes several transactions with Signer fields (in object or blob form) and creates a single transaction with all Signers that then gets signed and returned.

    throws

    ValidationError if:

    • There were no transactions given to sign
    • The SigningPubKey field is not the empty string in any given transaction
    • Any transaction is missing a Signers field.

    Parameters

    • transactions: (string | Transaction)[]

      An array of signed Transactions (in object or blob form) to combine into a single signed Transaction.

    Returns string

    A single signed Transaction which has all Signers from transactions within it.

Transaction Models

Utilities

hashes: { hashAccountRoot: (address: string) => string; hashEscrow: (address: string, sequence: number) => string; hashLedger: (ledger: Ledger, options?: { computeTreeHashes?: boolean }) => string; hashLedgerHeader: (ledgerHeader: Ledger) => string; hashOfferId: (address: string, sequence: number) => string; hashPaymentChannel: (address: string, dstAddress: string, sequence: number) => string; hashSignedTx: (tx: string | Transaction) => string; hashSignerListId: (address: string) => string; hashStateTree: (entries: LedgerEntry[]) => string; hashTrustline: (address1: string, address2: string, currency: string) => string; hashTx: (txBlobHex: string) => string; hashTxTree: (transactions: ((AccountDelete & { metaData?: TransactionMetadata }) & (AccountSet & { metaData?: TransactionMetadata }) & (CheckCancel & { metaData?: TransactionMetadata }) & (CheckCash & { metaData?: TransactionMetadata }) & (CheckCreate & { metaData?: TransactionMetadata }) & (DepositPreauth & { metaData?: TransactionMetadata }) & (EscrowCancel & { metaData?: TransactionMetadata }) & (EscrowCreate & { metaData?: TransactionMetadata }) & (EscrowFinish & { metaData?: TransactionMetadata }) & (NFTokenAcceptOffer & { metaData?: TransactionMetadata }) & (NFTokenBurn & { metaData?: TransactionMetadata }) & (NFTokenCancelOffer & { metaData?: TransactionMetadata }) & (NFTokenCreateOffer & { metaData?: TransactionMetadata }) & (NFTokenMint & { metaData?: TransactionMetadata }) & (OfferCancel & { metaData?: TransactionMetadata }) & (OfferCreate & { metaData?: TransactionMetadata }) & (Payment & { metaData?: TransactionMetadata }) & (PaymentChannelClaim & { metaData?: TransactionMetadata }) & (PaymentChannelCreate & { metaData?: TransactionMetadata }) & (PaymentChannelFund & { metaData?: TransactionMetadata }) & (SetRegularKey & { metaData?: TransactionMetadata }) & (SignerListSet & { metaData?: TransactionMetadata }) & (TicketCreate & { metaData?: TransactionMetadata }) & (TrustSet & { metaData?: TransactionMetadata }))[]) => string } = ...

Type declaration

  • authorizeChannel(wallet: Wallet, channelId: string, amount: string): string
  • Creates a signature that can be used to redeem a specific amount of XRP from a payment channel.

    Parameters

    • wallet: Wallet

      The account that will sign for this payment channel.

    • channelId: string

      An id for the payment channel to redeem XRP from.

    • amount: string

      The amount in drops to redeem.

    Returns string

    A signature that can be used to redeem a specific amount of XRP from a payment channel.

  • convertHexToString(hex: string, encoding?: BufferEncoding): string
  • Converts hex to its string equivalent. Useful to read the Domain field and some Memos.

    Parameters

    • hex: string

      The hex to convert to a string.

    • encoding: BufferEncoding = 'utf8'

      The encoding to use. Defaults to 'utf8' (UTF-8). 'ascii' is also allowed.

    Returns string

    The converted string.

  • convertStringToHex(string: string): string
  • createCrossChainPayment(payment: Payment, destAccount: string): Payment
  • Creates a cross-chain payment transaction.

    throws

    XrplError - if there are more than 2 memos.

    Parameters

    • payment: Payment

      The initial payment transaction. If the transaction is signed, then it will need to be re-signed. There must be no more than 2 memos, since one memo is used for the sidechain destination account. The destination must be the sidechain's door account.

    • destAccount: string

      the destination account on the sidechain.

    Returns Payment

    A cross-chain payment transaction, where the mainchain door account is the Destination and the destination account on the sidechain is encoded in the memos.

  • decimalToQuality(decimal: string): number
  • Converts a string decimal to the "billionths" format for use with QualityIn/ QualityOut

    throws

    ValidationError when the parameter is not convertible to "billionths" format.

    Parameters

    • decimal: string

      A string decimal (i.e. ".00034").

    Returns number

    A number in the "billionths" format.

  • decimalToTransferRate(decimal: string): number
  • Converts a string decimal to "billionths" format for use with TransferRate.

    throws

    ValidationError when the parameter is not convertible to "billionths" format.

    Parameters

    • decimal: string

      A string decimal between 0 and 1.00

    Returns number

    A number in the "billionths" format.

  • deriveXAddress(options: { publicKey: string; tag: number | false; test: boolean }): string
  • Derive an X-Address from a public key and a destination tag.

    Parameters

    • options: { publicKey: string; tag: number | false; test: boolean }

      Public key and destination tag to encode as an X-Address.

      • publicKey: string

        The public key corresponding to an address.

      • tag: number | false

        A destination tag to encode into an X-address. False indicates no destination tag.

      • test: boolean

        Whether this address is for use in Testnet.

    Returns string

    X-Address.

  • dropsToXrp(dropsToConvert: Value): string
  • Convert Drops to XRP.

    throws

    When drops amount is invalid.

    Parameters

    • dropsToConvert: Value

      Drops to convert to XRP. This can be a string, number, or BigNumber.

    Returns string

    Amount in XRP.

  • getBalanceChanges(metadata: TransactionMetadata): { account: string; balances: { currency: string; issuer?: string; value: string }[] }[]
  • Computes the complete list of every balance that changed in the ledger as a result of the given transaction.

    Parameters

    Returns { account: string; balances: { currency: string; issuer?: string; value: string }[] }[]

    Parsed balance changes.

  • hasNextPage(response: Response): boolean
  • isValidAddress(address: string): boolean
  • Validates that a given address is a valid X-Address or a valid classic address.

    Parameters

    • address: string

      Address to validate.

    Returns boolean

    True if address is a valid X-Address or classic address.

  • isValidSecret(secret: string): boolean
  • Check if a secret is valid.

    Parameters

    • secret: string

      Secret to test for validity.

    Returns boolean

    True if secret can be derived into a keypair.

  • isoTimeToRippleTime(iso8601: string | Date): number
  • Convert an ISO8601 timestmap to a ripple timestamp.

    Parameters

    • iso8601: string | Date

      International standard date format.

    Returns number

    Seconds since ripple epoch (1/1/2000 GMT).

  • percentToQuality(percent: string): number
  • Converts a string percent to the "billionths" format for use with QualityIn/ QualityOut

    throws

    ValidationError when the percent parameter is not convertible to "billionths" format.

    Parameters

    • percent: string

      A string percent (i.e. ".034%").

    Returns number

    A number in the "billionths" format.

  • percentToTransferRate(percent: string): number
  • Converts a string percent to "billionths" format for use with TransferRate.

    throws

    ValidationError when the percent parameter is not convertible to "billionths" format.

    Parameters

    • percent: string

      A string percent between 0% and 100%.

    Returns number

    A number in the "billionths" format.

  • qualityToDecimal(quality: number): string
  • Converts a quality in "billionths" format to a decimal.

    throws

    ValidationError when quality is not convertible to decimal format.

    Parameters

    • quality: number

      Quality to convert to decimal.

    Returns string

    decimal representation of quality.

  • rippleTimeToISOTime(rippleTime: number): string
  • Convert a ripple timestamp to an Iso8601 timestamp.

    Parameters

    • rippleTime: number

      Is the number of seconds since Ripple Epoch (1/1/2000 GMT).

    Returns string

    Iso8601 international standard date format.

  • rippleTimeToUnixTime(rpepoch: number): number
  • signPaymentChannelClaim(channel: string, amount: string, privateKey: string): string
  • Sign a payment channel claim.

    Parameters

    • channel: string

      Channel identifier specified by the paymentChannelClaim.

    • amount: string

      Amount specified by the paymentChannelClaim.

    • privateKey: string

      Private Key to sign paymentChannelClaim with.

    Returns string

    True if the channel is valid.

  • transferRateToDecimal(rate: number): string
  • Converts a transfer rate in "billionths" format to a decimal.

    throws

    ValidationError when it cannot convert from billionths format.

    Parameters

    • rate: number

      TransferRate to convert to decimal.

    Returns string

    decimal representation of transfer Rate.

  • unixTimeToRippleTime(timestamp: number): number
  • validate(transaction: Record<string, unknown>): void
  • Verifies various Transaction Types. Encode/decode and individual type validation.

    throws

    ValidationError When the Transaction is malformed.

    Parameters

    • transaction: Record<string, unknown>

      A Transaction.

    Returns void

  • verifyPaymentChannelClaim(channel: string, amount: string, signature: string, publicKey: string): boolean
  • Verify the signature of a payment channel claim.

    Parameters

    • channel: string

      Channel identifier specified by the paymentChannelClaim.

    • amount: string

      Amount specified by the paymentChannelClaim.

    • signature: string

      Signature produced from signing paymentChannelClaim.

    • publicKey: string

      Public key that signed the paymentChannelClaim.

    Returns boolean

    True if the channel is valid.

  • Verifies that the given transaction has a valid signature based on public-key encryption.

    Parameters

    • tx: string | Transaction

      A transaction to verify the signature of. (Can be in object or encoded string format).

    Returns boolean

    Returns true if tx has a valid signature, and returns false otherwise.

  • xrpToDrops(xrpToConvert: Value): string
  • Convert an amount in XRP to an amount in drops.

    throws

    When amount in xrp is invalid.

    Parameters

    • xrpToConvert: Value

      Amount in XRP.

    Returns string

    Amount in drops.

Requests

The path_find method searches for a path along which a transaction can possibly be made, and periodically sends updates when the path changes over time. For a simpler version that is supported by JSON-RPC, see the ripple_path_find method.

Responses

Streams

Other

deriveAddress: (publicKey: any) => string

Type declaration

    • (publicKey: any): string
    • Parameters

      • publicKey: any

      Returns string

deriveKeypair: (seed: string, options?: object) => { privateKey: string; publicKey: string }

Type declaration

    • (seed: string, options?: object): { privateKey: string; publicKey: string }
    • Parameters

      • seed: string
      • Optional options: object

      Returns { privateKey: string; publicKey: string }

      • privateKey: string
      • publicKey: string
  • classicAddressToXAddress(classicAddress: string, tag: number | false, test: boolean): string
  • Parameters

    • classicAddress: string
    • tag: number | false
    • test: boolean

    Returns string

  • decode(hex: string): Record<string, unknown>
  • Decodes a hex string into a transaction | ledger entry

    Parameters

    • hex: string

      hex string in the XRPL serialization format.

    Returns Record<string, unknown>

    The hex string decoded according to XRPL serialization format.

  • decodeAccountID(accountId: string): Buffer
  • Parameters

    • accountId: string

    Returns Buffer

  • decodeAccountPublic(base58string: string): Buffer
  • Parameters

    • base58string: string

    Returns Buffer

  • decodeNodePublic(base58string: string): Buffer
  • Parameters

    • base58string: string

    Returns Buffer

  • decodeSeed(seed: string, opts?: { expectedLength: number; versionTypes: ["ed25519", "secp256k1"]; versions: (number | number[])[] }): { bytes: Buffer; type: string | null; version: number[] }
  • Parameters

    • seed: string
    • Optional opts: { expectedLength: number; versionTypes: ["ed25519", "secp256k1"]; versions: (number | number[])[] }
      • expectedLength: number
      • versionTypes: ["ed25519", "secp256k1"]
      • versions: (number | number[])[]

    Returns { bytes: Buffer; type: string | null; version: number[] }

    • bytes: Buffer
    • type: string | null
    • version: number[]
  • decodeXAddress(xAddress: string): { accountId: Buffer; tag: number | false; test: boolean }
  • Parameters

    • xAddress: string

    Returns { accountId: Buffer; tag: number | false; test: boolean }

    • accountId: Buffer
    • tag: number | false
    • test: boolean
  • encodeAccountID(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

  • encodeAccountPublic(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

  • encodeForMultiSigning(object: Transaction, signer: string): string
  • Encodes a Transaction for multi-signing

    Parameters

    • object: Transaction

      Transaction in JSON format.

    • signer: string

      The address of the account signing this transaction

    Returns string

    A hex string representing the encoded object.

  • encodeNodePublic(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

  • encodeSeed(entropy: Buffer, type: "ed25519" | "secp256k1"): string
  • Parameters

    • entropy: Buffer
    • type: "ed25519" | "secp256k1"

    Returns string

  • encodeXAddress(accountId: Buffer, tag: number | false, test: boolean): string
  • Parameters

    • accountId: Buffer
    • tag: number | false
    • test: boolean

    Returns string

  • isValidClassicAddress(address: string): boolean
  • Parameters

    • address: string

    Returns boolean

  • isValidXAddress(xAddress: string): boolean
  • Parameters

    • xAddress: string

    Returns boolean

  • keyToRFC1751Mnemonic(hex_key: string): string
  • Generates a modified RFC1751 mnemonic in the same way rippled's wallet_propose does.

    Parameters

    • hex_key: string

      An encoded secret in hex format.

    Returns string

    A mnemonic following rippled's modified RFC1751 mnemonic standard.

  • parseNFTokenID(nftokenID: string): { Flags: number; Issuer: string; NFTokenID: string; Sequence: number; Taxon: number; TransferFee: number }
  • Parses an NFTokenID into the information it is encoding.

    Example decoding:

    000B 0539 C35B55AA096BA6D87A6E6C965A6534150DC56E5E 12C5D09E 0000000C +--- +--- +--------------------------------------- +------- +------- | | | | | | | | | ---> Sequence: 12 | | | | | | | ---> Scrambled Taxon: 314,953,886 | | | Unscrambled Taxon: 1337 | | | | | ---> Issuer: rJoxBSzpXhPtAuqFmqxQtGKjA13jUJWthE | | | ---> TransferFee: 1337.0 bps or 13.37% | `---> Flags: 11 -> lsfBurnable, lsfOnlyXRP and lsfTransferable

    throws

    XrplError when given an invalid nftokenID.

    Parameters

    • nftokenID: string

      A hex string which identifies an NFToken on the ledger.

    Returns { Flags: number; Issuer: string; NFTokenID: string; Sequence: number; Taxon: number; TransferFee: number }

    a decoded nftokenID with all fields encoded within.

    • Flags: number
    • Issuer: string
    • NFTokenID: string
    • Sequence: number
    • Taxon: number
    • TransferFee: number
  • rfc1751MnemonicToKey(english: string): Buffer
  • Converts an english mnemonic following rippled's modified RFC1751 standard to an encoded hex secret.

    throws

    Error if the parity after decoding does not match.

    Parameters

    • english: string

      A mnemonic generated using ripple's modified RFC1751 standard.

    Returns Buffer

    A Buffer containing an encoded secret.

  • xAddressToClassicAddress(xAddress: string): { classicAddress: string; tag: number | false; test: boolean }
  • Parameters

    • xAddress: string

    Returns { classicAddress: string; tag: number | false; test: boolean }

    • classicAddress: string
    • tag: number | false
    • test: boolean

Generated using TypeDoc