Package org.stellar.sdk.scval
Class Scv
java.lang.Object
org.stellar.sdk.scval.Scv
Provides a range of methods to help you build and parse
SCVal more conveniently.-
Method Summary
Modifier and TypeMethodDescriptionstatic AddressfromAddress(org.stellar.sdk.xdr.SCVal scVal) static booleanfromBoolean(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_BOOLto boolean.static byte[]fromBytes(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_BYTESto byte[].static org.stellar.sdk.xdr.SCContractInstancefromContractInstance(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_CONTRACT_INSTANCEtoSCContractInstance.static BigIntegerfromDuration(org.stellar.sdk.xdr.SCVal scVal) static org.stellar.sdk.xdr.SCErrorfromError(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_ERRORtoSCError.static BigIntegerfromInt128(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I128to int128.static BigIntegerfromInt256(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I256to int256.static intfromInt32(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I128to int32.static longfromInt64(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I64to int64.static voidfromLedgerKeyContractInstance(org.stellar.sdk.xdr.SCVal scVal) Parse fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE, this function returns void if conversion succeeds.static longfromLedgerKeyNonce(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCEto long.static LinkedHashMap<org.stellar.sdk.xdr.SCVal, org.stellar.sdk.xdr.SCVal> fromMap(org.stellar.sdk.xdr.SCVal scVal) static byte[]fromString(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_STRINGto String.static StringfromSymbol(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_SYMBOLto String.static BigIntegerfromTimePoint(org.stellar.sdk.xdr.SCVal scVal) static BigIntegerfromUint128(org.stellar.sdk.xdr.SCVal scVal) static BigIntegerfromUint256(org.stellar.sdk.xdr.SCVal scVal) static longfromUint32(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_U32to int.static BigIntegerfromUint64(org.stellar.sdk.xdr.SCVal scVal) static Collection<org.stellar.sdk.xdr.SCVal> fromVec(org.stellar.sdk.xdr.SCVal scVal) static voidfromVoid(org.stellar.sdk.xdr.SCVal scVal) Parse fromSCValwith the type ofSCValType.SCV_VOID, this function returns void if conversion succeeds.static org.stellar.sdk.xdr.SCValBuild aSCValwith the type ofSCValType.SCV_ADDRESS.static org.stellar.sdk.xdr.SCValBuild aSCValwith the type ofSCValType.SCV_ADDRESS.static org.stellar.sdk.xdr.SCValtoBoolean(boolean bool) Build aSCValwith the type ofSCValType.SCV_BOOL.static org.stellar.sdk.xdr.SCValtoBytes(byte[] bytes) Build aSCValwith the type ofSCValType.SCV_BYTES.static org.stellar.sdk.xdr.SCValtoContractInstance(org.stellar.sdk.xdr.SCContractInstance instance) Build aSCValwith the type ofSCValType.SCV_CONTRACT_INSTANCE.static org.stellar.sdk.xdr.SCValtoDuration(BigInteger duration) Build aSCValwith the type ofSCValType.SCV_DURATION.static org.stellar.sdk.xdr.SCValtoError(org.stellar.sdk.xdr.SCError error) Build aSCValwith the type ofSCValType.SCV_ERROR.static org.stellar.sdk.xdr.SCValtoInt128(BigInteger int128) Build aSCValwith the type ofSCValType.SCV_I128.static org.stellar.sdk.xdr.SCValtoInt256(BigInteger int256) Build aSCValwith the type ofSCValType.SCV_I256.static org.stellar.sdk.xdr.SCValtoInt32(int int32) Build aSCValwith the type ofSCValType.SCV_I128.static org.stellar.sdk.xdr.SCValtoInt64(long int64) Build aSCValwith the type ofSCValType.SCV_I64.static org.stellar.sdk.xdr.SCValBuild aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.static org.stellar.sdk.xdr.SCValtoLedgerKeyNonce(long nonce) Build aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.static org.stellar.sdk.xdr.SCValtoMap(LinkedHashMap<org.stellar.sdk.xdr.SCVal, org.stellar.sdk.xdr.SCVal> map) Build aSCValwith the type ofSCValType.SCV_MAP.static org.stellar.sdk.xdr.SCValtoString(byte[] string) Build aSCValwith the type ofSCValType.SCV_STRING.static org.stellar.sdk.xdr.SCValBuild aSCValwith the type ofSCValType.SCV_STRING.static org.stellar.sdk.xdr.SCValBuild aSCValwith the type ofSCValType.SCV_SYMBOL.static org.stellar.sdk.xdr.SCValtoTimePoint(BigInteger timePoint) Build aSCValwith the type ofSCValType.SCV_TIMEPOINT.static org.stellar.sdk.xdr.SCValtoUint128(BigInteger uint128) Build aSCValwith the type ofSCValType.SCV_U128.static org.stellar.sdk.xdr.SCValtoUint256(BigInteger uint256) Build aSCValwith the type ofSCValType.SCV_U256.static org.stellar.sdk.xdr.SCValtoUint32(long uint32) Build aSCValwith the type ofSCValType.SCV_U32.static org.stellar.sdk.xdr.SCValtoUint64(BigInteger uint64) Build aSCValwith the type ofSCValType.SCV_U64.static org.stellar.sdk.xdr.SCValtoVec(Collection<org.stellar.sdk.xdr.SCVal> vec) Build aSCValwith the type ofSCValType.SCV_VEC.static org.stellar.sdk.xdr.SCValtoVoid()Build aSCValwith the type ofSCValType.SCV_VOID.
-
Method Details
-
toAddress
Build aSCValwith the type ofSCValType.SCV_ADDRESS.- Parameters:
address- address to convert- Returns:
SCValwith the type ofSCValType.SCV_ADDRESS
-
toAddress
Build aSCValwith the type ofSCValType.SCV_ADDRESS.- Parameters:
address- address to convert- Returns:
SCValwith the type ofSCValType.SCV_ADDRESS
-
fromAddress
- Parameters:
scVal-SCValto convert- Returns:
- the address
-
toBoolean
public static org.stellar.sdk.xdr.SCVal toBoolean(boolean bool) Build aSCValwith the type ofSCValType.SCV_BOOL.- Parameters:
bool- boolean to convert- Returns:
SCValwith the type ofSCValType.SCV_BOOL
-
fromBoolean
public static boolean fromBoolean(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_BOOLto boolean.- Parameters:
scVal-SCValto convert- Returns:
- boolean
-
toBytes
public static org.stellar.sdk.xdr.SCVal toBytes(byte[] bytes) Build aSCValwith the type ofSCValType.SCV_BYTES.- Parameters:
bytes- bytes to convert- Returns:
SCValwith the type ofSCValType.SCV_BYTES
-
fromBytes
public static byte[] fromBytes(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_BYTESto byte[].- Parameters:
scVal-SCValto convert- Returns:
- the bytes
-
toContractInstance
public static org.stellar.sdk.xdr.SCVal toContractInstance(org.stellar.sdk.xdr.SCContractInstance instance) Build aSCValwith the type ofSCValType.SCV_CONTRACT_INSTANCE.- Parameters:
instance-SCContractInstanceto convert- Returns:
SCValwith the type ofSCValType.SCV_CONTRACT_INSTANCE
-
fromContractInstance
public static org.stellar.sdk.xdr.SCContractInstance fromContractInstance(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_CONTRACT_INSTANCEtoSCContractInstance.- Parameters:
scVal-SCValto convert- Returns:
- the contract instance
-
toDuration
Build aSCValwith the type ofSCValType.SCV_DURATION.- Parameters:
duration- duration to convert (uint64)- Returns:
SCValwith the type ofSCValType.SCV_DURATION
-
fromDuration
- Parameters:
scVal-SCValto convert- Returns:
- the duration (uint64)
-
toError
public static org.stellar.sdk.xdr.SCVal toError(org.stellar.sdk.xdr.SCError error) Build aSCValwith the type ofSCValType.SCV_ERROR.- Parameters:
error-SCErrorto convert- Returns:
SCValwith the type ofSCValType.SCV_ERROR
-
fromError
public static org.stellar.sdk.xdr.SCError fromError(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_ERRORtoSCError.- Parameters:
scVal-SCValto convert- Returns:
- the error
-
toInt32
public static org.stellar.sdk.xdr.SCVal toInt32(int int32) Build aSCValwith the type ofSCValType.SCV_I128.- Parameters:
int32- int32 to convert- Returns:
SCValwith the type ofSCValType.SCV_I128
-
fromInt32
public static int fromInt32(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I128to int32.- Parameters:
scVal-SCValto convert- Returns:
- the int32
-
toInt64
public static org.stellar.sdk.xdr.SCVal toInt64(long int64) Build aSCValwith the type ofSCValType.SCV_I64.- Parameters:
int64- int64 to convert- Returns:
SCValwith the type ofSCValType.SCV_I64
-
fromInt64
public static long fromInt64(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I64to int64.- Parameters:
scVal-SCValto convert- Returns:
- the int64
-
toInt128
Build aSCValwith the type ofSCValType.SCV_I128.- Parameters:
int128- int128 to convert- Returns:
SCValwith the type ofSCValType.SCV_I128
-
fromInt128
Convert fromSCValwith the type ofSCValType.SCV_I128to int128.- Parameters:
scVal-SCValto convert- Returns:
- the int128
-
toInt256
Build aSCValwith the type ofSCValType.SCV_I256.- Parameters:
int256- int256 to convert- Returns:
SCValwith the type ofSCValType.SCV_I256
-
fromInt256
Convert fromSCValwith the type ofSCValType.SCV_I256to int256.- Parameters:
scVal-SCValto convert- Returns:
- the int256
-
toLedgerKeyContractInstance
public static org.stellar.sdk.xdr.SCVal toLedgerKeyContractInstance()Build aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.- Returns:
SCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE
-
fromLedgerKeyContractInstance
public static void fromLedgerKeyContractInstance(org.stellar.sdk.xdr.SCVal scVal) Parse fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE, this function returns void if conversion succeeds.- Parameters:
scVal-SCValto convert
-
toLedgerKeyNonce
public static org.stellar.sdk.xdr.SCVal toLedgerKeyNonce(long nonce) Build aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.- Parameters:
nonce- nonce to convert- Returns:
SCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE
-
fromLedgerKeyNonce
public static long fromLedgerKeyNonce(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCEto long.- Parameters:
scVal-SCValto 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 aSCValwith the type ofSCValType.SCV_MAP.- Parameters:
map- map to convert- Returns:
SCValwith the type ofSCValType.SCV_MAP
-
fromMap
public static LinkedHashMap<org.stellar.sdk.xdr.SCVal,org.stellar.sdk.xdr.SCVal> fromMap(org.stellar.sdk.xdr.SCVal scVal) - Parameters:
scVal-SCValto convert- Returns:
- the map
-
toString
Build aSCValwith the type ofSCValType.SCV_STRING.- Parameters:
string- string to convert- Returns:
SCValwith the type ofSCValType.SCV_STRING
-
toString
public static org.stellar.sdk.xdr.SCVal toString(byte[] string) Build aSCValwith the type ofSCValType.SCV_STRING.- Parameters:
string- string to convert- Returns:
SCValwith the type ofSCValType.SCV_STRING
-
fromString
public static byte[] fromString(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_STRINGto String.- Parameters:
scVal-SCValto convert- Returns:
- the string value in bytes
-
toSymbol
Build aSCValwith the type ofSCValType.SCV_SYMBOL.- Parameters:
symbol- symbol to convert- Returns:
SCValwith the type ofSCValType.SCV_SYMBOL
-
fromSymbol
Convert fromSCValwith the type ofSCValType.SCV_SYMBOLto String.- Parameters:
scVal-SCValto convert- Returns:
- the symbol
-
toTimePoint
Build aSCValwith the type ofSCValType.SCV_TIMEPOINT.- Parameters:
timePoint- timePoint to convert (uint64)- Returns:
SCValwith the type ofSCValType.SCV_TIMEPOINT
-
fromTimePoint
- Parameters:
scVal-SCValto convert- Returns:
- the timePoint (uint64)
-
toUint32
public static org.stellar.sdk.xdr.SCVal toUint32(long uint32) Build aSCValwith the type ofSCValType.SCV_U32.- Parameters:
uint32- uint32 to convert- Returns:
SCValwith the type ofSCValType.SCV_U32
-
fromUint32
public static long fromUint32(org.stellar.sdk.xdr.SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_U32to int.- Parameters:
scVal-SCValto convert- Returns:
- the uint32
-
toUint64
Build aSCValwith the type ofSCValType.SCV_U64.- Parameters:
uint64- uint64 to convert- Returns:
SCValwith the type ofSCValType.SCV_U64
-
fromUint64
- Parameters:
scVal-SCValto convert- Returns:
- the uint64
-
toUint128
Build aSCValwith the type ofSCValType.SCV_U128.- Parameters:
uint128- uint128 to convert- Returns:
SCValwith the type ofSCValType.SCV_U128
-
fromUint128
- Parameters:
scVal-SCValto convert- Returns:
- the uint128
-
toUint256
Build aSCValwith the type ofSCValType.SCV_U256.- Parameters:
uint256- uint256 to convert- Returns:
SCValwith the type ofSCValType.SCV_U256
-
fromUint256
- Parameters:
scVal-SCValto convert- Returns:
- the uint256
-
toVec
Build aSCValwith the type ofSCValType.SCV_VEC.- Parameters:
vec- vec to convert- Returns:
SCValwith the type ofSCValType.SCV_VEC
-
fromVec
- Parameters:
scVal-SCValto convert- Returns:
- the vec
-
toVoid
public static org.stellar.sdk.xdr.SCVal toVoid()Build aSCValwith the type ofSCValType.SCV_VOID.- Returns:
SCValwith the type ofSCValType.SCV_VOID
-
fromVoid
public static void fromVoid(org.stellar.sdk.xdr.SCVal scVal) Parse fromSCValwith the type ofSCValType.SCV_VOID, this function returns void if conversion succeeds.- Parameters:
scVal-SCValto convert
-