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 TypeMethodDescriptionGet BOC from cachecacheSet
(int ctxId, String boc, Boc.BocCacheType cacheType) Save BOC into cache or increase pin counter for existing pinned BOCstatic void
cacheUnpin
(int ctxId, String pin, String bocRef) Unpin BOCs with specified pin defined in the `cache_set`.decodeStateInit
(int ctxId, String stateInit, Boc.BocCacheType bocCache) Decodes contract's initial state into code, data, libraries and special options.Decodes tvc according to the tvc spec.encodeBoc
(int ctxId, Boc.BuilderOp[] builder, Boc.BocCacheType bocCache) Encodes bag of cells (BOC) with builder operations.encodeExternalInMessage
(int ctxId, String src, String dst, String init, String body, Boc.BocCacheType bocCache) Allows to encode any external inbound message.encodeStateInit
(int ctxId, 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
(int ctxId, String blockBoc) Extract blockchain configuration from key block and also from zerostate.getBocDepth
(int ctxId, String boc) Calculates BOC depthgetBocHash
(int ctxId, String boc) Calculates BOC root hashgetCodeFromTvc
(int ctxId, String tvc) Extracts code from TVC contract imagegetCodeSalt
(int ctxId, String code, Boc.BocCacheType bocCache) Returns the contract code's salt if it is present.getCompilerVersion
(int ctxId, String code) Returns the compiler version used to compile the code.static CompletableFuture
<Boc.ResultOfParse> parseAccount
(int ctxId, String boc) JSON structure is compatible with GraphQL API account object Parses account boc into a JSONstatic CompletableFuture
<Boc.ResultOfParse> parseBlock
(int ctxId, String boc) JSON structure is compatible with GraphQL API block object Parses block boc into a JSONstatic CompletableFuture
<Boc.ResultOfParse> parseMessage
(int ctxId, String boc) JSON structure is compatible with GraphQL API message object Parses message boc into a JSONstatic CompletableFuture
<Boc.ResultOfParse> parseShardstate
(int ctxId, String boc, String id, Long workchainId) JSON structure is compatible with GraphQL API shardstate object Parses shardstate boc into a JSONstatic CompletableFuture
<Boc.ResultOfParse> parseTransaction
(int ctxId, String boc) JSON structure is compatible with GraphQL API transaction object Parses transaction boc into a JSONsetCodeSalt
(int ctxId, String code, String salt, Boc.BocCacheType bocCache) Returns the new contract code with salt.
-
Constructor Details
-
Boc
public Boc()
-
-
Method Details
-
decodeTvc
public static CompletableFuture<Boc.ResultOfDecodeTvc> decodeTvc(int ctxId, 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 CompletableFuture<Boc.ResultOfParse> parseMessage(int ctxId, 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 CompletableFuture<Boc.ResultOfParse> parseTransaction(int ctxId, 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 CompletableFuture<Boc.ResultOfParse> parseAccount(int ctxId, 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
public static CompletableFuture<Boc.ResultOfParse> parseBlock(int ctxId, String boc) throws EverSdkException 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 CompletableFuture<Boc.ResultOfParse> parseShardstate(int ctxId, 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 CompletableFuture<Boc.ResultOfGetBlockchainConfig> getBlockchainConfig(int ctxId, 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 CompletableFuture<Boc.ResultOfGetBocHash> getBocHash(int ctxId, String boc) throws EverSdkException Calculates BOC root hash- Parameters:
boc
- BOC encoded as base64 or BOC handle- Throws:
EverSdkException
-
getBocDepth
public static CompletableFuture<Boc.ResultOfGetBocDepth> getBocDepth(int ctxId, String boc) throws EverSdkException Calculates BOC depth- Parameters:
boc
- BOC encoded as base64 or BOC handle- Throws:
EverSdkException
-
getCodeFromTvc
public static CompletableFuture<Boc.ResultOfGetCodeFromTvc> getCodeFromTvc(int ctxId, String tvc) throws EverSdkException Extracts code from TVC contract image- Parameters:
tvc
- Contract TVC image or image BOC handle- Throws:
EverSdkException
-
cacheGet
public static CompletableFuture<Boc.ResultOfBocCacheGet> cacheGet(int ctxId, String bocRef) throws EverSdkException Get BOC from cache- Parameters:
bocRef
- Reference to the cached BOC- Throws:
EverSdkException
-
cacheSet
public static CompletableFuture<Boc.ResultOfBocCacheSet> cacheSet(int ctxId, 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
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 CompletableFuture<Boc.ResultOfEncodeBoc> encodeBoc(int ctxId, 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 CompletableFuture<Boc.ResultOfGetCodeSalt> getCodeSalt(int ctxId, 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 CompletableFuture<Boc.ResultOfSetCodeSalt> setCodeSalt(int ctxId, 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 CompletableFuture<Boc.ResultOfDecodeStateInit> decodeStateInit(int ctxId, 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 CompletableFuture<Boc.ResultOfEncodeStateInit> encodeStateInit(int ctxId, 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 CompletableFuture<Boc.ResultOfEncodeExternalInMessage> encodeExternalInMessage(int ctxId, 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 CompletableFuture<Boc.ResultOfGetCompilerVersion> getCompilerVersion(int ctxId, 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
-