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 Address
fromAddress
(SCVal scVal) static boolean
fromBoolean
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_BOOL
to boolean.static byte[]
Convert fromSCVal
with the type ofSCValType.SCV_BYTES
to byte[].static SCContractInstance
fromContractInstance
(SCVal scVal) static BigInteger
fromDuration
(SCVal scVal) static SCError
static BigInteger
fromInt128
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_I128
to int128.static BigInteger
fromInt256
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_I256
to int256.static int
Convert fromSCVal
with the type ofSCValType.SCV_I128
to int32.static long
Convert fromSCVal
with the type ofSCValType.SCV_I64
to int64.static void
Parse fromSCVal
with the type ofSCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE
, this function returns void if conversion succeeds.static long
fromLedgerKeyNonce
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
to long.static LinkedHashMap
<SCVal, SCVal> static byte[]
fromString
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_STRING
to String.static String
fromSymbol
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_SYMBOL
to String.static BigInteger
fromTimePoint
(SCVal scVal) static BigInteger
fromUint128
(SCVal scVal) static BigInteger
fromUint256
(SCVal scVal) static long
fromUint32
(SCVal scVal) Convert fromSCVal
with the type ofSCValType.SCV_U32
to int.static BigInteger
fromUint64
(SCVal scVal) static Collection
<SCVal> static void
Parse fromSCVal
with the type ofSCValType.SCV_VOID
, this function returns void if conversion succeeds.static SCVal
Build aSCVal
with the type ofSCValType.SCV_ADDRESS
.static SCVal
Build aSCVal
with the type ofSCValType.SCV_ADDRESS
.static SCVal
toBoolean
(boolean bool) Build aSCVal
with the type ofSCValType.SCV_BOOL
.static SCVal
toBytes
(byte[] bytes) Build aSCVal
with the type ofSCValType.SCV_BYTES
.static SCVal
toContractInstance
(SCContractInstance instance) Build aSCVal
with the type ofSCValType.SCV_CONTRACT_INSTANCE
.static SCVal
toDuration
(BigInteger duration) Build aSCVal
with the type ofSCValType.SCV_DURATION
.static SCVal
Build aSCVal
with the type ofSCValType.SCV_ERROR
.static SCVal
toInt128
(BigInteger int128) Build aSCVal
with the type ofSCValType.SCV_I128
.static SCVal
toInt256
(BigInteger int256) Build aSCVal
with the type ofSCValType.SCV_I256
.static SCVal
toInt32
(int int32) Build aSCVal
with the type ofSCValType.SCV_I128
.static SCVal
toInt64
(long int64) Build aSCVal
with the type ofSCValType.SCV_I64
.static SCVal
Build aSCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
.static SCVal
toLedgerKeyNonce
(long nonce) Build aSCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
.static SCVal
toMap
(LinkedHashMap<SCVal, SCVal> map) Build aSCVal
with the type ofSCValType.SCV_MAP
.static SCVal
toString
(byte[] string) Build aSCVal
with the type ofSCValType.SCV_STRING
.static SCVal
Build aSCVal
with the type ofSCValType.SCV_STRING
.static SCVal
Build aSCVal
with the type ofSCValType.SCV_SYMBOL
.static SCVal
toTimePoint
(BigInteger timePoint) Build aSCVal
with the type ofSCValType.SCV_TIMEPOINT
.static SCVal
toUint128
(BigInteger uint128) Build aSCVal
with the type ofSCValType.SCV_U128
.static SCVal
toUint256
(BigInteger uint256) Build aSCVal
with the type ofSCValType.SCV_U256
.static SCVal
toUint32
(long uint32) Build aSCVal
with the type ofSCValType.SCV_U32
.static SCVal
toUint64
(BigInteger uint64) Build aSCVal
with the type ofSCValType.SCV_U64
.static SCVal
toVec
(Collection<SCVal> vec) Build aSCVal
with the type ofSCValType.SCV_VEC
.static SCVal
toVoid()
Build aSCVal
with the type ofSCValType.SCV_VOID
.
-
Method Details
-
toAddress
Build aSCVal
with the type ofSCValType.SCV_ADDRESS
.- Parameters:
address
- address to convert- Returns:
SCVal
with the type ofSCValType.SCV_ADDRESS
-
toAddress
Build aSCVal
with the type ofSCValType.SCV_ADDRESS
.- Parameters:
address
- address to convert- Returns:
SCVal
with the type ofSCValType.SCV_ADDRESS
-
fromAddress
- Parameters:
scVal
-SCVal
to convert- Returns:
- the address
-
toBoolean
Build aSCVal
with the type ofSCValType.SCV_BOOL
.- Parameters:
bool
- boolean to convert- Returns:
SCVal
with the type ofSCValType.SCV_BOOL
-
fromBoolean
Convert fromSCVal
with the type ofSCValType.SCV_BOOL
to boolean.- Parameters:
scVal
-SCVal
to convert- Returns:
- boolean
-
toBytes
Build aSCVal
with the type ofSCValType.SCV_BYTES
.- Parameters:
bytes
- bytes to convert- Returns:
SCVal
with the type ofSCValType.SCV_BYTES
-
fromBytes
Convert fromSCVal
with the type ofSCValType.SCV_BYTES
to byte[].- Parameters:
scVal
-SCVal
to convert- Returns:
- the bytes
-
toContractInstance
Build aSCVal
with the type ofSCValType.SCV_CONTRACT_INSTANCE
.- Parameters:
instance
-SCContractInstance
to convert- Returns:
SCVal
with the type ofSCValType.SCV_CONTRACT_INSTANCE
-
fromContractInstance
- Parameters:
scVal
-SCVal
to convert- Returns:
- the contract instance
-
toDuration
Build aSCVal
with the type ofSCValType.SCV_DURATION
.- Parameters:
duration
- duration to convert (uint64)- Returns:
SCVal
with the type ofSCValType.SCV_DURATION
-
fromDuration
- Parameters:
scVal
-SCVal
to convert- Returns:
- the duration (uint64)
-
toError
Build aSCVal
with the type ofSCValType.SCV_ERROR
.- Parameters:
error
-SCError
to convert- Returns:
SCVal
with the type ofSCValType.SCV_ERROR
-
fromError
- Parameters:
scVal
-SCVal
to convert- Returns:
- the error
-
toInt32
Build aSCVal
with the type ofSCValType.SCV_I128
.- Parameters:
int32
- int32 to convert- Returns:
SCVal
with the type ofSCValType.SCV_I128
-
fromInt32
Convert fromSCVal
with the type ofSCValType.SCV_I128
to int32.- Parameters:
scVal
-SCVal
to convert- Returns:
- the int32
-
toInt64
Build aSCVal
with the type ofSCValType.SCV_I64
.- Parameters:
int64
- int64 to convert- Returns:
SCVal
with the type ofSCValType.SCV_I64
-
fromInt64
Convert fromSCVal
with the type ofSCValType.SCV_I64
to int64.- Parameters:
scVal
-SCVal
to convert- Returns:
- the int64
-
toInt128
Build aSCVal
with the type ofSCValType.SCV_I128
.- Parameters:
int128
- int128 to convert- Returns:
SCVal
with the type ofSCValType.SCV_I128
-
fromInt128
Convert fromSCVal
with the type ofSCValType.SCV_I128
to int128.- Parameters:
scVal
-SCVal
to convert- Returns:
- the int128
-
toInt256
Build aSCVal
with the type ofSCValType.SCV_I256
.- Parameters:
int256
- int256 to convert- Returns:
SCVal
with the type ofSCValType.SCV_I256
-
fromInt256
Convert fromSCVal
with the type ofSCValType.SCV_I256
to int256.- Parameters:
scVal
-SCVal
to convert- Returns:
- the int256
-
toLedgerKeyContractInstance
Build aSCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
.- Returns:
SCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
-
fromLedgerKeyContractInstance
Parse fromSCVal
with the type ofSCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE
, this function returns void if conversion succeeds.- Parameters:
scVal
-SCVal
to convert
-
toLedgerKeyNonce
Build aSCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
.- Parameters:
nonce
- nonce to convert- Returns:
SCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
-
fromLedgerKeyNonce
Convert fromSCVal
with the type ofSCValType.SCV_LEDGER_KEY_NONCE
to long.- Parameters:
scVal
-SCVal
to convert- Returns:
- the nonce
-
toMap
Build aSCVal
with the type ofSCValType.SCV_MAP
.- Parameters:
map
- map to convert- Returns:
SCVal
with the type ofSCValType.SCV_MAP
-
fromMap
- Parameters:
scVal
-SCVal
to convert- Returns:
- the map
-
toString
Build aSCVal
with the type ofSCValType.SCV_STRING
.- Parameters:
string
- string to convert- Returns:
SCVal
with the type ofSCValType.SCV_STRING
-
toString
Build aSCVal
with the type ofSCValType.SCV_STRING
.- Parameters:
string
- string to convert- Returns:
SCVal
with the type ofSCValType.SCV_STRING
-
fromString
Convert fromSCVal
with the type ofSCValType.SCV_STRING
to String.- Parameters:
scVal
-SCVal
to convert- Returns:
- the string value in bytes
-
toSymbol
Build aSCVal
with the type ofSCValType.SCV_SYMBOL
.- Parameters:
symbol
- symbol to convert- Returns:
SCVal
with the type ofSCValType.SCV_SYMBOL
-
fromSymbol
Convert fromSCVal
with the type ofSCValType.SCV_SYMBOL
to String.- Parameters:
scVal
-SCVal
to convert- Returns:
- the symbol
-
toTimePoint
Build aSCVal
with the type ofSCValType.SCV_TIMEPOINT
.- Parameters:
timePoint
- timePoint to convert (uint64)- Returns:
SCVal
with the type ofSCValType.SCV_TIMEPOINT
-
fromTimePoint
- Parameters:
scVal
-SCVal
to convert- Returns:
- the timePoint (uint64)
-
toUint32
Build aSCVal
with the type ofSCValType.SCV_U32
.- Parameters:
uint32
- uint32 to convert- Returns:
SCVal
with the type ofSCValType.SCV_U32
-
fromUint32
Convert fromSCVal
with the type ofSCValType.SCV_U32
to int.- Parameters:
scVal
-SCVal
to convert- Returns:
- the uint32
-
toUint64
Build aSCVal
with the type ofSCValType.SCV_U64
.- Parameters:
uint64
- uint64 to convert- Returns:
SCVal
with the type ofSCValType.SCV_U64
-
fromUint64
- Parameters:
scVal
-SCVal
to convert- Returns:
- the uint64
-
toUint128
Build aSCVal
with the type ofSCValType.SCV_U128
.- Parameters:
uint128
- uint128 to convert- Returns:
SCVal
with the type ofSCValType.SCV_U128
-
fromUint128
- Parameters:
scVal
-SCVal
to convert- Returns:
- the uint128
-
toUint256
Build aSCVal
with the type ofSCValType.SCV_U256
.- Parameters:
uint256
- uint256 to convert- Returns:
SCVal
with the type ofSCValType.SCV_U256
-
fromUint256
- Parameters:
scVal
-SCVal
to convert- Returns:
- the uint256
-
toVec
Build aSCVal
with the type ofSCValType.SCV_VEC
.- Parameters:
vec
- vec to convert- Returns:
SCVal
with the type ofSCValType.SCV_VEC
-
fromVec
- Parameters:
scVal
-SCVal
to convert- Returns:
- the vec
-
toVoid
Build aSCVal
with the type ofSCValType.SCV_VOID
.- Returns:
SCVal
with the type ofSCValType.SCV_VOID
-
fromVoid
Parse fromSCVal
with the type ofSCValType.SCV_VOID
, this function returns void if conversion succeeds.- Parameters:
scVal
-SCVal
to convert
-