java.lang.Object
tech.deplant.java4ever.binding.Abi

public class Abi extends Object
  • Constructor Details

    • Abi

      public Abi()
  • Method Details

    • encodeMessageBody

      public static CompletableFuture<Abi.ResultOfEncodeMessageBody> encodeMessageBody(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, @NonNull @NonNull Abi.CallSet callSet, @NonNull @NonNull Boolean isInternal, @NonNull @NonNull Abi.Signer signer, Number processingTryIndex)
      Encodes message body according to ABI function call.
      Parameters:
      abi - Contract ABI.
      callSet - Function call parameters. Must be specified in non deploy message.

      In case of deploy message contains parameters of constructor.

      isInternal - True if internal message body must be encoded.
      signer - Signing parameters.
      processingTryIndex - Processing try index. Used in message processing with retries.

      Encoder uses the provided try index to calculate messageexpiration time.

      Expiration timeouts will grow with every retry.

      Default value is 0.

    • attachSignatureToMessageBody

      public static CompletableFuture<Abi.ResultOfAttachSignatureToMessageBody> attachSignatureToMessageBody(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, @NonNull @NonNull String publicKey, @NonNull @NonNull String message, @NonNull @NonNull String signature)
      Parameters:
      abi - Contract ABI
      publicKey - Public key. Must be encoded with `hex`.
      message - Unsigned message body BOC. Must be encoded with `base64`.
      signature - Signature. Must be encoded with `hex`.
    • encodeMessage

      public static CompletableFuture<Abi.ResultOfEncodeMessage> encodeMessage(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, String address, Abi.DeploySet deploySet, Abi.CallSet callSet, @NonNull @NonNull Abi.Signer signer, Number processingTryIndex)
      Encodes an ABI-compatible message
      Parameters:
      abi - Contract ABI.
      address - Target address the message will be sent to. Must be specified in case of non-deploy message.
      deploySet - Deploy parameters. Must be specified in case of deploy message.
      callSet - Function call parameters. Must be specified in case of non-deploy message.

      In case of deploy message it is optional and contains parametersof the functions that will to be called upon deploy transaction.

      signer - Signing parameters.
      processingTryIndex - Processing try index. Used in message processing with retries (if contract's ABI includes "expire" header).

      Encoder uses the provided try index to calculate messageexpiration time. The 1st message expiration time is specified inClient config.

      Expiration timeouts will grow with every retry.Retry grow factor is set in Client config:<.....add config parameter with default value here>

      Default value is 0.

    • encodeInternalMessage

      public static CompletableFuture<Abi.ResultOfEncodeInternalMessage> encodeInternalMessage(@NonNull @NonNull Context context, Abi.ABI abi, String address, String srcAddress, Abi.DeploySet deploySet, Abi.CallSet callSet, @NonNull @NonNull String value, Boolean bounce, Boolean enableIhr)
      Encodes an internal ABI-compatible message
      Parameters:
      abi - Contract ABI. Can be None if both deploy_set and call_set are None.
      address - Target address the message will be sent to. Must be specified in case of non-deploy message.
      srcAddress - Source address of the message.
      deploySet - Deploy parameters. Must be specified in case of deploy message.
      callSet - Function call parameters. Must be specified in case of non-deploy message.

      In case of deploy message it is optional and contains parametersof the functions that will to be called upon deploy transaction.

      value - Value in nanotokens to be sent with message.
      bounce - Flag of bounceable message. Default is true.
      enableIhr - Enable Instant Hypercube Routing for the message. Default is false.
    • attachSignature

      public static CompletableFuture<Abi.ResultOfAttachSignature> attachSignature(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, @NonNull @NonNull String publicKey, @NonNull @NonNull String message, @NonNull @NonNull String signature)
      Combines `hex`-encoded `signature` with `base64`-encoded `unsigned_message`. Returns signed message encoded in `base64`.
      Parameters:
      abi - Contract ABI
      publicKey - Public key encoded in `hex`.
      message - Unsigned message BOC encoded in `base64`.
      signature - Signature encoded in `hex`.
    • decodeMessage

      public static CompletableFuture<Abi.DecodedMessageBody> decodeMessage(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, @NonNull @NonNull String message)
      Decodes message body using provided message BOC and ABI.
      Parameters:
      abi - contract ABI
      message - Message BOC
    • decodeMessageBody

      public static CompletableFuture<Abi.DecodedMessageBody> decodeMessageBody(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, @NonNull @NonNull String body, @NonNull @NonNull Boolean isInternal)
      Decodes message body using provided body BOC and ABI.
      Parameters:
      abi - Contract ABI used to decode.
      body - Message body BOC encoded in `base64`.
      isInternal - True if the body belongs to the internal message.
    • encodeAccount

      public static CompletableFuture<Abi.ResultOfEncodeAccount> encodeAccount(@NonNull @NonNull Context context, @NonNull @NonNull Abi.StateInitSource stateInit, Long balance, Long lastTransLt, Number lastPaid, Boc.BocCacheType bocCache)
      Creates account state BOC
      Parameters:
      stateInit - Source of the account state init.
      balance - Initial balance.
      lastTransLt - Initial value for the `last_trans_lt`.
      lastPaid - Initial value for the `last_paid`.
      bocCache - Cache type to put the result. The BOC itself returned if no cache type provided
    • decodeAccountData

      public static CompletableFuture<Abi.ResultOfDecodeAccountData> decodeAccountData(@NonNull @NonNull Context context, @NonNull @NonNull Abi.ABI abi, @NonNull @NonNull String data)
      Decodes account data using provided data BOC and ABI.
      Parameters:
      abi - Contract ABI
      data - Data BOC or BOC handle
    • updateInitialData

      public static CompletableFuture<Abi.ResultOfUpdateInitialData> updateInitialData(@NonNull @NonNull Context context, Abi.ABI abi, @NonNull @NonNull String data, Map<String,Object> initialData, String initialPubkey, Boc.BocCacheType bocCache)
      Updates initial account data with initial values for the contract's static variables and owner's public key. This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.
      Parameters:
      abi - Contract ABI
      data - Data BOC or BOC handle
      initialData - List of initial values for contract's static variables. `abi` parameter should be provided to set initial data
      initialPubkey - Initial account owner's public key to set into account data
      bocCache - Cache type to put the result. The BOC itself returned if no cache type provided.
    • encodeInitialData

      public static CompletableFuture<Abi.ResultOfEncodeInitialData> encodeInitialData(@NonNull @NonNull Context context, Abi.ABI abi, Map<String,Object> initialData, String initialPubkey, Boc.BocCacheType bocCache)
      Encodes initial account data with initial values for the contract's static variables and owner's public key into a data BOC that can be passed to `encode_tvc` function afterwards.
      Parameters:
      abi - Contract ABI
      initialData - List of initial values for contract's static variables. `abi` parameter should be provided to set initial data
      initialPubkey - Initial account owner's public key to set into account data
      bocCache - Cache type to put the result. The BOC itself returned if no cache type provided.
    • decodeInitialData

      public static CompletableFuture<Abi.ResultOfDecodeInitialData> decodeInitialData(@NonNull @NonNull Context context, Abi.ABI abi, @NonNull @NonNull String data)
      Decodes initial values of a contract's static variables and owner's public key from account initial data This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.
      Parameters:
      abi - Contract ABI. Initial data is decoded if this parameter is provided
      data - Data BOC or BOC handle
    • decodeBoc

      public static CompletableFuture<Abi.ResultOfDecodeBoc> decodeBoc(@NonNull @NonNull Context context, @NonNull @NonNull Abi.AbiParam[] params, @NonNull @NonNull String boc, @NonNull @NonNull Boolean allowPartial)
      Decodes BOC into JSON as a set of provided parameters.
      Parameters:
      params - Parameters to decode from BOC
      boc - Data BOC or BOC handle
      allowPartial -