xrpl
    Preparing search index...

    Function addPreFundedSponsor

    • Adds sponsor fields to a transaction for use with pre-funded sponsorships.

      This function is used when a Sponsorship ledger object already exists on-ledger with sufficient balance to cover the transaction. In this case, no sponsor signature is required - only the Sponsor and SponsorFlags fields are needed.

      Parameters

      • transaction: Transaction

        The transaction to add sponsor fields to.

      • sponsorAddress: string

        The address of the sponsor account (must match an existing Sponsorship object on the ledger).

      • sponsorFlags: number

        Flags indicating what the sponsor is paying for (spfSponsorFee = 0x00000001, spfSponsorReserve = 0x00000002).

      Returns Transaction

      A new transaction object with Sponsor and SponsorFlags fields added.

      If:

      • Sponsor and Account are the same (self-sponsorship not allowed)
      • SponsorFlags is missing or invalid
      import { SponsorFlags } from 'xrpl'

      const sponsoredTx = addPreFundedSponsor(
      payment,
      'rSponsorAddress123...',
      SponsorFlags.spfSponsorFee
      )