Version
Version
class Version
BCS
The BCS serialized form of this type is specified in
bcs-schema.abnf.
description
var description: String { get }
A textual representation of this instance.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the String(describing:)
initializer. This initializer works with any type, and uses the custom
description property for types that conform to
CustomStringConvertible:
struct Point: CustomStringConvertible {
let x: Int, y: Int
var description: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"
The conversion of p to a string in the assignment to s uses the
Point type's description property.
asU64()
func asU64() -> UInt64
Get the underlying u64 value of this version
getCongestedVersionSuggestedGasPrice()
func getCongestedVersionSuggestedGasPrice() throws -> UInt64
Returns the suggested_gas_price embedded in this congested shared object version. The
suggested_gas_price here is used for a gas price feedback mechanism for transactions
canceled due to shared object congestion.
isCanceled()
func isCanceled() -> Bool
Checks if this version is canceled, i.e., the corresponding object appears in a canceled transaction.
isCongested()
func isCongested() -> Bool
Check if this version is congested, i.e., the corresponding object is the reason for transaction cancellation.
isValid()
func isValid() -> Bool
Checks if this version is valid, i.e., the corresponding object does not appear in a canceled transaction.
next()
func next() throws -> Version
Returns the next version, or an error if overflow occurs.
previous()
func previous() throws -> Version
Returns the previous version, or an error if underflow occurs.
toDisplayString()
func toDisplayString() -> String
Render this type as human-readable text.
Some types also print this through the binding's native string conversion; this method is the spelling every object type has.
The layout is meant for reading and can change between releases. Use the JSON or BCS conversions for output that gets parsed.
canceledRead()
static func canceledRead() -> Version
Special version that is assigned to objects which are accessed immutably in a canceled transaction.
congestedPriorToGasPriceFeedback()
static func congestedPriorToGasPriceFeedback() -> Version
Special version that was assigned to congested objects which cause transaction cancellations. Note that this special version was only used prior to the introduction of a gas price feedback mechanism, but it is kept for backward compatibility.
fromU64(value:)
static func fromU64(value: UInt64) -> Version
Create a new Version from a u64 value
lamportIncrement(inputs:)
static func lamportIncrement(inputs: [Version]) throws -> Version
Returns a new version that is greater than all versions in inputs, assuming this operation
will not overflow.
maxValidExcl()
static func maxValidExcl() -> Version
An exclusive upper limit on a valid version: versions strictly smaller than this limit are valid versions.
A valid version means an object, which this version is assigned to, does not appear in a canceled transaction. Versions larger than this value are "special" and assigned to objects that appear in canceled transactions.
minValidIncl()
static func minValidIncl() -> Version
An inclusive lower limit on a valid version.
A valid version means an object, which this version is assigned to, does not appear in a canceled transaction.
newCongestedWithSuggestedGasPrice(suggestedGasPrice:)
static func newCongestedWithSuggestedGasPrice(suggestedGasPrice: UInt64) throws -> Version
Returns a special version used for congested shared objects: Version::MIN_CONGESTED + suggested_gas_price, where suggested_gas_price is embedded into a congested version to
facilitate a gas price feedback mechanism for transactions canceled due to shared object
congestion.
randomnessUnavailable()
static func randomnessUnavailable() -> Version