Skip to content

Commit

Permalink
Add missing Access API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Oct 5, 2024
1 parent 6a4cd5b commit 7adaa02
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sdk/src/main/kotlin/org/onflow/flow/sdk/models.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,28 @@ data class FlowNodeVersionInfo(
val nodeRootBlockHeight: Long,
val compatibleRange: FlowCompatibleRange?
) : Serializable {
companion object {
@JvmStatic
fun of(value: NodeVersionInfoOuterClass.NodeVersionInfo) = FlowNodeVersionInfo(
semver = value.semver,
commit = value.commit,
sporkId = value.sporkId.toByteArray(),
protocolVersion = value.protocolVersion,
sporkRootBlockHeight = value.sporkRootBlockHeight,
nodeRootBlockHeight = value.nodeRootBlockHeight,
compatibleRange = null,
)
}

@JvmOverloads
fun builder(builder: NodeVersionInfoOuterClass.NodeVersionInfo.Builder = NodeVersionInfoOuterClass.NodeVersionInfo.newBuilder()): NodeVersionInfoOuterClass.NodeVersionInfo.Builder = builder
.setSemver(semver)
.setCommit(commit)
.setSporkId(UnsafeByteOperations.unsafeWrap(sporkId))
.setProtocolVersion(protocolVersion)
.setSporkRootBlockHeight(sporkRootBlockHeight)
.setNodeRootBlockHeight(nodeRootBlockHeight)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is FlowNodeVersionInfo) return false
Expand Down

0 comments on commit 7adaa02

Please sign in to comment.