Skip to content

Commit

Permalink
tx-signing-js: upgrade fleed-sdk to 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Aug 7, 2023
1 parent ae39af3 commit 6746d72
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 35 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lazy val commonSettings = Seq(
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) =>
Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8")
Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-Wconf:src=src_managed/.*:silent", "-release", "8")
case Some((2, 12)) =>
Seq("-Ywarn-unused:_,imports", "-Ywarn-unused:imports", "-release", "8")
case Some((2, 11)) =>
Expand Down Expand Up @@ -282,7 +282,7 @@ lazy val interpreterJS = interpreter.js
},
Compile / npmDependencies ++= Seq(
"sigmajs-crypto-facade" -> sigmajsCryptoFacadeVersion,
"@fleet-sdk/common" -> "0.1.0-alpha.14"
"@fleet-sdk/common" -> "0.1.0"
)
)

Expand Down
2 changes: 0 additions & 2 deletions sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.ergoplatform.sdk.js

import scorex.util.encode.Base16
import sigmastate.Values
import sigmastate.serialization.ErgoTreeSerializer

import scala.scalajs.js
import scala.scalajs.js.JSConverters.JSRichIterableOnce
Expand Down
18 changes: 9 additions & 9 deletions sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ object Isos {
}
}

implicit val isoBoxCandidate: Iso[boxesMod.BoxCandidate[commonMod.Amount], ErgoBoxCandidate] = new Iso[boxesMod.BoxCandidate[commonMod.Amount], ErgoBoxCandidate] {
override def to(x: boxesMod.BoxCandidate[commonMod.Amount]): ErgoBoxCandidate = {
implicit val isoBoxCandidate: Iso[boxesMod.BoxCandidate[commonMod.Amount, NonMandatoryRegisters], ErgoBoxCandidate] = new Iso[boxesMod.BoxCandidate[commonMod.Amount, NonMandatoryRegisters], ErgoBoxCandidate] {
override def to(x: boxesMod.BoxCandidate[commonMod.Amount, NonMandatoryRegisters]): ErgoBoxCandidate = {
val ergoBoxCandidate = new ErgoBoxCandidate(
value = isoAmount.to(x.value),
ergoTree = {
Expand All @@ -358,11 +358,11 @@ object Isos {
ergoBoxCandidate
}

override def from(x: ErgoBoxCandidate): boxesMod.BoxCandidate[commonMod.Amount] = {
override def from(x: ErgoBoxCandidate): boxesMod.BoxCandidate[commonMod.Amount, NonMandatoryRegisters] = {
val ergoTree = ErgoTreeSerializer.DefaultSerializer.serializeErgoTree(x.ergoTree)
val ergoTreeStr = Base16.encode(ergoTree)
val assets = isoTokenArray.from(x.additionalTokens)
boxesMod.BoxCandidate[commonMod.Amount](
boxesMod.BoxCandidate[commonMod.Amount, NonMandatoryRegisters](
ergoTree = ergoTreeStr,
value = isoAmount.from(x.value),
assets = assets,
Expand All @@ -372,8 +372,8 @@ object Isos {
}
}

val isoBox: Iso[Box[commonMod.Amount], ErgoBox] = new Iso[Box[commonMod.Amount], ErgoBox] {
override def to(x: Box[commonMod.Amount]): ErgoBox = {
val isoBox: Iso[Box[commonMod.Amount, NonMandatoryRegisters], ErgoBox] = new Iso[Box[commonMod.Amount, NonMandatoryRegisters], ErgoBox] {
override def to(x: Box[commonMod.Amount, NonMandatoryRegisters]): ErgoBox = {
val ergoBox = new ErgoBox(
value = isoAmount.to(x.value),
ergoTree = {
Expand All @@ -389,11 +389,11 @@ object Isos {
ergoBox
}

override def from(x: ErgoBox): Box[commonMod.Amount] = {
override def from(x: ErgoBox): Box[commonMod.Amount, NonMandatoryRegisters] = {
val ergoTree = ErgoTreeSerializer.DefaultSerializer.serializeErgoTree(x.ergoTree)
val ergoTreeStr = Base16.encode(ergoTree)
val assets = isoTokenArray.from(x.additionalTokens)
Box[commonMod.Amount](
Box[commonMod.Amount, NonMandatoryRegisters](
boxId = Base16.encode(x.id),
ergoTree = ergoTreeStr,
value = isoAmount.from(x.value),
Expand All @@ -409,7 +409,7 @@ object Isos {
val isoEIP12UnsignedInput: Iso[inputsMod.EIP12UnsignedInput, ExtendedInputBox] =
new Iso[inputsMod.EIP12UnsignedInput, ExtendedInputBox] {
override def to(x: inputsMod.EIP12UnsignedInput): ExtendedInputBox = {
val box = Box[commonMod.Amount](
val box = Box[commonMod.Amount, NonMandatoryRegisters](
boxId = x.boxId,
ergoTree = x.ergoTree,
value = x.value,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.ergoplatform.sdk.js

import org.ergoplatform.sdk
import org.ergoplatform.sdk.SignedTransaction
import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box
import sigmastate.fleetSdkCommon.distEsmTypesRegistersMod.NonMandatoryRegisters
import sigmastate.fleetSdkCommon.{distEsmTypesCommonMod => commonMod, distEsmTypesInputsMod => inputsMod, distEsmTypesTokenMod => tokenMod, distEsmTypesTransactionsMod => transactionsMod}

import scala.scalajs.js
Expand All @@ -26,7 +26,7 @@ class SigmaProver(_prover: sdk.SigmaProver) extends js.Object {
stateCtx: BlockchainStateContext,
unsignedTx: transactionsMod.UnsignedTransaction,
boxesToSpend: js.Array[inputsMod.EIP12UnsignedInput],
dataInputs: js.Array[Box[commonMod.Amount]],
dataInputs: js.Array[Box[commonMod.Amount, NonMandatoryRegisters]],
tokensToBurn: js.Array[tokenMod.TokenAmount[commonMod.Amount]],
baseCost: Int): ReducedTransaction = {
val unreducedTx = sdk.UnreducedTransaction(
Expand Down
3 changes: 2 additions & 1 deletion sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import sigmastate.crypto.Platform
import sigmastate.eval.{CAvlTree, CGroupElement, CSigmaProp, Colls, CostingBox, Evaluation, SigmaDsl}
import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box
import sigmastate.fleetSdkCommon.distEsmTypesCommonMod
import sigmastate.fleetSdkCommon.distEsmTypesRegistersMod.NonMandatoryRegisters
import sigmastate.lang.DeserializationSigmaBuilder
import sigmastate.serialization.{ConstantSerializer, DataSerializer, SigmaSerializer}
import special.collection.{Coll, CollType}
Expand Down Expand Up @@ -97,7 +98,7 @@ object Value extends js.Object {
val t = data.asInstanceOf[AvlTree]
Isos.isoAvlTree.to(t)
case special.sigma.BoxRType =>
val t = data.asInstanceOf[Box[distEsmTypesCommonMod.Amount]]
val t = data.asInstanceOf[Box[distEsmTypesCommonMod.Amount, NonMandatoryRegisters]]
SigmaDsl.Box(Isos.isoBox.to(t))
case ct: CollType[a] =>
val xs = data.asInstanceOf[js.Array[Any]]
Expand Down
34 changes: 17 additions & 17 deletions sigma-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sigma-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
},
"dependencies": {
"@noble/hashes": "1.1.4",
"@fleet-sdk/common": "0.1.0-alpha.14",
"sigmajs-crypto-facade": "0.0.6"
"@fleet-sdk/common": "0.1.0",
"sigmajs-crypto-facade": "0.0.7"
},
"devDependencies": {
"jest": "^29.0.3",
Expand Down

0 comments on commit 6746d72

Please sign in to comment.