Variable clauseBuilderConst

      clauseBuilder: {
          deployContract: ((contractBytecode, deployParams?) => TransactionClause);
          functionInteraction: ((contractAddress, functionFragment, args, value?) => TransactionClause);
          transferNFT: ((contractAddress, senderAddress, recipientAddress, tokenId) => TransactionClause);
          transferToken: ((tokenAddress, recipientAddress, amount) => TransactionClause);
          transferVET: ((recipientAddress, amount) => TransactionClause);
      } = ...

      clauseBuilder provides methods for building clauses for interacting with smart contracts or deploying smart contracts.

      Type declaration

      • deployContract: ((contractBytecode, deployParams?) => TransactionClause)
          • (contractBytecode, deployParams?): TransactionClause
          • Builds a clause for deploying a smart contract.

            Parameters

            • contractBytecode: string

              The bytecode of the smart contract to be deployed.

            • Optional deployParams: DeployParams

              The parameters to pass to the smart contract constructor.

            Returns TransactionClause

            A clause for deploying a smart contract.

      • functionInteraction: ((contractAddress, functionFragment, args, value?) => TransactionClause)
          • (contractAddress, functionFragment, args, value?): TransactionClause
          • Builds a clause for interacting with a smart contract function.

            Parameters

            • contractAddress: string

              The address of the smart contract.

            • functionFragment: core.vechain_sdk_core_ethers.FunctionFragment

              The function fragment to interact with.

            • args: unknown[]

              The input data for the function.

            • value: number = 0

              The amount of VET to send with the transaction.

            Returns TransactionClause

            A clause for interacting with a smart contract function.

            Throws

            Will throw an error if an error occurs while encoding the function input.

      • transferNFT: ((contractAddress, senderAddress, recipientAddress, tokenId) => TransactionClause)
          • (contractAddress, senderAddress, recipientAddress, tokenId): TransactionClause
          • Transfers a specified NFT (Non-Fungible Token) from one address to another.

            This function prepares a transaction clause for transferring an NFT, based on the ERC721 standard, by invoking a smart contract's 'transferFrom' method.

            Parameters

            • contractAddress: string

              The address of the NFT contract.

            • senderAddress: string

              The address of the current owner (sender) of the NFT.

            • recipientAddress: string

              The address of the new owner (recipient) of the NFT.

            • tokenId: string

              The unique identifier of the NFT to be transferred.

            Returns TransactionClause

            • An object representing the transaction clause required for the transfer.

            Throws

            .

      • transferToken: ((tokenAddress, recipientAddress, amount) => TransactionClause)
          • (tokenAddress, recipientAddress, amount): TransactionClause
          • Builds a clause for transferring VIP180 tokens.

            Parameters

            • tokenAddress: string

              The address of the VIP180 token.

            • recipientAddress: string

              The address of the recipient.

            • amount: string | number | bigint

              The amount of tokens to transfer in the decimals of the token. For instance, a token with 18 decimals, 1 token would be 1000000000000000000 (i.e., 10 ** 18).

            Returns TransactionClause

            A clause for transferring VIP180 tokens.

            Throws

            Will throw an error if the amount is not an integer or if the encoding of the function input fails.

      • transferVET: ((recipientAddress, amount) => TransactionClause)
          • (recipientAddress, amount): TransactionClause
          • Builds a clause for transferring VET.

            Parameters

            • recipientAddress: string

              The address of the recipient.

            • amount: string | number | bigint

              The amount of VET to transfer in wei.

            Returns TransactionClause

            A clause for transferring VET.

            Throws

            Will throw an error if the amount is not an integer.