-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #943 from ScorexFoundation/v5.0.14-RC
Release Candidate v5.0.14
- Loading branch information
Showing
434 changed files
with
13,946 additions
and
11,500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...gmastate/crypto/SigmaJsCryptoFacade.scala → ...la/sigma/crypto/SigmaJsCryptoFacade.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package sigmastate.crypto | ||
package sigma.crypto | ||
|
||
import debox.cfor | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package sigma.js | ||
|
||
import sigma.Extensions.ArrayOps | ||
import sigma.data.Iso.{isoStringToArray, isoStringToColl} | ||
import sigma.data.{AvlTreeData, AvlTreeFlags, CAvlTree, Iso} | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.UndefOr | ||
import scala.scalajs.js.annotation.JSExportTopLevel | ||
|
||
/** Equivalent of [[sigma.AvlTree]] available from JS. */ | ||
@JSExportTopLevel("AvlTree") | ||
class AvlTree( | ||
val digest: String, | ||
val insertAllowed: Boolean, | ||
val updateAllowed: Boolean, | ||
val removeAllowed: Boolean, | ||
val keyLength: Int, | ||
val valueLengthOpt: UndefOr[Int] | ||
) extends js.Object | ||
|
||
object AvlTree { | ||
|
||
implicit val isoAvlTree: Iso[AvlTree, sigma.AvlTree] = new Iso[AvlTree, sigma.AvlTree] { | ||
override def to(x: AvlTree): sigma.AvlTree = { | ||
CAvlTree( | ||
AvlTreeData( | ||
digest = isoStringToArray.to(x.digest).toColl, | ||
treeFlags = AvlTreeFlags(x.insertAllowed, x.updateAllowed, x.removeAllowed), | ||
x.keyLength, | ||
valueLengthOpt = sigma.js.Isos.isoUndefOr(Iso.identityIso[Int]).to(x.valueLengthOpt), | ||
), | ||
) | ||
} | ||
|
||
override def from(x: sigma.AvlTree): AvlTree = { | ||
val tree = x.asInstanceOf[CAvlTree] | ||
val data = tree.treeData | ||
new AvlTree( | ||
digest = isoStringToColl.from(tree.digest), | ||
insertAllowed = data.treeFlags.insertAllowed, | ||
updateAllowed = data.treeFlags.updateAllowed, | ||
removeAllowed = data.treeFlags.removeAllowed, | ||
keyLength = data.keyLength, | ||
valueLengthOpt = sigma.js.Isos.isoUndefOr(Iso.identityIso[Int]).from(data.valueLengthOpt), | ||
) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.