navio-blsct
    Preparing search index...

    Class TxIn

    Represents a transaction input used to construct CTxIn in a confidential transaction.

    Examples:

    const { Scalar, ChildKey, OutPoint, SpendingKey, TokenId, CTxId, TxIn, CTX_ID_SIZE } = require('navio-blsct')
    const { randomBytes } = require('crypto')
    const cTxIdHex = randomBytes(CTX_ID_SIZE).toString('hex')
    const cTxId = CTxId.deserialize(cTxIdHex)
    const amount = 123
    const gamma = 100
    const s = Scalar.random()
    const ck = new ChildKey(s)
    const txk = ck.toTxKey()
    const spendingKey = txk.toSpendingKey()
    const tokenId = TokenId.default()
    const outPoint = OutPoint.generate(cTxId, 0)
    const txIn = TxIn.generate(amount, gamma, spendingKey, tokenId, outPoint)
    txIn.getAmount() // 123
    txIn.getGamma() // 100
    txIn.getSpendingKey()
    txIn.getTokenId()
    txIn.getOutPoint()
    txIn.getStakedCommitment() // false
    txIn.getRbf() // false
    const ser = txIn.serialize()
    const deser = TxIn.deserialize(ser)
    ser === deser.serialize() // true

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    obj: any
    objSize: number

    Methods

    • Returns a deep copy of the instance.

      Returns TxIn

      A new TxIn instance that is a deep copy of this instance.

    • Returns the amount of the transaction input.

      Returns number

      The amount of the transaction input.

    • Returns the gamma of the transaction input.

      Returns number

      The gamma of the transaction input.

    • Returns the outpoint associated with the transaction input.

      Returns OutPoint

      The outpoint associated with the transaction input.

    • Returns if the transaction input is replaceable by fee (RBF).

      Returns boolean

      true if the transaction input is RBF, otherwise false.

    • Returns the spending key associated with the transaction input.

      Returns SpendingKey

      The spending key associated with the transaction input.

    • Returns if the transaction input is a staked commitment.

      Returns boolean

      true if the transaction input is a staked commitment, otherwise false.

    • Returns the token ID associated with the transaction input.

      Returns TokenId

      The token ID associated with the transaction input.

    • Returns the underlying C++ object, transferring ownership from this instance to the caller.

      Returns any

      The underlying object of the instance.

    • Serializes the instance to a hexadecimal string.

      Returns string

      A hexadecimal string representation of the instance.

    • Returns the size of the underlying C++ object.

      Returns number

      The size of the underlying C++ object in bytes.

    • Returns a string representation of the instance.

      Returns string

      A string representation of the instance.

    • Returnsthe underlying C++ object.

      Returns any

      The underlying C++ object.

    • Deserializes a hexadecimal string into a TxIn instance.

      Parameters

      • this: new (obj: any) => TxIn
      • hex: string

        The hexadecimal string to deserialize.

      Returns TxIn

      A new TxIn instance.

    • Constucts a new instance using the provided object.

      Type Parameters

      Parameters

      • this: new (obj: any, objSize?: number) => T
      • obj: any

        The object to use for the new instance.

      Returns T

      A new instance of the class.

    • Constructs a new instance using the provided object and size.

      Type Parameters

      Parameters

      • this: new (obj: any) => T
      • obj: any

        The object to use for the new instance.

      • objSize: number

        The size of the object.

      Returns T

      A new instance of the class.

    • Constructs a new TxIn instance.

      Parameters

      • amount: number

        The amount of the input.

      • gamma: number

        The gamma of the input.

      • spendingKey: SpendingKey

        The spending key associated with the input.

      • tokenId: TokenId

        The token ID associated with the input.

      • outPoint: OutPoint

        The outpoint associated with the input.

      • isStakedCommitment: boolean = false

        Indicates if the commitment is staked (default: false).

      • isRbf: boolean = false

        Indicates if the transaction is replaceable by fee (default: false).

      Returns TxIn

      A new TxIn instance.