java.lang.Object
java.lang.Record
tech.deplant.java4ever.framework.Account
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaccType()Returns the value of theaccTyperecord component.balance()Returns the value of thebalancerecord component.boc()Returns the value of thebocrecord component.code()Returns the value of thecoderecord component.codeHash()Returns the value of thecodeHashrecord component.data()Returns the value of thedatarecord component.dataHash()Returns the value of thedataHashrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Returns the value of theinitCodeHashrecord component.isActive()Checks if accType field of account query equals to 1.longReturns the value of thelast_paidrecord component.static AccountFactory method to create Account object.ofAddressList(Sdk sdk, Address... addresses) Does the same as ofAddress() factory, but uses an array of addresses as "in" filter for GraphQL queryrunGetter(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.final StringtoString()Returns a string representation of this record class.tvmPubkey(Sdk sdk, ContractAbi abi) Method to extract pubkey from data field of account query.
-
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 aAccountrecord class.- Parameters:
id- the value for theidrecord componentaccType- the value for theaccTyperecord componentbalance- the value for thebalancerecord componentboc- the value for thebocrecord componentdata- the value for thedatarecord componentdataHash- the value for thedataHashrecord componentcode- the value for thecoderecord componentcodeHash- the value for thecodeHashrecord componentinitCodeHash- the value for theinitCodeHashrecord componentlast_paid- the value for thelast_paidrecord component
-
-
Method Details
-
ofAddress
public static Account ofAddress(Sdk sdk, Address 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 queryaddress- 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, Address... 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 queryaddresses- 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.EverSdkExceptionEncodes 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
-
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 extractionabi- of contract (needed to correctly find place of pubkey in the account data)- Returns:
- pubkey string
- Throws:
tech.deplant.java4ever.binding.EverSdkException
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
accType
public int accType()Returns the value of theaccTyperecord component.- Returns:
- the value of the
accTyperecord component
-
balance
Returns the value of thebalancerecord component.- Returns:
- the value of the
balancerecord component
-
boc
Returns the value of thebocrecord component.- Returns:
- the value of the
bocrecord component
-
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
dataHash
Returns the value of thedataHashrecord component.- Returns:
- the value of the
dataHashrecord component
-
code
Returns the value of thecoderecord component.- Returns:
- the value of the
coderecord component
-
codeHash
Returns the value of thecodeHashrecord component.- Returns:
- the value of the
codeHashrecord component
-
initCodeHash
Returns the value of theinitCodeHashrecord component.- Returns:
- the value of the
initCodeHashrecord component
-
last_paid
public long last_paid()Returns the value of thelast_paidrecord component.- Returns:
- the value of the
last_paidrecord component
-