Record Class Account

java.lang.Object
java.lang.Record
tech.deplant.java4ever.framework.Account

public record Account(String id, int accType, String balance, String boc, String data, String dataHash, String code, String codeHash, String initCodeHash, long last_paid) extends Record
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Account(String id, int accType, String balance, String boc, String data, String dataHash, String code, String codeHash, String initCodeHash, long last_paid)
    Creates an instance of a Account record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the accType record component.
    Returns the value of the balance record component.
    boc()
    Returns the value of the boc record component.
    Returns the value of the code record component.
    Returns the value of the codeHash record component.
    Returns the value of the data record component.
    Returns the value of the dataHash record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    id()
    Returns the value of the id record component.
    Returns the value of the initCodeHash record component.
    Checks if accType field of account query equals to 1.
    long
    Returns the value of the last_paid record component.
    static Account
    ofAddress(Sdk sdk, String address)
    Factory method to create Account object.
    static List<Account>
    ofAddressList(Sdk sdk, String... addresses)
    Does the same as ofAddress() factory, but uses an array of addresses as "in" filter for GraphQL query
    runGetter(Sdk sdk, ContractAbi abi, String functionName, Map<String,Object> functionInputs, tech.deplant.java4ever.binding.Abi.FunctionHeader functionHeader, Credentials credentials)
    Encodes inputs and run getter method on account's boc then decodes answer.
    tech.deplant.java4ever.binding.Tvm.ResultOfRunExecutor
    runLocal(Sdk sdk, ContractAbi abi, String functionName, Map<String,Object> functionInputs, tech.deplant.java4ever.binding.Abi.FunctionHeader functionHeader, Credentials credentials, tech.deplant.java4ever.binding.Tvm.ExecutionOptions options)
    Encodes inputs and runs callExternal method on account's boc then decodes answer.
    final String
    Returns a string representation of this record class.
    Method to extract pubkey from data field of account query.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Account

      public Account(String id, int accType, String balance, String boc, String data, String dataHash, String code, String codeHash, String initCodeHash, long last_paid)
      Creates an instance of a Account record class.
      Parameters:
      id - the value for the id record component
      accType - the value for the accType record component
      balance - the value for the balance record component
      boc - the value for the boc record component
      data - the value for the data record component
      dataHash - the value for the dataHash record component
      code - the value for the code record component
      codeHash - the value for the codeHash record component
      initCodeHash - the value for the initCodeHash record component
      last_paid - the value for the last_paid record component
  • Method Details

    • ofAddress

      public static Account ofAddress(Sdk sdk, String address) throws tech.deplant.java4ever.binding.EverSdkException
      Factory method to create Account object. Makes a net.query_collection request to EVER-SDK (accounts collection query), then constructs Account object from the result. If query doesn't find account, method will construct empty Account object with accType=0 (not deployed).
      Parameters:
      sdk - that will be used for query
      address - of account
      Returns:
      GraphQL result with fields (id acc_type balance boc data data_hash code code_hash init_code_hash last_paid) as Account object
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • ofAddressList

      public static List<Account> ofAddressList(Sdk sdk, String... addresses) throws tech.deplant.java4ever.binding.EverSdkException
      Does the same as ofAddress() factory, but uses an array of addresses as "in" filter for GraphQL query
      Parameters:
      sdk - that will be used for query
      addresses - vararg/array of account addresses to check
      Returns:
      list of created Account objects
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • runGetter

      public Map<String,Object> runGetter(Sdk sdk, ContractAbi abi, String functionName, Map<String,Object> functionInputs, tech.deplant.java4ever.binding.Abi.FunctionHeader functionHeader, Credentials credentials) throws tech.deplant.java4ever.binding.EverSdkException
      Encodes inputs and run getter method on account's boc then decodes answer. Important! When you run getters here on Account directly, your local copy of account's boc can be older than real boc in blockchain. If you need to run getter on actual boc, you need to use OwnedContract.runGetter() method that downloads new account before running getter on it.
      Parameters:
      sdk -
      abi -
      functionName -
      functionInputs -
      functionHeader -
      credentials -
      Returns:
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • runLocal

      public tech.deplant.java4ever.binding.Tvm.ResultOfRunExecutor runLocal(Sdk sdk, ContractAbi abi, String functionName, Map<String,Object> functionInputs, tech.deplant.java4ever.binding.Abi.FunctionHeader functionHeader, Credentials credentials, tech.deplant.java4ever.binding.Tvm.ExecutionOptions options) throws tech.deplant.java4ever.binding.EverSdkException
      Encodes inputs and runs callExternal method on account's boc then decodes answer. Important! When you run callExternal locally, directly on Account boc, your blockchain real info remains unchanged. If you need to make a call to actual boc, you need to use OwnedContract.callExternal() method that sends transaction to blockchain.
      Parameters:
      sdk -
      abi -
      functionName -
      functionInputs -
      functionHeader -
      credentials -
      Returns:
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • isActive

      public Boolean isActive()
      Checks if accType field of account query equals to 1.
      Returns:
      true if account is active
    • tvmPubkey

      public String tvmPubkey(Sdk sdk, ContractAbi abi) throws tech.deplant.java4ever.binding.EverSdkException
      Method to extract pubkey from data field of account query.
      Parameters:
      sdk - that will be used for extraction
      abi - of contract (needed to correctly find place of pubkey in the account data)
      Returns:
      pubkey string
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • accType

      public int accType()
      Returns the value of the accType record component.
      Returns:
      the value of the accType record component
    • balance

      public String balance()
      Returns the value of the balance record component.
      Returns:
      the value of the balance record component
    • boc

      public String boc()
      Returns the value of the boc record component.
      Returns:
      the value of the boc record component
    • data

      public String data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • dataHash

      public String dataHash()
      Returns the value of the dataHash record component.
      Returns:
      the value of the dataHash record component
    • code

      public String code()
      Returns the value of the code record component.
      Returns:
      the value of the code record component
    • codeHash

      public String codeHash()
      Returns the value of the codeHash record component.
      Returns:
      the value of the codeHash record component
    • initCodeHash

      public String initCodeHash()
      Returns the value of the initCodeHash record component.
      Returns:
      the value of the initCodeHash record component
    • last_paid

      public long last_paid()
      Returns the value of the last_paid record component.
      Returns:
      the value of the last_paid record component