Class LogicSig

LogicSig implementation

LogicSig cannot sign transactions in all cases. Instead, use LogicSigAccount as a safe, general purpose signing mechanism. Since LogicSig does not track the provided signature's public key, LogicSig cannot sign transactions when delegated to a non-multisig account and the sender is not the delegating account.

Implements

Constructors

  • Parameters

    • program: Uint8Array
    • Optional programArgs: null | Uint8Array[]

    Returns LogicSig

Properties

args: Uint8Array[]
logic: Uint8Array
pqsig?: EncodedPQSig
sig?: Uint8Array
encodingSchema: NamedMapSchema = ...

Methods

  • Compute hash of the logic sig program (that is the same as escrow account address) as string address

    Returns Address

    String representation of the address

  • Parameters

    • secretKey: Uint8Array

      Secret key to sign with

    Returns void

    Deprecated

    Use appendToMultisigWithSigner instead

    Appends a signature to multi signature

  • Removes every delegation signature from this LogicSig, so that exactly one of them can be set afterwards.

    Returns void

  • Get the encoding Schema for this object, used to prepare the encoding data for msgpack and JSON.

    Returns Schema

  • Parameters

    • secretKey: Uint8Array

      Secret key to sign with

    • Optional msig: MultisigMetadata

      Multisig account as {version, threshold, addrs}

    Returns void

    Deprecated

    Use signWithSigner instead

    Creates signature (if no msig provided) or multi signature otherwise

  • Signs arbitrary data for use with the ed25519verify opcode from within this LogicSig's program.

    Parameters

    • signer: ProgramDataSigner

      The signer to sign the data with

    • data: Uint8Array

      The data to sign

    Returns Promise<Uint8Array>

  • Parameters

    • secretKey: Uint8Array

    Returns Uint8Array

    Deprecated

    Use signWithSigner followed by .sig instead

  • Parameters

    Returns Uint8Array

    Deprecated

    Use signWithSigner followed by .sig instead

  • Signs this LogicSig for delegation using the given signer.

    Parameters

    Returns Promise<Address>

    The address the signer signed as. When msig is omitted this is the delegating account. When msig is given it is the individual subsigner, not the multisig, so the delegating account is multisigAddress(msig). Either way it is an authorizing address, which is not necessarily the address a signer sends transactions from.

    Re-signing an already-signed LogicSig is allowed, and replaces the previous delegation signature. At most one of sig, msig, lmsig and pqsig may be set, so any signature left over from an earlier call is cleared.

  • Parameters

    Returns [sig: Uint8Array, index: number]

    Deprecated

    Use signWithSigner followed by .sig instead

  • Extract the encoding data for this object. This data, after being prepared by the encoding Schema, can be encoded to msgpack or JSON.

    Returns Map<string, unknown>

  • Parameters

    • publicKey: Uint8Array

      Verification key (derived from sender address or escrow address)

    Returns boolean

    Deprecated

    This function does not perform full verification and should not be fully trusted on its own. For example, it does not evaluate programs and does not have the ability to validate PQ signatures.

    Performs signature verification

Generated using TypeDoc