Options
All
  • Public
  • Public/Protected
  • All
Menu

xrpl

Index

Clients

Transaction Models

Transaction Flags

Utilities

Requests

Responses

Streams

Errors

Offline Signing

Other

Transaction Models

Transaction

Type for generic transaction.

Utilities

ISOTimeToRippleTime

  • ISOTimeToRippleTime(iso8601: string): number
  • Convert an Iso8601 timestmap to a ripple timestamp.

    Parameters

    • iso8601: string

      International standard date format.

    Returns number

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

computeAccountRootIndex

  • computeAccountRootIndex(address: string): string
  • Compute AccountRoot Ledger Object Index.

    All objects in a ledger's state tree have a unique Index. The AccountRoot Ledger Object Index is derived by hashing the address with a namespace identifier. This ensures every Index is unique.

    See Ledger Object Indexes.

    Parameters

    • address: string

      The classic account address.

    Returns string

    The Ledger Object Index for the account.

computeBinaryTransactionSigningHash

  • computeBinaryTransactionSigningHash(txBlobHex: string): string
  • Hash the given binary transaction data with the single-signing prefix.

    See Serialization Format.

    Parameters

    • txBlobHex: string

      The binary transaction blob as a hexadecimal string.

    Returns string

    The hash to sign.

computeEscrowHash

  • computeEscrowHash(address: string, sequence: number): string
  • Compute the Hash of an Escrow LedgerEntry.

    Parameters

    • address: string

      Address of the Escrow.

    • sequence: number

      OfferSequence of the Escrow.

    Returns string

    The hash of the Escrow LedgerEntry.

computeLedgerHash

  • computeLedgerHash(ledger: Ledger, options?: ComputeLedgerHeaderHashOptions): string
  • Compute the hash of a ledger.

    Parameters

    • ledger: Ledger

      Ledger to compute the hash for.

    • options: ComputeLedgerHeaderHashOptions = {}

      Allow client to recompute Transaction and State Hashes.

    Returns string

    The has of ledger.

computeLedgerHeaderHash

  • computeLedgerHeaderHash(ledgerHeader: Ledger): string
  • Compute the hash of a ledger.

    Parameters

    • ledgerHeader: Ledger

      Ledger to compute the hash of.

    Returns string

    The hash of the ledger.

computeOfferIndex

  • computeOfferIndex(address: string, sequence: number): string
  • The Index of a Offer object is the SHA-512Half of the following values, concatenated in order:

    • The Offer space key (0x006F)
    • The AccountID of the account placing the offer
    • The Sequence number of the OfferCreate transaction that created the offer.

    This method computes an Offer Index.

    Parameters

    • address: string

      The classic account address of the SignerList owner (starting with r).

    • sequence: number

      Sequence of the Offer.

    Returns string

    The Index of the account's Offer object.

computePaymentChannelHash

  • computePaymentChannelHash(address: string, dstAddress: string, sequence: number): string
  • Compute the hash of a Payment Channel.

    Parameters

    • address: string

      Account of the Payment Channel.

    • dstAddress: string

      Destination Account of the Payment Channel.

    • sequence: number

      Sequence number of the Transaction that created the Payment Channel.

    Returns string

    Hash of the Payment Channel.

computeSignedTransactionHash

  • computeSignedTransactionHash(tx: Transaction | string): string
  • Hashes the Transaction object as the ledger does. Throws if the transaction is unsigned.

    throws

    ValidationError if the Transaction is unsigned.

    Parameters

    • tx: Transaction | string

      A transaction to hash. Tx may be in binary blob form. Tx must be signed.

    Returns string

    A hash of tx.

computeSignerListIndex

  • computeSignerListIndex(address: string): string
  • The Index of a SignerList object is the SHA-512Half of the following values, concatenated in order:

    • The RippleState space key (0x0053)
    • The AccountID of the owner of the SignerList
    • The SignerListID (currently always 0).

    This method computes a SignerList Ledger Object Index.

    Parameters

    • address: string

      The classic account address of the SignerList owner (starting with r).

    Returns string

    The Index of the account's SignerList object.

computeStateTreeHash

  • computeStateTreeHash(entries: LedgerEntry[]): string
  • Compute the state hash of a list of LedgerEntries.

    Parameters

    • entries: LedgerEntry[]

      List of LedgerEntries.

    Returns string

    Hash of SHAMap that consists of all entries.

computeTransactionTreeHash

  • computeTransactionTreeHash(transactions: (Transaction & { metaData?: Metadata })[]): string
  • Compute the root hash of the SHAMap containing all transactions.

    Parameters

    • transactions: (Transaction & { metaData?: Metadata })[]

      List of Transactions.

    Returns string

    The root hash of the SHAMap.

computeTrustlineHash

  • computeTrustlineHash(address1: string, address2: string, currency: string): string
  • Compute the hash of a Trustline.

    Parameters

    • address1: string

      One of the addresses in the Trustline.

    • address2: string

      The other address in the Trustline.

    • currency: string

      Currency in the Trustline.

    Returns string

    The hash of the Trustline.

deriveXAddress

  • deriveXAddress(options: DeriveOptions): string
  • Derive an X-Address from a public key and a destination tag.

    Parameters

    • options: DeriveOptions

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

    Returns string

    X-Address.

dropsToXrp

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

    throws

    When drops amount is invalid.

    Parameters

    • dropsToConvert: BigNumber.Value

      Drops to convert to XRP.

    Returns string

    Amount in XRP.

generateXAddress

  • generateXAddress(options?: GenerateAddressOptions): GeneratedAddress
  • TODO: Move this function to be a static function of the Wallet Class. TODO: Doc this function.

    throws

    When cannot generate an address.

    Parameters

    • options: GenerateAddressOptions = {}

      Options for generating X-Address.

    Returns GeneratedAddress

    A generated address.

isValidSecret

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

rippleTimeToISOTime

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

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.

validate

  • 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

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

xrpToDrops

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

    throws

    When amount in xrp is invalid.

    Parameters

    • xrpToConvert: BigNumber.Value

      Amount in XRP.

    Returns string

    Amount in drops.

Requests

PathFindRequest

PathFindRequest: PathFindCreateRequest | PathFindCloseRequest | PathFindStatusRequest

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

Offline Signing

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.

multisign

  • multisign(transactions: (Transaction | string)[]): 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: (Transaction | string)[]

      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.

sign

  • Uses a wallet to cryptographically sign a transaction which proves the owner of the wallet is issuing this transaction.

    Parameters

    • wallet: Wallet

      A Wallet that holds your cryptographic keys.

    • tx: Transaction

      The Transaction that is being signed.

    • forMultisign: boolean = false

      If true, changes the signature format to encode for multisigning.

    Returns string

    A signed Transaction.

verifySignature

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

    Parameters

    • tx: Transaction | string

      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.

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

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

encodeAccountID

  • encodeAccountID(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

encodeAccountPublic

  • encodeAccountPublic(bytes: Buffer): string
  • Parameters

    • bytes: Buffer

    Returns string

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

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