From 6746d727f021bd9a00c9c75c0b82f8326a932bcc Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Mon, 7 Aug 2023 22:12:16 +0200 Subject: [PATCH] tx-signing-js: upgrade fleed-sdk to 0.1.0 --- build.sbt | 4 +-- .../org/ergoplatform/sdk/js/ErgoTree.scala | 2 -- .../scala/org/ergoplatform/sdk/js/Isos.scala | 18 +++++----- .../org/ergoplatform/sdk/js/SigmaProver.scala | 4 +-- .../scala/org/ergoplatform/sdk/js/Value.scala | 3 +- sigma-js/package-lock.json | 34 +++++++++---------- sigma-js/package.json | 4 +-- 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/build.sbt b/build.sbt index 371536017e..9787110c4c 100644 --- a/build.sbt +++ b/build.sbt @@ -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)) => @@ -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" ) ) diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala index 810cc1ea81..8469545d95 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/ErgoTree.scala @@ -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 diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala index 4369f5e0f7..c5ca9692ef 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala @@ -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 = { @@ -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, @@ -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 = { @@ -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), @@ -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, diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala index 10f0d135ef..621fae4208 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/SigmaProver.scala @@ -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 @@ -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( diff --git a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala index b926cc54aa..26e167fa0c 100644 --- a/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala +++ b/sdk/js/src/main/scala/org/ergoplatform/sdk/js/Value.scala @@ -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} @@ -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]] diff --git a/sigma-js/package-lock.json b/sigma-js/package-lock.json index 3a56eb5323..a43cc7b2d5 100644 --- a/sigma-js/package-lock.json +++ b/sigma-js/package-lock.json @@ -1,17 +1,17 @@ { "name": "sigmastate-js", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sigmastate-js", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "dependencies": { - "@fleet-sdk/common": "0.1.0-alpha.14", + "@fleet-sdk/common": "0.1.0", "@noble/hashes": "1.1.4", - "sigmajs-crypto-facade": "0.0.6" + "sigmajs-crypto-facade": "0.0.7" }, "devDependencies": { "jest": "^29.0.3", @@ -592,11 +592,11 @@ "dev": true }, "node_modules/@fleet-sdk/common": { - "version": "0.1.0-alpha.14", - "resolved": "https://registry.npmjs.org/@fleet-sdk/common/-/common-0.1.0-alpha.14.tgz", - "integrity": "sha512-w6AMHe77FaSb759e3EwcOVRQ/lEsCdr1pXq376B+T80do5pUcWjrlrIEKKNrEJPCyqW8nNClxIqBVqkFuPbbMw==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@fleet-sdk/common/-/common-0.1.0.tgz", + "integrity": "sha512-UlhVFBwqSXrTixs/p+g51SGZoWKT0J/q9oAdYikJ/RCQu8rY9K+4e1o6w2s177qKscXG+jW5usAjocj2d3fLWg==", "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/@istanbuljs/load-nyc-config": { @@ -3163,9 +3163,9 @@ } }, "node_modules/sigmajs-crypto-facade": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/sigmajs-crypto-facade/-/sigmajs-crypto-facade-0.0.6.tgz", - "integrity": "sha512-Nbz+CZ0rgMvDN76C3bQjrFHO30qSHE9Fti+Co4WvNzL9UTaxSOlfSFJy89u0QX+IkVNvXd35RqiyiekLpTUSsA==", + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/sigmajs-crypto-facade/-/sigmajs-crypto-facade-0.0.7.tgz", + "integrity": "sha512-4XK8ZS9NKAbo8aGnU6o5GkBW6Upl8+OK8A1KreVDMAamfvZ0iq4LoVH8rHaeEPf9moVtaC4QZY5RYI+0OwiydA==", "dependencies": { "@noble/hashes": "^1.1.4" }, @@ -3994,9 +3994,9 @@ "dev": true }, "@fleet-sdk/common": { - "version": "0.1.0-alpha.14", - "resolved": "https://registry.npmjs.org/@fleet-sdk/common/-/common-0.1.0-alpha.14.tgz", - "integrity": "sha512-w6AMHe77FaSb759e3EwcOVRQ/lEsCdr1pXq376B+T80do5pUcWjrlrIEKKNrEJPCyqW8nNClxIqBVqkFuPbbMw==" + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@fleet-sdk/common/-/common-0.1.0.tgz", + "integrity": "sha512-UlhVFBwqSXrTixs/p+g51SGZoWKT0J/q9oAdYikJ/RCQu8rY9K+4e1o6w2s177qKscXG+jW5usAjocj2d3fLWg==" }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -5935,9 +5935,9 @@ } }, "sigmajs-crypto-facade": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/sigmajs-crypto-facade/-/sigmajs-crypto-facade-0.0.6.tgz", - "integrity": "sha512-Nbz+CZ0rgMvDN76C3bQjrFHO30qSHE9Fti+Co4WvNzL9UTaxSOlfSFJy89u0QX+IkVNvXd35RqiyiekLpTUSsA==", + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/sigmajs-crypto-facade/-/sigmajs-crypto-facade-0.0.7.tgz", + "integrity": "sha512-4XK8ZS9NKAbo8aGnU6o5GkBW6Upl8+OK8A1KreVDMAamfvZ0iq4LoVH8rHaeEPf9moVtaC4QZY5RYI+0OwiydA==", "requires": { "@noble/hashes": "^1.1.4" } diff --git a/sigma-js/package.json b/sigma-js/package.json index b1ff6c4df7..a0f5dde4f0 100644 --- a/sigma-js/package.json +++ b/sigma-js/package.json @@ -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",