Import
Signature
Build atomic transaction group for Exact AVM payment scheme. If extra.feePayer is present in the requirement: Creates a two-transaction atomic group:
  1. Transaction [0]: Fee payer self-payment of 0 ALGO with pooled flat fee equal to 2 * minFee (2,000 microALGO).
  2. Transaction [1]: Payer transfer of amount with flat fee of 0. Sets paymentIndex = 1 and signIndexes = [1].
If extra.feePayer is absent: Creates a single transaction where the payer pays the standard fee: Sets paymentIndex = 0 and signIndexes = [0]. Handles both native ALGO (asset ID “0”) and Algorand Standard Assets (ASAs).

Parameters

PaymentRequirements
required
Accepted payment requirement from the server.
string
required
Algorand address of the buyer/payer.
algosdk.SuggestedParams
required
Current suggested transaction parameters from algod.
SpendControls = {}
required
Spend controls checked before anything is built. Without maxAmount, amounts above {@link DEFAULT_MAX_AMOUNT} (1,000,000 base units) are refused.

Returns

BuildGroupResult
Object containing the transaction group, payment transaction index, and indexes requiring signature.

Throws

  • SpendLimitExceededError: If the amount is above the cap.
  • PaymentNotAllowedError: If the asset, network or recipient is not allowed.
  • NetworkMismatchError: If extra.genesisHash or extra.genesisId disagrees with suggestedParams.
  • InvalidPaymentRequiredError: If the amount, asset, payTo or feePayer is malformed.

Example

Source: src/index.ts