-
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.
tx-signing-js: ReducedTransaction exported to JS and can be serialise…
…d and deserialized
- Loading branch information
1 parent
b948a31
commit 4ec1b49
Showing
6 changed files
with
77 additions
and
14 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
20 changes: 20 additions & 0 deletions
20
sdk/js/src/main/scala/org/ergoplatform/sdk/js/ReducedTransaction.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.ergoplatform.sdk.js | ||
|
||
import org.ergoplatform.sdk | ||
import scala.scalajs.js.annotation.JSExportTopLevel | ||
|
||
/** Equivalent of [[sdk.ReducedTransaction]] available from JS. */ | ||
@JSExportTopLevel("ReducedTransaction") | ||
class ReducedTransaction(private[js] val _tx: sdk.ReducedTransaction) { | ||
/** Serialized bytes of this transaction in hex format. */ | ||
def toHex: String = _tx.toHex | ||
} | ||
|
||
@JSExportTopLevel("ReducedTransactionObj") | ||
object ReducedTransaction { | ||
/** Creates a [[ReducedTransaction]] from serialized bytes in hex format. */ | ||
def fromHex(hex: String): ReducedTransaction = { | ||
val tx = sdk.ReducedTransaction.fromHex(hex) | ||
new ReducedTransaction(tx) | ||
} | ||
} |
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