Package org.bitcoinj.base
Enum Class ScriptType
- All Implemented Interfaces:
Serializable
,Comparable<ScriptType>
,Constable
Supported Bitcoin script types and their script identifier strings. The script identifier string for a
ScriptType
is the "human-readable identifier string" of a Script Expression as defined in
BIP 380.
Only the subset of identifier strings defined in
BIP 381 and
BIP 382 map to valid ScriptType
instances.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<ScriptType>
Use this method to create aScriptType
from a script identifier string that should be validated.id()
Return the script identifier string for thisScriptType
.int
Deprecated.Usingid()
to get a script identifier string is preferred.static ScriptType
Use this method to create aScriptType
from a known good script identifier string.static ScriptType
Returns the enum constant of this class with the specified name.static ScriptType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
P2PKH
-
P2PK
-
P2SH
-
P2WPKH
-
P2WSH
-
P2TR
-
-
Field Details
-
id
Deprecated.UsenumericId()
or better yet useid()
to get a script identifier string
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
of
Use this method to create aScriptType
from a known good script identifier string.- Parameters:
id
- A script identifier string- Returns:
- the script type
- Throws:
IllegalArgumentException
- if unknown/invalid script identifier string
-
find
Use this method to create aScriptType
from a script identifier string that should be validated.- Parameters:
id
- A script identifier string- Returns:
- A
ScriptType
-containingOptional
orOptional.empty()
-
id
Return the script identifier string for thisScriptType
.Be careful: the
id()
method returns a different type and value than what is in thedeprecated
id
field.- Returns:
- A script identifier string
-
numericId
Deprecated.Usingid()
to get a script identifier string is preferred.This is deprecated. But less deprecated than accessing theid
field directly.- Returns:
- A numeric ID
-
numericId()
or better yet useid()
to get a script identifier string