java.lang.Object
tech.deplant.java4ever.binding.Boc
Boc
Contains methods of "boc" module of EVER-SDK API
BOC manipulation module.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static enum
static interface
Cell builder operation.static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static final record
static interface
static final record
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Boc.ResultOfBocCacheGet
cacheGet
(EverSdkContext ctx, String bocRef) Get BOC from cachestatic Boc.ResultOfBocCacheSet
cacheSet
(EverSdkContext ctx, String boc, Boc.BocCacheType cacheType) Save BOC into cache or increase pin counter for existing pinned BOCstatic void
cacheUnpin
(EverSdkContext ctx, String pin, String bocRef) Unpin BOCs with specified pin defined in the `cache_set`.static Boc.ResultOfDecodeStateInit
decodeStateInit
(EverSdkContext ctx, String stateInit, Boc.BocCacheType bocCache) Decodes contract's initial state into code, data, libraries and special options.static Boc.ResultOfDecodeTvc
decodeTvc
(EverSdkContext ctx, String tvc) Decodes tvc according to the tvc spec.static Boc.ResultOfEncodeBoc
encodeBoc
(EverSdkContext ctx, Boc.BuilderOp[] builder, Boc.BocCacheType bocCache) Encodes bag of cells (BOC) with builder operations.encodeExternalInMessage
(EverSdkContext ctx, String src, String dst, String init, String body, Boc.BocCacheType bocCache) Allows to encode any external inbound message.static Boc.ResultOfEncodeStateInit
encodeStateInit
(EverSdkContext ctx, String code, String data, String library, Boolean tick, Boolean tock, Long splitDepth, Boc.BocCacheType bocCache) Encodes initial contract state from code, data, libraries ans special options (see input params)getBlockchainConfig
(EverSdkContext ctx, String blockBoc) Extract blockchain configuration from key block and also from zerostate.static Boc.ResultOfGetBocDepth
getBocDepth
(EverSdkContext ctx, String boc) Calculates BOC depthstatic Boc.ResultOfGetBocHash
getBocHash
(EverSdkContext ctx, String boc) Calculates BOC root hashstatic Boc.ResultOfGetCodeFromTvc
getCodeFromTvc
(EverSdkContext ctx, String tvc) Extracts code from TVC contract imagestatic Boc.ResultOfGetCodeSalt
getCodeSalt
(EverSdkContext ctx, String code, Boc.BocCacheType bocCache) Returns the contract code's salt if it is present.getCompilerVersion
(EverSdkContext ctx, String code) Returns the compiler version used to compile the code.static Boc.ResultOfParse
parseAccount
(EverSdkContext ctx, String boc) JSON structure is compatible with GraphQL API account object Parses account boc into a JSONstatic Boc.ResultOfParse
parseBlock
(EverSdkContext ctx, String boc) JSON structure is compatible with GraphQL API block object Parses block boc into a JSONstatic Boc.ResultOfParse
parseMessage
(EverSdkContext ctx, String boc) JSON structure is compatible with GraphQL API message object Parses message boc into a JSONstatic Boc.ResultOfParse
parseShardstate
(EverSdkContext ctx, String boc, String id, Long workchainId) JSON structure is compatible with GraphQL API shardstate object Parses shardstate boc into a JSONstatic Boc.ResultOfParse
parseTransaction
(EverSdkContext ctx, String boc) JSON structure is compatible with GraphQL API transaction object Parses transaction boc into a JSONstatic Boc.ResultOfSetCodeSalt
setCodeSalt
(EverSdkContext ctx, String code, String salt, Boc.BocCacheType bocCache) Returns the new contract code with salt.
-
Constructor Details
-
Boc
public Boc()
-
-
Method Details
-
decodeTvc
public static Boc.ResultOfDecodeTvc decodeTvc(EverSdkContext ctx, String tvc) throws EverSdkException Decodes tvc according to the tvc spec. Read more about tvc structure here https://github.com/tonlabs/ever-struct/blob/main/src/scheme/mod.rs#L30- Parameters:
tvc
- Contract TVC BOC encoded as base64 or BOC handle- Throws:
EverSdkException
-
parseMessage
public static Boc.ResultOfParse parseMessage(EverSdkContext ctx, String boc) throws EverSdkException JSON structure is compatible with GraphQL API message object Parses message boc into a JSON- Parameters:
boc
- BOC encoded as base64- Throws:
EverSdkException
-
parseTransaction
public static Boc.ResultOfParse parseTransaction(EverSdkContext ctx, String boc) throws EverSdkException JSON structure is compatible with GraphQL API transaction object Parses transaction boc into a JSON- Parameters:
boc
- BOC encoded as base64- Throws:
EverSdkException
-
parseAccount
public static Boc.ResultOfParse parseAccount(EverSdkContext ctx, String boc) throws EverSdkException JSON structure is compatible with GraphQL API account object Parses account boc into a JSON- Parameters:
boc
- BOC encoded as base64- Throws:
EverSdkException
-
parseBlock
JSON structure is compatible with GraphQL API block object Parses block boc into a JSON- Parameters:
boc
- BOC encoded as base64- Throws:
EverSdkException
-
parseShardstate
public static Boc.ResultOfParse parseShardstate(EverSdkContext ctx, String boc, String id, Long workchainId) throws EverSdkException JSON structure is compatible with GraphQL API shardstate object Parses shardstate boc into a JSON- Parameters:
boc
- BOC encoded as base64id
- Shardstate identifierworkchainId
- Workchain shardstate belongs to- Throws:
EverSdkException
-
getBlockchainConfig
public static Boc.ResultOfGetBlockchainConfig getBlockchainConfig(EverSdkContext ctx, String blockBoc) throws EverSdkException Extract blockchain configuration from key block and also from zerostate.- Parameters:
blockBoc
- Key block BOC or zerostate BOC encoded as base64- Throws:
EverSdkException
-
getBocHash
public static Boc.ResultOfGetBocHash getBocHash(EverSdkContext ctx, String boc) throws EverSdkException Calculates BOC root hash- Parameters:
boc
- BOC encoded as base64 or BOC handle- Throws:
EverSdkException
-
getBocDepth
public static Boc.ResultOfGetBocDepth getBocDepth(EverSdkContext ctx, String boc) throws EverSdkException Calculates BOC depth- Parameters:
boc
- BOC encoded as base64 or BOC handle- Throws:
EverSdkException
-
getCodeFromTvc
public static Boc.ResultOfGetCodeFromTvc getCodeFromTvc(EverSdkContext ctx, String tvc) throws EverSdkException Extracts code from TVC contract image- Parameters:
tvc
- Contract TVC image or image BOC handle- Throws:
EverSdkException
-
cacheGet
public static Boc.ResultOfBocCacheGet cacheGet(EverSdkContext ctx, String bocRef) throws EverSdkException Get BOC from cache- Parameters:
bocRef
- Reference to the cached BOC- Throws:
EverSdkException
-
cacheSet
public static Boc.ResultOfBocCacheSet cacheSet(EverSdkContext ctx, String boc, Boc.BocCacheType cacheType) throws EverSdkException Save BOC into cache or increase pin counter for existing pinned BOC- Parameters:
boc
- BOC encoded as base64 or BOC referencecacheType
- Cache type- Throws:
EverSdkException
-
cacheUnpin
public static void cacheUnpin(EverSdkContext ctx, String pin, String bocRef) throws EverSdkException Unpin BOCs with specified pin defined in the `cache_set`. Decrease pin reference counter for BOCs with specified pin defined in the `cache_set`. BOCs which have only 1 pin and its reference counter become 0 will be removed from cache- Parameters:
pin
- Pinned namebocRef
- If it is provided then only referenced BOC is unpinned Reference to the cached BOC.- Throws:
EverSdkException
-
encodeBoc
public static Boc.ResultOfEncodeBoc encodeBoc(EverSdkContext ctx, Boc.BuilderOp[] builder, Boc.BocCacheType bocCache) throws EverSdkException Encodes bag of cells (BOC) with builder operations. This method provides the same functionality as Solidity TvmBuilder. Resulting BOC of this method can be passed into Solidity and C++ contracts as TvmCell type.- Parameters:
builder
- Cell builder operations.bocCache
- Cache type to put the result. The BOC itself returned if no cache type provided.- Throws:
EverSdkException
-
getCodeSalt
public static Boc.ResultOfGetCodeSalt getCodeSalt(EverSdkContext ctx, String code, Boc.BocCacheType bocCache) throws EverSdkException Returns the contract code's salt if it is present.- Parameters:
code
- Contract code BOC encoded as base64 or code BOC handlebocCache
- Cache type to put the result. The BOC itself returned if no cache type provided.- Throws:
EverSdkException
-
setCodeSalt
public static Boc.ResultOfSetCodeSalt setCodeSalt(EverSdkContext ctx, String code, String salt, Boc.BocCacheType bocCache) throws EverSdkException Returns the new contract code with salt. Sets new salt to contract code.- Parameters:
code
- Contract code BOC encoded as base64 or code BOC handlesalt
- BOC encoded as base64 or BOC handle Code salt to set.bocCache
- Cache type to put the result. The BOC itself returned if no cache type provided.- Throws:
EverSdkException
-
decodeStateInit
public static Boc.ResultOfDecodeStateInit decodeStateInit(EverSdkContext ctx, String stateInit, Boc.BocCacheType bocCache) throws EverSdkException Decodes contract's initial state into code, data, libraries and special options.- Parameters:
stateInit
- Contract StateInit image BOC encoded as base64 or BOC handlebocCache
- Cache type to put the result. The BOC itself returned if no cache type provided.- Throws:
EverSdkException
-
encodeStateInit
public static Boc.ResultOfEncodeStateInit encodeStateInit(EverSdkContext ctx, String code, String data, String library, Boolean tick, Boolean tock, Long splitDepth, Boc.BocCacheType bocCache) throws EverSdkException Encodes initial contract state from code, data, libraries ans special options (see input params)- Parameters:
code
- Contract code BOC encoded as base64 or BOC handledata
- Contract data BOC encoded as base64 or BOC handlelibrary
- Contract library BOC encoded as base64 or BOC handletick
- Specifies the contract ability to handle tick transactions `special.tick` field.tock
- Specifies the contract ability to handle tock transactions `special.tock` field.splitDepth
- Is present and non-zero only in instances of large smart contractsbocCache
- Cache type to put the result. The BOC itself returned if no cache type provided.- Throws:
EverSdkException
-
encodeExternalInMessage
public static Boc.ResultOfEncodeExternalInMessage encodeExternalInMessage(EverSdkContext ctx, String src, String dst, String init, String body, Boc.BocCacheType bocCache) throws EverSdkException Allows to encode any external inbound message. Encodes a message- Parameters:
src
- Source address.dst
- Destination address.init
- Bag of cells with state init (used in deploy messages).body
- Bag of cells with the message body encoded as base64.bocCache
- The BOC itself returned if no cache type provided Cache type to put the result.- Throws:
EverSdkException
-
getCompilerVersion
public static Boc.ResultOfGetCompilerVersion getCompilerVersion(EverSdkContext ctx, String code) throws EverSdkException Returns the compiler version used to compile the code.- Parameters:
code
- Contract code BOC encoded as base64 or code BOC handle- Throws:
EverSdkException
-