Class Scv

java.lang.Object
org.stellar.sdk.scval.Scv

public class Scv extends Object
Provides a range of methods to help you build and parse SCVal more conveniently.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Address
    fromAddress(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_ADDRESS to Address.
    static boolean
    fromBoolean(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_BOOL to boolean.
    static byte[]
    fromBytes(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_BYTES to byte[].
    static org.stellar.sdk.xdr.SCContractInstance
    fromContractInstance(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_CONTRACT_INSTANCE to SCContractInstance.
    static BigInteger
    fromDuration(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_DURATION to BigInteger.
    static org.stellar.sdk.xdr.SCError
    fromError(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_ERROR to SCError.
    static BigInteger
    fromInt128(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_I128 to int128.
    static BigInteger
    fromInt256(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_I256 to int256.
    static int
    fromInt32(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_I128 to int32.
    static long
    fromInt64(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_I64 to int64.
    static void
    fromLedgerKeyContractInstance(org.stellar.sdk.xdr.SCVal scVal)
    Parse from SCVal with the type of SCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE, this function returns void if conversion succeeds.
    static long
    fromLedgerKeyNonce(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE to long.
    static LinkedHashMap<org.stellar.sdk.xdr.SCVal,org.stellar.sdk.xdr.SCVal>
    fromMap(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_MAP to Map.
    static byte[]
    fromString(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_STRING to String.
    static String
    fromSymbol(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_SYMBOL to String.
    static BigInteger
    fromTimePoint(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_TIMEPOINT to BigInteger.
    static BigInteger
    fromUint128(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_U128 to BigInteger.
    static BigInteger
    fromUint256(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_U256 to BigInteger.
    static long
    fromUint32(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_U32 to int.
    static BigInteger
    fromUint64(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_U64 to BigInteger.
    static Collection<org.stellar.sdk.xdr.SCVal>
    fromVec(org.stellar.sdk.xdr.SCVal scVal)
    Convert from SCVal with the type of SCValType.SCV_VEC to Collection.
    static void
    fromVoid(org.stellar.sdk.xdr.SCVal scVal)
    Parse from SCVal with the type of SCValType.SCV_VOID, this function returns void if conversion succeeds.
    static org.stellar.sdk.xdr.SCVal
    toAddress(String address)
    Build a SCVal with the type of SCValType.SCV_ADDRESS.
    static org.stellar.sdk.xdr.SCVal
    toAddress(Address address)
    Build a SCVal with the type of SCValType.SCV_ADDRESS.
    static org.stellar.sdk.xdr.SCVal
    toBoolean(boolean bool)
    Build a SCVal with the type of SCValType.SCV_BOOL.
    static org.stellar.sdk.xdr.SCVal
    toBytes(byte[] bytes)
    Build a SCVal with the type of SCValType.SCV_BYTES.
    static org.stellar.sdk.xdr.SCVal
    toContractInstance(org.stellar.sdk.xdr.SCContractInstance instance)
    Build a SCVal with the type of SCValType.SCV_CONTRACT_INSTANCE.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_DURATION.
    static org.stellar.sdk.xdr.SCVal
    toError(org.stellar.sdk.xdr.SCError error)
    Build a SCVal with the type of SCValType.SCV_ERROR.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_I128.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_I256.
    static org.stellar.sdk.xdr.SCVal
    toInt32(int int32)
    Build a SCVal with the type of SCValType.SCV_I128.
    static org.stellar.sdk.xdr.SCVal
    toInt64(long int64)
    Build a SCVal with the type of SCValType.SCV_I64.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE.
    static org.stellar.sdk.xdr.SCVal
    toLedgerKeyNonce(long nonce)
    Build a SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE.
    static org.stellar.sdk.xdr.SCVal
    toMap(LinkedHashMap<org.stellar.sdk.xdr.SCVal,org.stellar.sdk.xdr.SCVal> map)
    Build a SCVal with the type of SCValType.SCV_MAP.
    static org.stellar.sdk.xdr.SCVal
    toString(byte[] string)
    Build a SCVal with the type of SCValType.SCV_STRING.
    static org.stellar.sdk.xdr.SCVal
    toString(String string)
    Build a SCVal with the type of SCValType.SCV_STRING.
    static org.stellar.sdk.xdr.SCVal
    toSymbol(String symbol)
    Build a SCVal with the type of SCValType.SCV_SYMBOL.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_TIMEPOINT.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_U128.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_U256.
    static org.stellar.sdk.xdr.SCVal
    toUint32(long uint32)
    Build a SCVal with the type of SCValType.SCV_U32.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_U64.
    static org.stellar.sdk.xdr.SCVal
    toVec(Collection<org.stellar.sdk.xdr.SCVal> vec)
    Build a SCVal with the type of SCValType.SCV_VEC.
    static org.stellar.sdk.xdr.SCVal
    Build a SCVal with the type of SCValType.SCV_VOID.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • toAddress

      public static org.stellar.sdk.xdr.SCVal toAddress(String address)
      Build a SCVal with the type of SCValType.SCV_ADDRESS.
      Parameters:
      address - address to convert
      Returns:
      SCVal with the type of SCValType.SCV_ADDRESS
    • toAddress

      public static org.stellar.sdk.xdr.SCVal toAddress(Address address)
      Build a SCVal with the type of SCValType.SCV_ADDRESS.
      Parameters:
      address - address to convert
      Returns:
      SCVal with the type of SCValType.SCV_ADDRESS
    • fromAddress

      public static Address fromAddress(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_ADDRESS to Address.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the address
    • toBoolean

      public static org.stellar.sdk.xdr.SCVal toBoolean(boolean bool)
      Build a SCVal with the type of SCValType.SCV_BOOL.
      Parameters:
      bool - boolean to convert
      Returns:
      SCVal with the type of SCValType.SCV_BOOL
    • fromBoolean

      public static boolean fromBoolean(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_BOOL to boolean.
      Parameters:
      scVal - SCVal to convert
      Returns:
      boolean
    • toBytes

      public static org.stellar.sdk.xdr.SCVal toBytes(byte[] bytes)
      Build a SCVal with the type of SCValType.SCV_BYTES.
      Parameters:
      bytes - bytes to convert
      Returns:
      SCVal with the type of SCValType.SCV_BYTES
    • fromBytes

      public static byte[] fromBytes(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_BYTES to byte[].
      Parameters:
      scVal - SCVal to convert
      Returns:
      the bytes
    • toContractInstance

      public static org.stellar.sdk.xdr.SCVal toContractInstance(org.stellar.sdk.xdr.SCContractInstance instance)
      Build a SCVal with the type of SCValType.SCV_CONTRACT_INSTANCE.
      Parameters:
      instance - SCContractInstance to convert
      Returns:
      SCVal with the type of SCValType.SCV_CONTRACT_INSTANCE
    • fromContractInstance

      public static org.stellar.sdk.xdr.SCContractInstance fromContractInstance(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_CONTRACT_INSTANCE to SCContractInstance.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the contract instance
    • toDuration

      public static org.stellar.sdk.xdr.SCVal toDuration(BigInteger duration)
      Build a SCVal with the type of SCValType.SCV_DURATION.
      Parameters:
      duration - duration to convert (uint64)
      Returns:
      SCVal with the type of SCValType.SCV_DURATION
    • fromDuration

      public static BigInteger fromDuration(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_DURATION to BigInteger.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the duration (uint64)
    • toError

      public static org.stellar.sdk.xdr.SCVal toError(org.stellar.sdk.xdr.SCError error)
      Build a SCVal with the type of SCValType.SCV_ERROR.
      Parameters:
      error - SCError to convert
      Returns:
      SCVal with the type of SCValType.SCV_ERROR
    • fromError

      public static org.stellar.sdk.xdr.SCError fromError(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_ERROR to SCError.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the error
    • toInt32

      public static org.stellar.sdk.xdr.SCVal toInt32(int int32)
      Build a SCVal with the type of SCValType.SCV_I128.
      Parameters:
      int32 - int32 to convert
      Returns:
      SCVal with the type of SCValType.SCV_I128
    • fromInt32

      public static int fromInt32(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_I128 to int32.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the int32
    • toInt64

      public static org.stellar.sdk.xdr.SCVal toInt64(long int64)
      Build a SCVal with the type of SCValType.SCV_I64.
      Parameters:
      int64 - int64 to convert
      Returns:
      SCVal with the type of SCValType.SCV_I64
    • fromInt64

      public static long fromInt64(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_I64 to int64.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the int64
    • toInt128

      public static org.stellar.sdk.xdr.SCVal toInt128(BigInteger int128)
      Build a SCVal with the type of SCValType.SCV_I128.
      Parameters:
      int128 - int128 to convert
      Returns:
      SCVal with the type of SCValType.SCV_I128
    • fromInt128

      public static BigInteger fromInt128(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_I128 to int128.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the int128
    • toInt256

      public static org.stellar.sdk.xdr.SCVal toInt256(BigInteger int256)
      Build a SCVal with the type of SCValType.SCV_I256.
      Parameters:
      int256 - int256 to convert
      Returns:
      SCVal with the type of SCValType.SCV_I256
    • fromInt256

      public static BigInteger fromInt256(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_I256 to int256.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the int256
    • toLedgerKeyContractInstance

      public static org.stellar.sdk.xdr.SCVal toLedgerKeyContractInstance()
      Build a SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE.
      Returns:
      SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE
    • fromLedgerKeyContractInstance

      public static void fromLedgerKeyContractInstance(org.stellar.sdk.xdr.SCVal scVal)
      Parse from SCVal with the type of SCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE, this function returns void if conversion succeeds.
      Parameters:
      scVal - SCVal to convert
    • toLedgerKeyNonce

      public static org.stellar.sdk.xdr.SCVal toLedgerKeyNonce(long nonce)
      Build a SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE.
      Parameters:
      nonce - nonce to convert
      Returns:
      SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE
    • fromLedgerKeyNonce

      public static long fromLedgerKeyNonce(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_LEDGER_KEY_NONCE to long.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the nonce
    • toMap

      public static org.stellar.sdk.xdr.SCVal toMap(LinkedHashMap<org.stellar.sdk.xdr.SCVal,org.stellar.sdk.xdr.SCVal> map)
      Build a SCVal with the type of SCValType.SCV_MAP.
      Parameters:
      map - map to convert
      Returns:
      SCVal with the type of SCValType.SCV_MAP
    • fromMap

      public static LinkedHashMap<org.stellar.sdk.xdr.SCVal,org.stellar.sdk.xdr.SCVal> fromMap(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_MAP to Map.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the map
    • toString

      public static org.stellar.sdk.xdr.SCVal toString(String string)
      Build a SCVal with the type of SCValType.SCV_STRING.
      Parameters:
      string - string to convert
      Returns:
      SCVal with the type of SCValType.SCV_STRING
    • toString

      public static org.stellar.sdk.xdr.SCVal toString(byte[] string)
      Build a SCVal with the type of SCValType.SCV_STRING.
      Parameters:
      string - string to convert
      Returns:
      SCVal with the type of SCValType.SCV_STRING
    • fromString

      public static byte[] fromString(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_STRING to String.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the string value in bytes
    • toSymbol

      public static org.stellar.sdk.xdr.SCVal toSymbol(String symbol)
      Build a SCVal with the type of SCValType.SCV_SYMBOL.
      Parameters:
      symbol - symbol to convert
      Returns:
      SCVal with the type of SCValType.SCV_SYMBOL
    • fromSymbol

      public static String fromSymbol(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_SYMBOL to String.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the symbol
    • toTimePoint

      public static org.stellar.sdk.xdr.SCVal toTimePoint(BigInteger timePoint)
      Build a SCVal with the type of SCValType.SCV_TIMEPOINT.
      Parameters:
      timePoint - timePoint to convert (uint64)
      Returns:
      SCVal with the type of SCValType.SCV_TIMEPOINT
    • fromTimePoint

      public static BigInteger fromTimePoint(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_TIMEPOINT to BigInteger.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the timePoint (uint64)
    • toUint32

      public static org.stellar.sdk.xdr.SCVal toUint32(long uint32)
      Build a SCVal with the type of SCValType.SCV_U32.
      Parameters:
      uint32 - uint32 to convert
      Returns:
      SCVal with the type of SCValType.SCV_U32
    • fromUint32

      public static long fromUint32(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_U32 to int.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the uint32
    • toUint64

      public static org.stellar.sdk.xdr.SCVal toUint64(BigInteger uint64)
      Build a SCVal with the type of SCValType.SCV_U64.
      Parameters:
      uint64 - uint64 to convert
      Returns:
      SCVal with the type of SCValType.SCV_U64
    • fromUint64

      public static BigInteger fromUint64(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_U64 to BigInteger.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the uint64
    • toUint128

      public static org.stellar.sdk.xdr.SCVal toUint128(BigInteger uint128)
      Build a SCVal with the type of SCValType.SCV_U128.
      Parameters:
      uint128 - uint128 to convert
      Returns:
      SCVal with the type of SCValType.SCV_U128
    • fromUint128

      public static BigInteger fromUint128(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_U128 to BigInteger.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the uint128
    • toUint256

      public static org.stellar.sdk.xdr.SCVal toUint256(BigInteger uint256)
      Build a SCVal with the type of SCValType.SCV_U256.
      Parameters:
      uint256 - uint256 to convert
      Returns:
      SCVal with the type of SCValType.SCV_U256
    • fromUint256

      public static BigInteger fromUint256(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_U256 to BigInteger.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the uint256
    • toVec

      public static org.stellar.sdk.xdr.SCVal toVec(Collection<org.stellar.sdk.xdr.SCVal> vec)
      Build a SCVal with the type of SCValType.SCV_VEC.
      Parameters:
      vec - vec to convert
      Returns:
      SCVal with the type of SCValType.SCV_VEC
    • fromVec

      public static Collection<org.stellar.sdk.xdr.SCVal> fromVec(org.stellar.sdk.xdr.SCVal scVal)
      Convert from SCVal with the type of SCValType.SCV_VEC to Collection.
      Parameters:
      scVal - SCVal to convert
      Returns:
      the vec
    • toVoid

      public static org.stellar.sdk.xdr.SCVal toVoid()
      Build a SCVal with the type of SCValType.SCV_VOID.
      Returns:
      SCVal with the type of SCValType.SCV_VOID
    • fromVoid

      public static void fromVoid(org.stellar.sdk.xdr.SCVal scVal)
      Parse from SCVal with the type of SCValType.SCV_VOID, this function returns void if conversion succeeds.
      Parameters:
      scVal - SCVal to convert