Basic VeChain signer with the private key. This signer can be initialized using a private key.

Hierarchy (view full)

Constructors

Properties

MESSAGE_PREFIX: Uint8Array<ArrayBufferLike> = ...

The provider attached to this Signer (if any).

Methods

  • Evaluates the //tx// by running it against the current Blockchain state. This cannot change state and has no cost, as it is effectively simulating execution.

    This can be used to have the Blockchain perform computations based on its state (e.g. running a Contract's getters) or to simulate the effect of a transaction before actually performing an operation.

    Parameters

    • transactionToEvaluate: TransactionRequestInput

      The transaction to evaluate

    • Optionalrevision: Revision

      The block number or block ID of which the transaction simulation is based on

    Returns Promise<string>

    the result of the evaluation

  • Gets the next nonce required for this Signer to send a transaction.

    Parameters

    • OptionalblockTag: string

      The blocktag to base the transaction count on, keep in mind many nodes do not honour this value and silently ignore it [default: "latest"]

      @NOTE: This method generates a random number as nonce. It is because the nonce in VeChain is a 6-byte number.

    Returns Promise<string>

  • Sends a transaction to the blockchain.

    Parameters

    • transactionToSend: TransactionRequestInput

      The transaction object to be sent. This includes all the necessary details such as to, value, data, gas, etc. Note: gasLimit is deprecated and will be removed in a future release. Use gas instead.

    Returns Promise<string>

    A promise that resolves to the transaction hash as a string once the transaction is successfully sent.

    Throws an error if the provider is not attached to the signer, indicating the signer's inability to send the transaction.

  • Signs an [[link-eip-191]] prefixed a personal message.

    Parameters

    • message: string | Uint8Array<ArrayBufferLike>

      The message to be signed. If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is not interpreted as a [[BytesLike]]; so the string "0x1234" is signed as six characters, not two bytes.

    Returns Promise<string>

    • A Promise that resolves to the signature as a string.