Transactions to be used in an offline signing capacity with BramblSc should use the Raw Transfer functions for this purpose. The Raw Transfer is similar to the BramblJS transaction, however, it does require some more involved steps.
In order to create and sign a raw transfer, the sequence of events is as follows:
1.) Send a raw transfer request
2.) Sign the returned raw transfer object
3.) Send the raw transfer object to a node for broadcasting
- There are currently two types of raw transfers, RawPolyTransfer and RawAssetTransfer.
- You can create an address in BramblSc by following the Key Management documentation
val quantity = 10 val assetCode: AssetCode = AssetCode(1: Byte, senderAddress, "name") val rawTransfer: RawAssetTransfer = RawAssetTransfer(Seq(senderAddress), Seq((recipientAddress, quantity), assetCode, fee = 1L, minting = true)
val rawAssetTxF = brambl.rpc.getRawAssetTransfer(rawTransfer) val rawAssetTx = Await.result(rawAssetTxF, 5.seconds).toOption.get.result.tx
where the key file has been loaded in per Key Management
val signedTx = brambl.signTransaction(address)(rawAssetTx)
The transaction is then broadcasted using the
val broadcastTx = brambl.rpc.broadcastTx(signedTx)
Updated 12 months ago