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(SCVal scVal) static booleanfromBoolean(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_BOOLto boolean.static byte[]Convert fromSCValwith the type ofSCValType.SCV_BYTESto byte[].static SCContractInstancefromContractInstance(SCVal scVal) static BigIntegerfromDuration(SCVal scVal) static SCErrorstatic BigIntegerfromInt128(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I128to int128.static BigIntegerfromInt256(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_I256to int256.static intConvert fromSCValwith the type ofSCValType.SCV_I128to int32.static longConvert fromSCValwith the type ofSCValType.SCV_I64to int64.static voidParse fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE, this function returns void if conversion succeeds.static longfromLedgerKeyNonce(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCEto long.static LinkedHashMap<SCVal, SCVal> static byte[]fromString(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_STRINGto String.static StringfromSymbol(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_SYMBOLto String.static BigIntegerfromTimePoint(SCVal scVal) static BigIntegerfromUint128(SCVal scVal) static BigIntegerfromUint256(SCVal scVal) static longfromUint32(SCVal scVal) Convert fromSCValwith the type ofSCValType.SCV_U32to int.static BigIntegerfromUint64(SCVal scVal) static Collection<SCVal> static voidParse fromSCValwith the type ofSCValType.SCV_VOID, this function returns void if conversion succeeds.static SCValBuild aSCValwith the type ofSCValType.SCV_ADDRESS.static SCValBuild aSCValwith the type ofSCValType.SCV_ADDRESS.static SCValtoBoolean(boolean bool) Build aSCValwith the type ofSCValType.SCV_BOOL.static SCValtoBytes(byte[] bytes) Build aSCValwith the type ofSCValType.SCV_BYTES.static SCValtoContractInstance(SCContractInstance instance) Build aSCValwith the type ofSCValType.SCV_CONTRACT_INSTANCE.static SCValtoDuration(BigInteger duration) Build aSCValwith the type ofSCValType.SCV_DURATION.static SCValBuild aSCValwith the type ofSCValType.SCV_ERROR.static SCValtoInt128(BigInteger int128) Build aSCValwith the type ofSCValType.SCV_I128.static SCValtoInt256(BigInteger int256) Build aSCValwith the type ofSCValType.SCV_I256.static SCValtoInt32(int int32) Build aSCValwith the type ofSCValType.SCV_I128.static SCValtoInt64(long int64) Build aSCValwith the type ofSCValType.SCV_I64.static SCValBuild aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.static SCValtoLedgerKeyNonce(long nonce) Build aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.static SCValtoMap(LinkedHashMap<SCVal, SCVal> map) Build aSCValwith the type ofSCValType.SCV_MAP.static SCValtoString(byte[] string) Build aSCValwith the type ofSCValType.SCV_STRING.static SCValBuild aSCValwith the type ofSCValType.SCV_STRING.static SCValBuild aSCValwith the type ofSCValType.SCV_SYMBOL.static SCValtoTimePoint(BigInteger timePoint) Build aSCValwith the type ofSCValType.SCV_TIMEPOINT.static SCValtoUint128(BigInteger uint128) Build aSCValwith the type ofSCValType.SCV_U128.static SCValtoUint256(BigInteger uint256) Build aSCValwith the type ofSCValType.SCV_U256.static SCValtoUint32(long uint32) Build aSCValwith the type ofSCValType.SCV_U32.static SCValtoUint64(BigInteger uint64) Build aSCValwith the type ofSCValType.SCV_U64.static SCValtoVec(Collection<SCVal> vec) Build aSCValwith the type ofSCValType.SCV_VEC.static 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
Build aSCValwith the type ofSCValType.SCV_BOOL.- Parameters:
bool- boolean to convert- Returns:
SCValwith the type ofSCValType.SCV_BOOL
-
fromBoolean
Convert fromSCValwith the type ofSCValType.SCV_BOOLto boolean.- Parameters:
scVal-SCValto convert- Returns:
- boolean
-
toBytes
Build aSCValwith the type ofSCValType.SCV_BYTES.- Parameters:
bytes- bytes to convert- Returns:
SCValwith the type ofSCValType.SCV_BYTES
-
fromBytes
Convert fromSCValwith the type ofSCValType.SCV_BYTESto byte[].- Parameters:
scVal-SCValto convert- Returns:
- the bytes
-
toContractInstance
Build aSCValwith the type ofSCValType.SCV_CONTRACT_INSTANCE.- Parameters:
instance-SCContractInstanceto convert- Returns:
SCValwith the type ofSCValType.SCV_CONTRACT_INSTANCE
-
fromContractInstance
- 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
Build aSCValwith the type ofSCValType.SCV_ERROR.- Parameters:
error-SCErrorto convert- Returns:
SCValwith the type ofSCValType.SCV_ERROR
-
fromError
- Parameters:
scVal-SCValto convert- Returns:
- the error
-
toInt32
Build aSCValwith the type ofSCValType.SCV_I128.- Parameters:
int32- int32 to convert- Returns:
SCValwith the type ofSCValType.SCV_I128
-
fromInt32
Convert fromSCValwith the type ofSCValType.SCV_I128to int32.- Parameters:
scVal-SCValto convert- Returns:
- the int32
-
toInt64
Build aSCValwith the type ofSCValType.SCV_I64.- Parameters:
int64- int64 to convert- Returns:
SCValwith the type ofSCValType.SCV_I64
-
fromInt64
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
Build aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.- Returns:
SCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE
-
fromLedgerKeyContractInstance
Parse fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE, this function returns void if conversion succeeds.- Parameters:
scVal-SCValto convert
-
toLedgerKeyNonce
Build aSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE.- Parameters:
nonce- nonce to convert- Returns:
SCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCE
-
fromLedgerKeyNonce
Convert fromSCValwith the type ofSCValType.SCV_LEDGER_KEY_NONCEto long.- Parameters:
scVal-SCValto convert- Returns:
- the nonce
-
toMap
Build aSCValwith the type ofSCValType.SCV_MAP.- Parameters:
map- map to convert- Returns:
SCValwith the type ofSCValType.SCV_MAP
-
fromMap
- 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
Build aSCValwith the type ofSCValType.SCV_STRING.- Parameters:
string- string to convert- Returns:
SCValwith the type ofSCValType.SCV_STRING
-
fromString
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
Build aSCValwith the type ofSCValType.SCV_U32.- Parameters:
uint32- uint32 to convert- Returns:
SCValwith the type ofSCValType.SCV_U32
-
fromUint32
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
Build aSCValwith the type ofSCValType.SCV_VOID.- Returns:
SCValwith the type ofSCValType.SCV_VOID
-
fromVoid
Parse fromSCValwith the type ofSCValType.SCV_VOID, this function returns void if conversion succeeds.- Parameters:
scVal-SCValto convert
-