Options
All
  • Public
  • Public/Protected
  • All
Menu

xrpl

Index

Clients

Signing

Transaction Models

Transaction Flags

Utilities

Requests

Responses

Streams

Errors

Other

Signing

multisign

  • 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

Transaction

Utilities

hashes

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 }) & (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

  • 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

  • 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

  • convertStringToHex(string: string): string

decimalToQuality

  • 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

  • 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

  • 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

  • dropsToXrp(dropsToConvert: Value): string

getBalanceChanges

  • getBalanceChanges(metadata: TransactionMetadata): { account: string; balances: { currency: string; issuer?: string; value: string }[] }[]

hasNextPage

  • hasNextPage(response: Response): boolean

isValidAddress

  • 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

  • isValidSecret(secret: string): boolean

isoTimeToRippleTime

  • isoTimeToRippleTime(iso8601: string | Date): number

percentToQuality

  • 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

  • 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

  • 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

  • rippleTimeToISOTime(rippleTime: number): string

rippleTimeToUnixTime

  • rippleTimeToUnixTime(rpepoch: number): number

signPaymentChannelClaim

  • 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

  • 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

  • unixTimeToRippleTime(timestamp: number): number

validate

  • validate(transaction: Record<string, unknown>): void

verifyPaymentChannelClaim

  • 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.

verifySignature

  • 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

  • xrpToDrops(xrpToConvert: Value): string

Requests

PathFindRequest

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.

Request

Responses

Response

Streams

Stream

Other

deriveKeypair

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

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

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

    Returns string

decode

  • 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

  • decodeAccountID(accountId: string): Buffer
  • Parameters

    • accountId: string

    Returns Buffer

decodeAccountPublic

  • decodeAccountPublic(base58string: string): Buffer
  • Parameters

    • base58string: string

    Returns Buffer

decodeNodePublic

  • decodeNodePublic(base58string: string): Buffer
  • Parameters

    • base58string: string

    Returns Buffer

decodeSeed

  • 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

  • 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

encode

encodeAccountID

  • encodeAccountID(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

encodeAccountPublic

  • encodeAccountPublic(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

encodeForMultiSigning

  • encodeForMultiSigning(object: Transaction, signer: string): string

encodeForSigning

encodeForSigningClaim

encodeNodePublic

  • encodeNodePublic(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

encodeSeed

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

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

    Returns string

encodeXAddress

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

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

    Returns string

isValidClassicAddress

  • isValidClassicAddress(address: string): boolean
  • Parameters

    • address: string

    Returns boolean

isValidXAddress

  • isValidXAddress(xAddress: string): boolean
  • Parameters

    • xAddress: string

    Returns boolean

parseAccountRootFlags

setTransactionFlagsToNumber

xAddressToClassicAddress

  • 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