mirror of
https://github.com/ACINQ/eclair.git
synced 2025-03-27 02:37:06 +01:00
first commit
This commit is contained in:
parent
72a527ef5b
commit
32eeba22be
29 changed files with 3039 additions and 0 deletions
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
*.class
|
||||
*.log
|
||||
|
||||
# sbt specific
|
||||
.cache/
|
||||
.history/
|
||||
.lib/
|
||||
dist/*
|
||||
target/
|
||||
lib_managed/
|
||||
src_managed/
|
||||
project/boot/
|
||||
project/plugins/project/
|
||||
|
||||
# Scala-IDE specific
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
target/
|
||||
project/target
|
||||
DeleteMe*.scala
|
34
eclair-demo/pom.xml
Normal file
34
eclair-demo/pom.xml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>fr.acinq</groupId>
|
||||
<artifactId>eclair_2.11</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>eclair-demo_2.11</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.acinq</groupId>
|
||||
<artifactId>bitcoin-lib_2.11</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.trueaccord.scalapb</groupId>
|
||||
<artifactId>scalapb-runtime_2.11</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.trueaccord.lenses</groupId>
|
||||
<artifactId>lenses_2.11</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
206
eclair-demo/src/main/protobuf/lightning.proto
Normal file
206
eclair-demo/src/main/protobuf/lightning.proto
Normal file
|
@ -0,0 +1,206 @@
|
|||
// The outer layer handles encryption, authentication and message
|
||||
// boundaries.
|
||||
|
||||
//
|
||||
// Helper Types
|
||||
//
|
||||
|
||||
// Protobufs don't have fixed-length fields, so these are a hack.
|
||||
message sha256_hash {
|
||||
required fixed64 a = 1;
|
||||
required fixed64 b = 2;
|
||||
required fixed64 c = 3;
|
||||
required fixed64 d = 4;
|
||||
}
|
||||
|
||||
message signature {
|
||||
required fixed64 r1 = 1;
|
||||
required fixed64 r2 = 2;
|
||||
required fixed64 r3 = 3;
|
||||
required fixed64 r4 = 4;
|
||||
required fixed64 s1 = 5;
|
||||
required fixed64 s2 = 6;
|
||||
required fixed64 s3 = 7;
|
||||
required fixed64 s4 = 8;
|
||||
}
|
||||
|
||||
message locktime {
|
||||
oneof locktime {
|
||||
uint32 seconds = 1;
|
||||
uint32 blocks = 2;
|
||||
}
|
||||
};
|
||||
|
||||
// Pubkey for commitment transaction input.
|
||||
message bitcoin_pubkey {
|
||||
// Either 65 or 33 bytes.
|
||||
required bytes key = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Packet Types
|
||||
//
|
||||
|
||||
// Set channel params.
|
||||
message open_channel {
|
||||
// Relative locktime for outputs going to us.
|
||||
required locktime delay = 2;
|
||||
// Hash for revoking first commitment transaction.
|
||||
required sha256_hash revocation_hash = 4;
|
||||
// Pubkey for anchor to pay into commitment tx.
|
||||
required bitcoin_pubkey commit_key = 5;
|
||||
// How to pay money to us from commit_tx.
|
||||
required bitcoin_pubkey final_key = 1;
|
||||
|
||||
enum anchor_offer {
|
||||
// I will create the anchor
|
||||
WILL_CREATE_ANCHOR = 1;
|
||||
// I won't create the anchor
|
||||
WONT_CREATE_ANCHOR = 2;
|
||||
}
|
||||
required anchor_offer anch = 6;
|
||||
|
||||
// How far must anchor be buried before we consider channel live?
|
||||
optional uint32 min_depth = 7 [ default = 0 ];
|
||||
|
||||
// How much fee would I like on commitment tx?
|
||||
required uint64 commitment_fee = 8;
|
||||
}
|
||||
|
||||
// Whoever is supplying anchor sends this.
|
||||
message open_anchor {
|
||||
// Transaction ID of anchor.
|
||||
required sha256_hash txid = 1;
|
||||
// Which output is going to the 2 of 2.
|
||||
required uint32 output_index = 2;
|
||||
// Amount of anchor output.
|
||||
required uint64 amount = 3;
|
||||
|
||||
// Signature for your initial commitment tx.
|
||||
required signature commit_sig = 4;
|
||||
}
|
||||
|
||||
// Reply: signature for your initial commitment tx
|
||||
message open_commit_sig {
|
||||
required signature sig = 1;
|
||||
}
|
||||
|
||||
// Indicates we've seen anchor reach min-depth.
|
||||
message open_complete {
|
||||
// Block it went into.
|
||||
optional sha256_hash blockid = 1;
|
||||
// FIXME: add a merkle proof plus block headers here?
|
||||
}
|
||||
|
||||
// Let's spend some money in the channel!
|
||||
message update {
|
||||
// Hash for which I will supply preimage to revoke this.
|
||||
required sha256_hash revocation_hash = 1;
|
||||
// Change in current payment to-me (implies reverse to-you).
|
||||
required sint64 delta = 2;
|
||||
}
|
||||
|
||||
// Start a new commitment tx to add an HTLC me -> you.
|
||||
message update_add_htlc {
|
||||
// Hash for which I will supply preimage to revoke this commitment tx.
|
||||
required sha256_hash revocation_hash = 1;
|
||||
// Amount for htlc
|
||||
required uint64 amount = 2;
|
||||
// Hash for HTLC R value.
|
||||
required sha256_hash r_hash = 3;
|
||||
// Time at which HTLC expires (absolute)
|
||||
required locktime expiry = 4;
|
||||
// FIXME: Routing information.
|
||||
}
|
||||
|
||||
// Complete an HTLC
|
||||
message update_complete_htlc {
|
||||
// Hash for which I will supply preimage to revoke this commitment tx.
|
||||
required sha256_hash revocation_hash = 1;
|
||||
// HTLC R value.
|
||||
required sha256_hash r = 3;
|
||||
}
|
||||
|
||||
// Remove an HTLC
|
||||
message update_remove_htlc {
|
||||
// Hash for which I will supply preimage to revoke this commitment tx.
|
||||
required sha256_hash revocation_hash = 1;
|
||||
// Hash for HTLC R value.
|
||||
required sha256_hash r_hash = 3;
|
||||
}
|
||||
|
||||
// Respond to an HTLC remove request: not yet.
|
||||
// Expect a remove_htlc later.
|
||||
message update_remove_htlc_delay {
|
||||
// Hash for HTLC R value.
|
||||
required sha256_hash r_hash = 1;
|
||||
}
|
||||
|
||||
// OK, I accept that update; here's your signature.
|
||||
message update_accept {
|
||||
// Signature for your new commitment tx.
|
||||
required signature sig = 1;
|
||||
// Hash for which I will supply preimage to revoke this new commit tx.
|
||||
required sha256_hash revocation_hash = 3;
|
||||
}
|
||||
|
||||
// Thanks for accepting, here's my last bit.
|
||||
message update_signature {
|
||||
// Signature for your new commitment tx.
|
||||
required signature sig = 1;
|
||||
// Hash preimage which revokes old commitment tx.
|
||||
required sha256_hash revocation_preimage = 2;
|
||||
}
|
||||
|
||||
// Complete the update.
|
||||
message update_complete {
|
||||
// Hash preimage which revokes old commitment tx.
|
||||
required sha256_hash revocation_preimage = 1;
|
||||
}
|
||||
|
||||
// Begin cooperative close of channel.
|
||||
message close_channel {
|
||||
// This is our signature a new transaction which spends the anchor
|
||||
// output to my open->final and your open->final,
|
||||
// as per the last commit tx.
|
||||
required signature sig = 1;
|
||||
// Fee to pay for close transaction.
|
||||
required uint64 close_fee = 2;
|
||||
}
|
||||
|
||||
// OK, here's my sig so you can broadcast it too. We're done.
|
||||
message close_channel_complete {
|
||||
// This is my signature for that same tx.
|
||||
required signature sig = 1;
|
||||
}
|
||||
|
||||
// This means we're going to hang up; it's to help diagnose only!
|
||||
message error {
|
||||
optional string problem = 1;
|
||||
}
|
||||
|
||||
// This is the union which defines all of them
|
||||
message pkt {
|
||||
oneof pkt {
|
||||
// Opening
|
||||
open_channel open = 201;
|
||||
open_anchor open_anchor = 202;
|
||||
open_commit_sig open_commit_sig = 203;
|
||||
open_complete open_complete = 204;
|
||||
// Updating (most common)
|
||||
update update = 1;
|
||||
update_add_htlc update_add_htlc = 2;
|
||||
update_accept update_accept = 3;
|
||||
update_signature update_signature = 4;
|
||||
update_complete update_complete = 5;
|
||||
update_complete_htlc update_complete_htlc = 6;
|
||||
update_remove_htlc update_remove_htlc = 7;
|
||||
update_remove_htlc_delay update_remove_htlc_delay = 8;
|
||||
// Closing
|
||||
close_channel close = 401;
|
||||
close_channel_complete close_complete = 402;
|
||||
|
||||
// Unexpected issue.
|
||||
error error = 1000;
|
||||
}
|
||||
}
|
126
eclair-demo/src/main/scala/fr/acinq/lightning/Test.scala
Normal file
126
eclair-demo/src/main/scala/fr/acinq/lightning/Test.scala
Normal file
|
@ -0,0 +1,126 @@
|
|||
package fr.acinq.lightning
|
||||
|
||||
import fr.acinq.bitcoin._
|
||||
|
||||
object Test extends App {
|
||||
val keyAlice: BinaryData = "C0B91A94A26DC9BE07374C2280E43B1DE54BE568B2509EF3CE1ADE5C9CF9E8AA"
|
||||
val pubAlice = Crypto.publicKeyFromPrivateKey(keyAlice)
|
||||
|
||||
val keyBob: BinaryData = "5C3D081615591ABCE914D231BA009D8AE0174759E4A9AE821D97E28F122E2F8C"
|
||||
val pubBob = Crypto.publicKeyFromPrivateKey(keyBob)
|
||||
|
||||
val openingTx = {
|
||||
val previousTx = Transaction.read("0100000001bb4f5a244b29dc733c56f80c0fed7dd395367d9d3b416c01767c5123ef124f82000000006b4830450221009e6ed264343e43dfee2373b925915f7a4468e0bc68216606e40064561e6c097a022030f2a50546a908579d0fab539d5726a1f83cfd48d29b89ab078d649a8e2131a0012103c80b6c289bf0421d010485cec5f02636d18fb4ed0f33bfa6412e20918ebd7a34ffffffff0200093d00000000001976a9145dbf52b8d7af4fb5f9b75b808f0a8284493531b388acf0b0b805000000001976a914807c74c89592e8a260f04b5a3bc63e7bef8c282588ac00000000")
|
||||
val key = SignData(previousTx.txOut(0).publicKeyScript, Base58Check.decode("cV7LGVeY2VPuCyCSarqEqFCUNig2NzwiAEBTTA89vNRQ4Vqjfurs")._2)
|
||||
|
||||
|
||||
// create a pub key script that can be redeemed either:
|
||||
// by Alice alone, in a tx which locktime is > 100
|
||||
// or by Alice and Bob, anytime
|
||||
val scriptPubKey = OP_IF ::
|
||||
OP_PUSHDATA(Seq(100: Byte)) :: OP_CHECKLOCKTIMEVERIFY :: OP_DROP :: OP_PUSHDATA(pubAlice) :: OP_CHECKSIG ::
|
||||
OP_ELSE ::
|
||||
OP_2 :: OP_PUSHDATA(pubAlice) :: OP_PUSHDATA(pubBob) :: OP_2 :: OP_CHECKMULTISIG :: OP_ENDIF :: Nil
|
||||
|
||||
// create a tx that sends money to scriptPubKey
|
||||
val tx = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1L,
|
||||
txIn = TxIn(OutPoint(previousTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = TxOut(amount = 100, publicKeyScript = scriptPubKey) :: Nil,
|
||||
lockTime = 0
|
||||
)
|
||||
Transaction.sign(tmpTx, Seq(key))
|
||||
}
|
||||
|
||||
Transaction.correctlySpends(tx, Seq(previousTx), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
|
||||
tx
|
||||
}
|
||||
|
||||
println(openingTx)
|
||||
|
||||
val paymentTx1 = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(openingTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = Seq(
|
||||
TxOut(amount = 99, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil),
|
||||
TxOut(amount = 1, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubBob)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil)
|
||||
),
|
||||
lockTime = 0
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
// Bob can redeem a payment tx by adding his signature to its sig script
|
||||
def bobRedeemsPayment(tx : Transaction) : Unit = {
|
||||
val sigBob = Transaction.signInput(tx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyBob)
|
||||
val sigAlice = Script.parse(tx.txIn(0).signatureScript) match {
|
||||
case OP_PUSHDATA(value, _) :: Nil => value
|
||||
case _ => throw new RuntimeException("cannot find Alice's signature")
|
||||
}
|
||||
val sigScript = OP_0 :: OP_PUSHDATA(sigAlice) :: OP_PUSHDATA(sigBob) :: OP_0 :: Nil
|
||||
val tx1 = tx.updateSigScript(0, Script.write(sigScript))
|
||||
Transaction.correctlySpends(tx1, Seq(openingTx), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS | ScriptFlags.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)
|
||||
}
|
||||
|
||||
// bob can use this payment tx
|
||||
bobRedeemsPayment(paymentTx1)
|
||||
|
||||
val paymentTx2 = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(openingTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = Seq(
|
||||
TxOut(amount = 98, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil),
|
||||
TxOut(amount = 2, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubBob)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil)
|
||||
),
|
||||
lockTime = 0
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
bobRedeemsPayment(paymentTx2)
|
||||
}
|
||||
|
||||
object RevokablePaymentChannel extends App {
|
||||
val keyAlice: BinaryData = "C0B91A94A26DC9BE07374C2280E43B1DE54BE568B2509EF3CE1ADE5C9CF9E8AA"
|
||||
val pubAlice = Crypto.publicKeyFromPrivateKey(keyAlice)
|
||||
|
||||
val keyBob: BinaryData = "5C3D081615591ABCE914D231BA009D8AE0174759E4A9AE821D97E28F122E2F8C"
|
||||
val pubBob = Crypto.publicKeyFromPrivateKey(keyBob)
|
||||
|
||||
val openingTx = {
|
||||
val previousTx = Transaction.read("0100000001bb4f5a244b29dc733c56f80c0fed7dd395367d9d3b416c01767c5123ef124f82000000006b4830450221009e6ed264343e43dfee2373b925915f7a4468e0bc68216606e40064561e6c097a022030f2a50546a908579d0fab539d5726a1f83cfd48d29b89ab078d649a8e2131a0012103c80b6c289bf0421d010485cec5f02636d18fb4ed0f33bfa6412e20918ebd7a34ffffffff0200093d00000000001976a9145dbf52b8d7af4fb5f9b75b808f0a8284493531b388acf0b0b805000000001976a914807c74c89592e8a260f04b5a3bc63e7bef8c282588ac00000000")
|
||||
val key = SignData(previousTx.txOut(0).publicKeyScript, Base58Check.decode("cV7LGVeY2VPuCyCSarqEqFCUNig2NzwiAEBTTA89vNRQ4Vqjfurs")._2)
|
||||
|
||||
|
||||
// create a pub key script that can be redeemed either:
|
||||
// by Alice alone, in a tx which locktime is > 100
|
||||
// or by Alice and Bob, anytime
|
||||
val scriptPubKey = OP_IF ::
|
||||
OP_PUSHDATA(Seq(100: Byte)) :: OP_CHECKLOCKTIMEVERIFY :: OP_DROP :: OP_PUSHDATA(pubAlice) :: OP_CHECKSIG ::
|
||||
OP_ELSE ::
|
||||
OP_2 :: OP_PUSHDATA(pubAlice) :: OP_PUSHDATA(pubBob) :: OP_2 :: OP_CHECKMULTISIG :: OP_ENDIF :: Nil
|
||||
|
||||
// create a tx that sends money to scriptPubKey
|
||||
val tx = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1L,
|
||||
txIn = TxIn(OutPoint(previousTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = TxOut(amount = 100, publicKeyScript = scriptPubKey) :: Nil,
|
||||
lockTime = 0
|
||||
)
|
||||
Transaction.sign(tmpTx, Seq(key))
|
||||
}
|
||||
|
||||
Transaction.correctlySpends(tx, Seq(previousTx), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
|
||||
tx
|
||||
}
|
||||
}
|
50
eclair-demo/src/main/scala/fr/acinq/lightning/Test1.scala
Normal file
50
eclair-demo/src/main/scala/fr/acinq/lightning/Test1.scala
Normal file
|
@ -0,0 +1,50 @@
|
|||
package fr.acinq.lightning
|
||||
|
||||
import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
|
||||
|
||||
import com.google.protobuf.ByteString
|
||||
import fr.acinq.bitcoin._
|
||||
|
||||
object Test1 extends App {
|
||||
// tx used for funding
|
||||
val previousTx = Transaction.read("0100000001bb4f5a244b29dc733c56f80c0fed7dd395367d9d3b416c01767c5123ef124f82000000006b4830450221009e6ed264343e43dfee2373b925915f7a4468e0bc68216606e40064561e6c097a022030f2a50546a908579d0fab539d5726a1f83cfd48d29b89ab078d649a8e2131a0012103c80b6c289bf0421d010485cec5f02636d18fb4ed0f33bfa6412e20918ebd7a34ffffffff0200093d00000000001976a9145dbf52b8d7af4fb5f9b75b808f0a8284493531b388acf0b0b805000000001976a914807c74c89592e8a260f04b5a3bc63e7bef8c282588ac00000000")
|
||||
// key that can spend this tx
|
||||
val key = SignData(previousTx.txOut(0).publicKeyScript, Base58Check.decode("cV7LGVeY2VPuCyCSarqEqFCUNig2NzwiAEBTTA89vNRQ4Vqjfurs")._2)
|
||||
|
||||
object Alice {
|
||||
val (_, priv) = Base58Check.decode("cVuzKWCszfvjkoJyUasvsrRdECriz8hSd1BDinRNzytwnXmX7m1g")
|
||||
val pub = Crypto.publicKeyFromPrivateKey(priv)
|
||||
val R = "this is Alice's R".getBytes("UTF-8")
|
||||
}
|
||||
|
||||
object Bob {
|
||||
val (_, priv) = Base58Check.decode("cSupnaiBh6jgTcQf9QANCB5fZtXojxkJQczq5kwfSBeULjNd5Ypo")
|
||||
val pub = Crypto.publicKeyFromPrivateKey(priv)
|
||||
val R = "this is Bob's R".getBytes("UTF-8")
|
||||
}
|
||||
|
||||
def bin2sha256(in: BinaryData): lightning.sha256_hash = {
|
||||
require(in.size == 32)
|
||||
val bis = new ByteArrayInputStream(in)
|
||||
lightning.sha256_hash(Protocol.uint64(bis), Protocol.uint64(bis), Protocol.uint64(bis), Protocol.uint64(bis))
|
||||
}
|
||||
|
||||
def sha2562bin(in: lightning.sha256_hash): Array[Byte] = {
|
||||
val bos = new ByteArrayOutputStream()
|
||||
Protocol.writeUInt64(in.a, bos)
|
||||
Protocol.writeUInt64(in.b, bos)
|
||||
Protocol.writeUInt64(in.c, bos)
|
||||
Protocol.writeUInt64(in.d, bos)
|
||||
bos.toByteArray
|
||||
}
|
||||
|
||||
def bin2pubkey(in: BinaryData) = lightning.bitcoin_pubkey(ByteString.copyFrom(in))
|
||||
|
||||
def pubkey2bin(in: lightning.bitcoin_pubkey): Array[Byte] = in.key.toByteArray
|
||||
|
||||
val foo = "foobar".getBytes("UTF-8")
|
||||
val hash: BinaryData = Crypto.sha256(foo)
|
||||
val p = bin2sha256(hash)
|
||||
val hash1: BinaryData = sha2562bin(p)
|
||||
assert(hash == hash1)
|
||||
}
|
46
eclair-demo/src/main/scala/fr/acinq/lightning/Test2.scala
Normal file
46
eclair-demo/src/main/scala/fr/acinq/lightning/Test2.scala
Normal file
|
@ -0,0 +1,46 @@
|
|||
package fr.acinq.lightning
|
||||
|
||||
import fr.acinq.bitcoin._
|
||||
|
||||
object Test2 extends App {
|
||||
// tx used for funding
|
||||
val previousTx = Transaction.read("0100000001bb4f5a244b29dc733c56f80c0fed7dd395367d9d3b416c01767c5123ef124f82000000006b4830450221009e6ed264343e43dfee2373b925915f7a4468e0bc68216606e40064561e6c097a022030f2a50546a908579d0fab539d5726a1f83cfd48d29b89ab078d649a8e2131a0012103c80b6c289bf0421d010485cec5f02636d18fb4ed0f33bfa6412e20918ebd7a34ffffffff0200093d00000000001976a9145dbf52b8d7af4fb5f9b75b808f0a8284493531b388acf0b0b805000000001976a914807c74c89592e8a260f04b5a3bc63e7bef8c282588ac00000000")
|
||||
// key that can spend this tx
|
||||
val key = SignData(previousTx.txOut(0).publicKeyScript, Base58Check.decode("cV7LGVeY2VPuCyCSarqEqFCUNig2NzwiAEBTTA89vNRQ4Vqjfurs")._2)
|
||||
|
||||
object Alice {
|
||||
val (_, commitKey) = Base58Check.decode("cVuzKWCszfvjkoJyUasvsrRdECriz8hSd1BDinRNzytwnXmX7m1g")
|
||||
val (_, escapeKey) = Base58Check.decode("cRUfvpbRtMSqCFD1ADdvgPn5HfRLYuHCFYAr2noWnaRDNger2AoA")
|
||||
val commitPubKey = Crypto.publicKeyFromPrivateKey(commitKey)
|
||||
val escapePubKey = Crypto.publicKeyFromPrivateKey(escapeKey)
|
||||
val R = "this is Alice's R".getBytes("UTF-8")
|
||||
val H = Crypto.sha256(R)
|
||||
}
|
||||
|
||||
object Bob {
|
||||
val (_, commitKey) = Base58Check.decode("cSupnaiBh6jgTcQf9QANCB5fZtXojxkJQczq5kwfSBeULjNd5Ypo")
|
||||
val (_, escapeKey) = Base58Check.decode("cQLk5fMydgVwJjygt9ta8GcUU4GXLumNiXJCQviibs2LE5vyMXey")
|
||||
val commitPubKey = Crypto.publicKeyFromPrivateKey(commitKey)
|
||||
val escapePubKey = Crypto.publicKeyFromPrivateKey(escapeKey)
|
||||
val R = "this is Bob's R".getBytes("UTF-8")
|
||||
val H = Crypto.sha256(R)
|
||||
}
|
||||
|
||||
val anchorTx = {
|
||||
val redeemScript = OP_HASH256 :: OP_PUSHDATA(Alice.H) :: OP_EQUAL ::
|
||||
OP_IF ::
|
||||
OP_PUSHDATA(Bob.escapeKey) ::
|
||||
OP_ELSE ::
|
||||
OP_PUSHDATA(Bob.commitKey) ::
|
||||
OP_ENDIF ::
|
||||
OP_2 :: OP_SWAP :: OP_PUSHDATA(Alice.commitPubKey) :: OP_2 :: OP_CHECKMULTISIG :: Nil
|
||||
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(outPoint = OutPoint(previousTx.hash, 0), signatureScript = Array.empty[Byte], sequence = 0xffffffffL) :: Nil,
|
||||
txOut = TxOut(100, OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(Script.write(redeemScript))) :: OP_EQUAL :: Nil) :: Nil,
|
||||
lockTime = 0
|
||||
)
|
||||
val sigA = Transaction.signInput(tmpTx, 0, tmpTx.txOut(0).publicKeyScript, SIGHASH_ALL, Alice.commitKey)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
package fr.acinq.lightning
|
||||
|
||||
import fr.acinq.bitcoin._
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
object TestSighashNoInput extends App {
|
||||
val SIGHASH_NOINPUT = 0 // does not work anymore on bitcoin-lib/master...
|
||||
val keyAlice: BinaryData = "C0B91A94A26DC9BE07374C2280E43B1DE54BE568B2509EF3CE1ADE5C9CF9E8AA"
|
||||
val pubAlice = Crypto.publicKeyFromPrivateKey(keyAlice)
|
||||
|
||||
val keyBob: BinaryData = "5C3D081615591ABCE914D231BA009D8AE0174759E4A9AE821D97E28F122E2F8C"
|
||||
val pubBob = Crypto.publicKeyFromPrivateKey(keyBob)
|
||||
|
||||
val openingTx = {
|
||||
val previousTx = Transaction.read("0100000001bb4f5a244b29dc733c56f80c0fed7dd395367d9d3b416c01767c5123ef124f82000000006b4830450221009e6ed264343e43dfee2373b925915f7a4468e0bc68216606e40064561e6c097a022030f2a50546a908579d0fab539d5726a1f83cfd48d29b89ab078d649a8e2131a0012103c80b6c289bf0421d010485cec5f02636d18fb4ed0f33bfa6412e20918ebd7a34ffffffff0200093d00000000001976a9145dbf52b8d7af4fb5f9b75b808f0a8284493531b388acf0b0b805000000001976a914807c74c89592e8a260f04b5a3bc63e7bef8c282588ac00000000")
|
||||
val key = SignData(previousTx.txOut(0).publicKeyScript, Base58Check.decode("cV7LGVeY2VPuCyCSarqEqFCUNig2NzwiAEBTTA89vNRQ4Vqjfurs")._2)
|
||||
|
||||
|
||||
// create a pub key script that can be redeemed either:
|
||||
// by Alice alone, in a tx which locktime is > 100
|
||||
// or by Alice and Bob, anytime
|
||||
val scriptPubKey = OP_IF ::
|
||||
OP_PUSHDATA(Seq(100: Byte)) :: OP_CHECKLOCKTIMEVERIFY :: OP_DROP :: OP_PUSHDATA(pubAlice) :: OP_CHECKSIG ::
|
||||
OP_ELSE ::
|
||||
OP_2 :: OP_PUSHDATA(pubAlice) :: OP_PUSHDATA(pubBob) :: OP_2 :: OP_CHECKMULTISIG :: OP_ENDIF :: Nil
|
||||
|
||||
// create a tx that sends money to scriptPubKey
|
||||
val tx = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1L,
|
||||
txIn = TxIn(OutPoint(previousTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = TxOut(amount = 100, publicKeyScript = scriptPubKey) :: Nil,
|
||||
lockTime = 0
|
||||
)
|
||||
Transaction.sign(tmpTx, Seq(key))
|
||||
}
|
||||
|
||||
Transaction.correctlySpends(tx, Seq(previousTx), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
|
||||
tx
|
||||
}
|
||||
|
||||
println(openingTx)
|
||||
|
||||
// step #1: basic payment tx
|
||||
//
|
||||
|
||||
// Alice signs a payment tx (99 BTC to Alice, 1 BTC to Bob)
|
||||
val paymentTx1 = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(openingTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = Seq(
|
||||
TxOut(amount = 99, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil),
|
||||
TxOut(amount = 1, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubBob)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil)
|
||||
),
|
||||
lockTime = 0
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
// Bob can redeem a payment tx by adding his signature to its sig script
|
||||
def bobRedeemsPayment(tx : Transaction, key: BinaryData) : Transaction = {
|
||||
val sigBob = Transaction.signInput(tx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, key)
|
||||
val sigAlice = Script.parse(tx.txIn(0).signatureScript) match {
|
||||
case OP_PUSHDATA(value, _) :: Nil => value
|
||||
case _ => throw new RuntimeException("cannot find Alice's signature")
|
||||
}
|
||||
val sigScript = OP_0 :: OP_PUSHDATA(sigAlice) :: OP_PUSHDATA(sigBob) :: OP_0 :: Nil
|
||||
val tx1 = tx.updateSigScript(0, Script.write(sigScript))
|
||||
Transaction.correctlySpends(tx1, Seq(openingTx), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS | ScriptFlags.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)
|
||||
tx1
|
||||
}
|
||||
|
||||
// bob can use this payment tx
|
||||
bobRedeemsPayment(paymentTx1, keyBob)
|
||||
|
||||
val paymentTx2 = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(openingTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = Seq(
|
||||
TxOut(amount = 98, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil),
|
||||
TxOut(amount = 2, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubBob)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil)
|
||||
),
|
||||
lockTime = 0
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
bobRedeemsPayment(paymentTx2, keyBob)
|
||||
|
||||
// step #2: revocable payment tx
|
||||
//
|
||||
val random = new Random()
|
||||
|
||||
def newKeys : (BinaryData, BinaryData) = {
|
||||
val priv = new Array[Byte](32)
|
||||
random.nextBytes(priv)
|
||||
val pub = Crypto.publicKeyFromPrivateKey(priv)
|
||||
(priv, pub)
|
||||
}
|
||||
|
||||
// Bob creates a temp address and sends it to Alice
|
||||
val (keyBobTmp1, bobTempPub1) = newKeys
|
||||
|
||||
// Alice create a tx that spends our opening tx to
|
||||
// a multisig address 2-of-2 pubAlice bobTempPub1
|
||||
// this tx is not timelocked
|
||||
// this tx is sent to Bob
|
||||
val redeemScript1 = Script.createMultiSigMofN(2, List(pubAlice, bobTempPub1))
|
||||
|
||||
val revocablePaymentTx1 = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(openingTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = Seq(
|
||||
TxOut(amount = 99, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil),
|
||||
TxOut(amount = 1, publicKeyScript = OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(redeemScript1)) :: OP_EQUAL :: Nil)
|
||||
),
|
||||
lockTime = 0
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
// Alice then creates a tx that spends from the tx defined above to Bob.
|
||||
// this tx is timelocked and cannot be spent right away
|
||||
// this tx is sent to Bob
|
||||
val revocablePaymentTx1a = {
|
||||
val tmpTx = Transaction(
|
||||
version = 2,
|
||||
txIn = TxIn(OutPoint(revocablePaymentTx1.hash, 1), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = TxOut(amount = 1, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubBob)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil) :: Nil,
|
||||
lockTime = 100
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, redeemScript1, SIGHASH_ALL | SIGHASH_NOINPUT, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
// we can spend this tx if we know Bob's temporary private key
|
||||
val revocablePaymentTx1updated = {
|
||||
val tmpTx = revocablePaymentTx1a
|
||||
val sigBob = Transaction.signInput(tmpTx, 0, redeemScript1, SIGHASH_ALL | SIGHASH_NOINPUT, keyBobTmp1)
|
||||
val sigAlice = Script.parse(tmpTx.txIn(0).signatureScript) match {
|
||||
case OP_PUSHDATA(value, _) :: Nil => value
|
||||
case _ => throw new RuntimeException("cannot find Alice's signature")
|
||||
}
|
||||
val sigScript = OP_0 :: OP_PUSHDATA(sigAlice) :: OP_PUSHDATA(sigBob) :: OP_PUSHDATA(redeemScript1) :: Nil
|
||||
tmpTx.updateSigScript(0, Script.write(sigScript))
|
||||
}
|
||||
|
||||
Transaction.correctlySpends(revocablePaymentTx1updated, Map(OutPoint(revocablePaymentTx1.hash, 1) -> revocablePaymentTx1.txOut(1).publicKeyScript), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
|
||||
|
||||
|
||||
// now we want to update the channel and send 2 BTC to Bob instead of 1
|
||||
// Bob creates a new temp address and sends it to Alice
|
||||
// Bob also sends his first temp key to Alice !!
|
||||
val (keyBobTmp2, bobTempPub2) = newKeys
|
||||
|
||||
val redeemScript2 = Script.createMultiSigMofN(2, List(pubAlice, bobTempPub2))
|
||||
|
||||
val revocablePaymentTx2 = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(openingTx.hash, 0), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = Seq(
|
||||
TxOut(amount = 98, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil),
|
||||
TxOut(amount = 2, publicKeyScript = OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(redeemScript2)) :: OP_EQUAL :: Nil)
|
||||
),
|
||||
lockTime = 0
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, openingTx.txOut(0).publicKeyScript, SIGHASH_ALL, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
// Alice then creates a tx that spends from the tx defined above to Bob.
|
||||
// this tx is timelocked and cannot be spent right away
|
||||
val revocablePaymentTx2a = {
|
||||
val tmpTx = Transaction(
|
||||
version = 2,
|
||||
txIn = TxIn(OutPoint(revocablePaymentTx2.hash, 1), sequence = 0L, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = TxOut(amount = 1, publicKeyScript = OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubBob)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil) :: Nil,
|
||||
lockTime = 100
|
||||
)
|
||||
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, redeemScript2, SIGHASH_ALL | SIGHASH_NOINPUT, keyAlice)
|
||||
val sigScript = Script.write(OP_PUSHDATA(sigAlice) :: Nil)
|
||||
tmpTx.updateSigScript(0, sigScript)
|
||||
}
|
||||
|
||||
// so what happens if Bob wants to spend tx1a and ?
|
||||
// first, he must sign the first revocable payment tx and publish it
|
||||
val revocablePaymentTx1Bob = bobRedeemsPayment(revocablePaymentTx1, keyBob)
|
||||
|
||||
def updateOutPoint(tx: Transaction, i: Int, outPoint: OutPoint) : Transaction = {
|
||||
tx.copy(txIn = tx.txIn.updated(i, tx.txIn(i).copy(outPoint = outPoint)))
|
||||
}
|
||||
|
||||
// he must now claim the multisig output
|
||||
val revocablePaymentTx1aBob = {
|
||||
val tmpTx = updateOutPoint(revocablePaymentTx1a, 0, OutPoint(revocablePaymentTx1Bob.hash, 1))
|
||||
val sigBob = Transaction.signInput(tmpTx, 0, redeemScript1, SIGHASH_ALL | SIGHASH_NOINPUT, keyBobTmp1)
|
||||
val sigAlice = Script.parse(tmpTx.txIn(0).signatureScript) match {
|
||||
case OP_PUSHDATA(value, _) :: Nil => value
|
||||
case _ => throw new RuntimeException("cannot find Alice's signature")
|
||||
}
|
||||
val sigScript = OP_0 :: OP_PUSHDATA(sigAlice) :: OP_PUSHDATA(sigBob) :: OP_PUSHDATA(redeemScript1) :: Nil
|
||||
tmpTx.updateSigScript(0, Script.write(sigScript))
|
||||
}
|
||||
Transaction.correctlySpends(revocablePaymentTx1aBob, Seq(revocablePaymentTx1Bob), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
|
||||
|
||||
// but his tx has a locktime !!
|
||||
|
||||
// Alice, as soon as shes sees that revocablePaymentTx1Bob hash been published, can claim its output right away
|
||||
// her tx is not timelocked
|
||||
val txAliceTakesAll = {
|
||||
val tmpTx = Transaction(
|
||||
version = 1,
|
||||
txIn = TxIn(OutPoint(revocablePaymentTx1Bob.hash, 1), sequence = 0xffffffffL, signatureScript = Array.empty[Byte]) :: Nil,
|
||||
txOut = TxOut(1, OP_DUP :: OP_HASH160 :: OP_PUSHDATA(Crypto.hash160(pubAlice)) :: OP_EQUALVERIFY :: OP_CHECKSIG :: Nil) :: Nil,
|
||||
lockTime = 0
|
||||
)
|
||||
val sigAlice = Transaction.signInput(tmpTx, 0, redeemScript1, SIGHASH_ALL, keyAlice)
|
||||
val sigBob = Transaction.signInput(tmpTx, 0, redeemScript1, SIGHASH_ALL, keyBobTmp1)
|
||||
val sigScript = OP_0 :: OP_PUSHDATA(sigAlice) :: OP_PUSHDATA(sigBob) :: OP_PUSHDATA(redeemScript1) :: Nil
|
||||
tmpTx.updateSigScript(0, Script.write(sigScript))
|
||||
}
|
||||
Transaction.correctlySpends(txAliceTakesAll, Seq(revocablePaymentTx1Bob), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
object InternalFields_srcMainProtobufLightningProto {
|
||||
def internalFieldsFor(scalaName: String): Seq[Descriptors.FieldDescriptor] = scalaName match {
|
||||
case "lightning.sha256_hash" => Seq(Descriptors.FieldDescriptor(0, 1, "a", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "b", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(2, 3, "c", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(3, 4, "d", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None))
|
||||
case "lightning.signature" => Seq(Descriptors.FieldDescriptor(0, 1, "r1", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "r2", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(2, 3, "r3", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(3, 4, "r4", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(4, 5, "s1", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(5, 6, "s2", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(6, 7, "s3", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(7, 8, "s4", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.FIXED64), isPacked = false, containingOneofName = None))
|
||||
case "lightning.locktime" => Seq(Descriptors.FieldDescriptor(0, 1, "seconds", Descriptors.Optional, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.INT, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT32), isPacked = false, containingOneofName = Some("locktime")), Descriptors.FieldDescriptor(1, 2, "blocks", Descriptors.Optional, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.INT, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT32), isPacked = false, containingOneofName = Some("locktime")))
|
||||
case "lightning.bitcoin_pubkey" => Seq(Descriptors.FieldDescriptor(0, 1, "key", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.BYTE_STRING, com.google.protobuf.Descriptors.FieldDescriptor.Type.BYTES), isPacked = false, containingOneofName = None))
|
||||
case "lightning.open_channel" => Seq(Descriptors.FieldDescriptor(0, 2, "delay", Descriptors.Required, Descriptors.MessageType(lightning.locktime.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 4, "revocation_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(2, 5, "commit_key", Descriptors.Required, Descriptors.MessageType(lightning.bitcoin_pubkey.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(3, 1, "final_key", Descriptors.Required, Descriptors.MessageType(lightning.bitcoin_pubkey.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(4, 6, "anch", Descriptors.Required, Descriptors.EnumType(lightning.open_channel.anchor_offer.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(5, 7, "min_depth", Descriptors.Optional, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.INT, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT32), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(6, 8, "commitment_fee", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT64), isPacked = false, containingOneofName = None))
|
||||
case "lightning.open_anchor" => Seq(Descriptors.FieldDescriptor(0, 1, "txid", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "output_index", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.INT, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT32), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(2, 3, "amount", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(3, 4, "commit_sig", Descriptors.Required, Descriptors.MessageType(lightning.signature.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.open_commit_sig" => Seq(Descriptors.FieldDescriptor(0, 1, "sig", Descriptors.Required, Descriptors.MessageType(lightning.signature.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.open_complete" => Seq(Descriptors.FieldDescriptor(0, 1, "blockid", Descriptors.Optional, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update" => Seq(Descriptors.FieldDescriptor(0, 1, "revocation_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "delta", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.SINT64), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_add_htlc" => Seq(Descriptors.FieldDescriptor(0, 1, "revocation_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "amount", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT64), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(2, 3, "r_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(3, 4, "expiry", Descriptors.Required, Descriptors.MessageType(lightning.locktime.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_complete_htlc" => Seq(Descriptors.FieldDescriptor(0, 1, "revocation_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 3, "r", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_remove_htlc" => Seq(Descriptors.FieldDescriptor(0, 1, "revocation_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 3, "r_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_remove_htlc_delay" => Seq(Descriptors.FieldDescriptor(0, 1, "r_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_accept" => Seq(Descriptors.FieldDescriptor(0, 1, "sig", Descriptors.Required, Descriptors.MessageType(lightning.signature.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 3, "revocation_hash", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_signature" => Seq(Descriptors.FieldDescriptor(0, 1, "sig", Descriptors.Required, Descriptors.MessageType(lightning.signature.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "revocation_preimage", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.update_complete" => Seq(Descriptors.FieldDescriptor(0, 1, "revocation_preimage", Descriptors.Required, Descriptors.MessageType(lightning.sha256_hash.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.close_channel" => Seq(Descriptors.FieldDescriptor(0, 1, "sig", Descriptors.Required, Descriptors.MessageType(lightning.signature.descriptor), isPacked = false, containingOneofName = None), Descriptors.FieldDescriptor(1, 2, "close_fee", Descriptors.Required, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.LONG, com.google.protobuf.Descriptors.FieldDescriptor.Type.UINT64), isPacked = false, containingOneofName = None))
|
||||
case "lightning.close_channel_complete" => Seq(Descriptors.FieldDescriptor(0, 1, "sig", Descriptors.Required, Descriptors.MessageType(lightning.signature.descriptor), isPacked = false, containingOneofName = None))
|
||||
case "lightning.error" => Seq(Descriptors.FieldDescriptor(0, 1, "problem", Descriptors.Optional, Descriptors.PrimitiveType(com.google.protobuf.Descriptors.FieldDescriptor.JavaType.STRING, com.google.protobuf.Descriptors.FieldDescriptor.Type.STRING), isPacked = false, containingOneofName = None))
|
||||
case "lightning.pkt" => Seq(Descriptors.FieldDescriptor(0, 201, "open", Descriptors.Optional, Descriptors.MessageType(lightning.open_channel.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(1, 202, "open_anchor", Descriptors.Optional, Descriptors.MessageType(lightning.open_anchor.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(2, 203, "open_commit_sig", Descriptors.Optional, Descriptors.MessageType(lightning.open_commit_sig.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(3, 204, "open_complete", Descriptors.Optional, Descriptors.MessageType(lightning.open_complete.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(4, 1, "update", Descriptors.Optional, Descriptors.MessageType(lightning.update.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(5, 2, "update_add_htlc", Descriptors.Optional, Descriptors.MessageType(lightning.update_add_htlc.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(6, 3, "update_accept", Descriptors.Optional, Descriptors.MessageType(lightning.update_accept.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(7, 4, "update_signature", Descriptors.Optional, Descriptors.MessageType(lightning.update_signature.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(8, 5, "update_complete", Descriptors.Optional, Descriptors.MessageType(lightning.update_complete.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(9, 6, "update_complete_htlc", Descriptors.Optional, Descriptors.MessageType(lightning.update_complete_htlc.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(10, 7, "update_remove_htlc", Descriptors.Optional, Descriptors.MessageType(lightning.update_remove_htlc.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(11, 8, "update_remove_htlc_delay", Descriptors.Optional, Descriptors.MessageType(lightning.update_remove_htlc_delay.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(12, 401, "close", Descriptors.Optional, Descriptors.MessageType(lightning.close_channel.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(13, 402, "close_complete", Descriptors.Optional, Descriptors.MessageType(lightning.close_channel_complete.descriptor), isPacked = false, containingOneofName = Some("pkt")), Descriptors.FieldDescriptor(14, 1000, "error", Descriptors.Optional, Descriptors.MessageType(lightning.error.descriptor), isPacked = false, containingOneofName = Some("pkt")))
|
||||
}
|
||||
}
|
63
eclair-demo/src/main/scala/lightning/bitcoin_pubkey.scala
Normal file
63
eclair-demo/src/main/scala/lightning/bitcoin_pubkey.scala
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class bitcoin_pubkey(
|
||||
key: com.google.protobuf.ByteString
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[bitcoin_pubkey] with com.trueaccord.lenses.Updatable[bitcoin_pubkey] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, key)
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeBytes(1, key)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.bitcoin_pubkey = {
|
||||
var __key = this.key
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__key = __input.readBytes()
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.bitcoin_pubkey(
|
||||
key = __key
|
||||
)
|
||||
}
|
||||
def withKey(__v: com.google.protobuf.ByteString): bitcoin_pubkey = copy(key = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => key
|
||||
}
|
||||
}
|
||||
def companion = lightning.bitcoin_pubkey
|
||||
}
|
||||
|
||||
object bitcoin_pubkey extends com.trueaccord.scalapb.GeneratedMessageCompanion[bitcoin_pubkey] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[bitcoin_pubkey] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.bitcoin_pubkey = lightning.bitcoin_pubkey(
|
||||
key = fieldsMap(1).asInstanceOf[com.google.protobuf.ByteString]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("bitcoin_pubkey", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.bitcoin_pubkey"))
|
||||
lazy val defaultInstance = lightning.bitcoin_pubkey(
|
||||
key = com.google.protobuf.ByteString.copyFrom(Array[Byte]())
|
||||
)
|
||||
implicit class bitcoin_pubkeyLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, bitcoin_pubkey]) extends com.trueaccord.lenses.ObjectLens[UpperPB, bitcoin_pubkey](_l) {
|
||||
def key: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.ByteString] = field(_.key)((c_, f_) => c_.copy(key = f_))
|
||||
}
|
||||
final val KEY_FIELD_NUMBER = 1
|
||||
}
|
78
eclair-demo/src/main/scala/lightning/close_channel.scala
Normal file
78
eclair-demo/src/main/scala/lightning/close_channel.scala
Normal file
|
@ -0,0 +1,78 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class close_channel(
|
||||
sig: lightning.signature,
|
||||
closeFee: Long
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[close_channel] with com.trueaccord.lenses.Updatable[close_channel] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(sig.serializedSize) + sig.serializedSize
|
||||
__size += com.google.protobuf.CodedOutputStream.computeUInt64Size(2, closeFee)
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(sig.serializedSize)
|
||||
sig.writeTo(output)
|
||||
output.writeUInt64(2, closeFee)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.close_channel = {
|
||||
var __sig = this.sig
|
||||
var __closeFee = this.closeFee
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__sig = com.trueaccord.scalapb.LiteParser.readMessage(__input, __sig)
|
||||
case 16 =>
|
||||
__closeFee = __input.readUInt64()
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.close_channel(
|
||||
sig = __sig,
|
||||
closeFee = __closeFee
|
||||
)
|
||||
}
|
||||
def withSig(__v: lightning.signature): close_channel = copy(sig = __v)
|
||||
def withCloseFee(__v: Long): close_channel = copy(closeFee = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => sig
|
||||
case 2 => closeFee
|
||||
}
|
||||
}
|
||||
def companion = lightning.close_channel
|
||||
}
|
||||
|
||||
object close_channel extends com.trueaccord.scalapb.GeneratedMessageCompanion[close_channel] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[close_channel] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.close_channel = lightning.close_channel(
|
||||
sig = fieldsMap(1).asInstanceOf[lightning.signature],
|
||||
closeFee = fieldsMap(2).asInstanceOf[Long]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("close_channel", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.close_channel"))
|
||||
lazy val defaultInstance = lightning.close_channel(
|
||||
sig = lightning.signature.defaultInstance,
|
||||
closeFee = 0L
|
||||
)
|
||||
implicit class close_channelLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, close_channel]) extends com.trueaccord.lenses.ObjectLens[UpperPB, close_channel](_l) {
|
||||
def sig: com.trueaccord.lenses.Lens[UpperPB, lightning.signature] = field(_.sig)((c_, f_) => c_.copy(sig = f_))
|
||||
def closeFee: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.closeFee)((c_, f_) => c_.copy(closeFee = f_))
|
||||
}
|
||||
final val SIG_FIELD_NUMBER = 1
|
||||
final val CLOSE_FEE_FIELD_NUMBER = 2
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class close_channel_complete(
|
||||
sig: lightning.signature
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[close_channel_complete] with com.trueaccord.lenses.Updatable[close_channel_complete] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(sig.serializedSize) + sig.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(sig.serializedSize)
|
||||
sig.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.close_channel_complete = {
|
||||
var __sig = this.sig
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__sig = com.trueaccord.scalapb.LiteParser.readMessage(__input, __sig)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.close_channel_complete(
|
||||
sig = __sig
|
||||
)
|
||||
}
|
||||
def withSig(__v: lightning.signature): close_channel_complete = copy(sig = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => sig
|
||||
}
|
||||
}
|
||||
def companion = lightning.close_channel_complete
|
||||
}
|
||||
|
||||
object close_channel_complete extends com.trueaccord.scalapb.GeneratedMessageCompanion[close_channel_complete] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[close_channel_complete] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.close_channel_complete = lightning.close_channel_complete(
|
||||
sig = fieldsMap(1).asInstanceOf[lightning.signature]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("close_channel_complete", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.close_channel_complete"))
|
||||
lazy val defaultInstance = lightning.close_channel_complete(
|
||||
sig = lightning.signature.defaultInstance
|
||||
)
|
||||
implicit class close_channel_completeLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, close_channel_complete]) extends com.trueaccord.lenses.ObjectLens[UpperPB, close_channel_complete](_l) {
|
||||
def sig: com.trueaccord.lenses.Lens[UpperPB, lightning.signature] = field(_.sig)((c_, f_) => c_.copy(sig = f_))
|
||||
}
|
||||
final val SIG_FIELD_NUMBER = 1
|
||||
}
|
67
eclair-demo/src/main/scala/lightning/error.scala
Normal file
67
eclair-demo/src/main/scala/lightning/error.scala
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class error(
|
||||
problem: Option[String] = None
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[error] with com.trueaccord.lenses.Updatable[error] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
if (problem.isDefined) { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, problem.get) }
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
problem.foreach { v =>
|
||||
output.writeString(1, v)
|
||||
}
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.error = {
|
||||
var __problem = this.problem
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__problem = Some(__input.readString())
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.error(
|
||||
problem = __problem
|
||||
)
|
||||
}
|
||||
def getProblem: String = problem.getOrElse("")
|
||||
def clearProblem: error = copy(problem = None)
|
||||
def withProblem(__v: String): error = copy(problem = Some(__v))
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => problem
|
||||
}
|
||||
}
|
||||
def companion = lightning.error
|
||||
}
|
||||
|
||||
object error extends com.trueaccord.scalapb.GeneratedMessageCompanion[error] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[error] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.error = lightning.error(
|
||||
problem = fieldsMap.getOrElse(1, None).asInstanceOf[Option[String]]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("error", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.error"))
|
||||
lazy val defaultInstance = lightning.error(
|
||||
)
|
||||
implicit class errorLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, error]) extends com.trueaccord.lenses.ObjectLens[UpperPB, error](_l) {
|
||||
def problem: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getProblem)((c_, f_) => c_.copy(problem = Some(f_)))
|
||||
def optionalProblem: com.trueaccord.lenses.Lens[UpperPB, Option[String]] = field(_.problem)((c_, f_) => c_.copy(problem = f_))
|
||||
}
|
||||
final val PROBLEM_FIELD_NUMBER = 1
|
||||
}
|
110
eclair-demo/src/main/scala/lightning/locktime.scala
Normal file
110
eclair-demo/src/main/scala/lightning/locktime.scala
Normal file
|
@ -0,0 +1,110 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class locktime(
|
||||
locktime: lightning.locktime.Locktime = lightning.locktime.Locktime.Empty
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[locktime] with com.trueaccord.lenses.Updatable[locktime] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
if (locktime.seconds.isDefined) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(1, locktime.seconds.get) }
|
||||
if (locktime.blocks.isDefined) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(2, locktime.blocks.get) }
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
locktime.seconds.foreach { v =>
|
||||
output.writeUInt32(1, v)
|
||||
}
|
||||
locktime.blocks.foreach { v =>
|
||||
output.writeUInt32(2, v)
|
||||
}
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.locktime = {
|
||||
var __locktime = this.locktime
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 8 =>
|
||||
__locktime = lightning.locktime.Locktime.Seconds(__input.readUInt32())
|
||||
case 16 =>
|
||||
__locktime = lightning.locktime.Locktime.Blocks(__input.readUInt32())
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.locktime(
|
||||
locktime = __locktime
|
||||
)
|
||||
}
|
||||
def getSeconds: Int = locktime.seconds.getOrElse(0)
|
||||
def withSeconds(__v: Int): locktime = copy(locktime = lightning.locktime.Locktime.Seconds(__v))
|
||||
def getBlocks: Int = locktime.blocks.getOrElse(0)
|
||||
def withBlocks(__v: Int): locktime = copy(locktime = lightning.locktime.Locktime.Blocks(__v))
|
||||
def clearLocktime: locktime = copy(locktime = lightning.locktime.Locktime.Empty)
|
||||
def withLocktime(__v: lightning.locktime.Locktime): locktime = copy(locktime = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => locktime.seconds
|
||||
case 2 => locktime.blocks
|
||||
}
|
||||
}
|
||||
def companion = lightning.locktime
|
||||
}
|
||||
|
||||
object locktime extends com.trueaccord.scalapb.GeneratedMessageCompanion[locktime] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[locktime] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.locktime = lightning.locktime(
|
||||
locktime = fieldsMap.getOrElse(1, None).asInstanceOf[Option[Int]].map(value => lightning.locktime.Locktime.Seconds(value)) orElse
|
||||
fieldsMap.getOrElse(2, None).asInstanceOf[Option[Int]].map(value => lightning.locktime.Locktime.Blocks(value)) getOrElse lightning.locktime.Locktime.Empty
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("locktime", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.locktime"))
|
||||
lazy val defaultInstance = lightning.locktime(
|
||||
)
|
||||
sealed trait Locktime extends com.trueaccord.scalapb.GeneratedOneof {
|
||||
def isEmpty: Boolean = false
|
||||
def isDefined: Boolean = true
|
||||
def number: Int
|
||||
def isSeconds: Boolean = false
|
||||
def isBlocks: Boolean = false
|
||||
def seconds: Option[Int] = None
|
||||
def blocks: Option[Int] = None
|
||||
}
|
||||
object Locktime extends {
|
||||
@SerialVersionUID(0L)
|
||||
case object Empty extends Locktime {
|
||||
override def isEmpty: Boolean = true
|
||||
override def isDefined: Boolean = false
|
||||
override def number: Int = 0
|
||||
}
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
case class Seconds(value: Int) extends Locktime {
|
||||
override def isSeconds: Boolean = true
|
||||
override def seconds: Option[Int] = Some(value)
|
||||
override def number: Int = 1
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class Blocks(value: Int) extends Locktime {
|
||||
override def isBlocks: Boolean = true
|
||||
override def blocks: Option[Int] = Some(value)
|
||||
override def number: Int = 2
|
||||
}
|
||||
}
|
||||
implicit class locktimeLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, locktime]) extends com.trueaccord.lenses.ObjectLens[UpperPB, locktime](_l) {
|
||||
def seconds: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getSeconds)((c_, f_) => c_.copy(locktime = lightning.locktime.Locktime.Seconds(f_)))
|
||||
def blocks: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getBlocks)((c_, f_) => c_.copy(locktime = lightning.locktime.Locktime.Blocks(f_)))
|
||||
def locktime: com.trueaccord.lenses.Lens[UpperPB, lightning.locktime.Locktime] = field(_.locktime)((c_, f_) => c_.copy(locktime = f_))
|
||||
}
|
||||
final val SECONDS_FIELD_NUMBER = 1
|
||||
final val BLOCKS_FIELD_NUMBER = 2
|
||||
}
|
106
eclair-demo/src/main/scala/lightning/open_anchor.scala
Normal file
106
eclair-demo/src/main/scala/lightning/open_anchor.scala
Normal file
|
@ -0,0 +1,106 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class open_anchor(
|
||||
txid: lightning.sha256_hash,
|
||||
outputIndex: Int,
|
||||
amount: Long,
|
||||
commitSig: lightning.signature
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[open_anchor] with com.trueaccord.lenses.Updatable[open_anchor] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(txid.serializedSize) + txid.serializedSize
|
||||
__size += com.google.protobuf.CodedOutputStream.computeUInt32Size(2, outputIndex)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeUInt64Size(3, amount)
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(commitSig.serializedSize) + commitSig.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(txid.serializedSize)
|
||||
txid.writeTo(output)
|
||||
output.writeUInt32(2, outputIndex)
|
||||
output.writeUInt64(3, amount)
|
||||
output.writeTag(4, 2)
|
||||
output.writeRawVarint32(commitSig.serializedSize)
|
||||
commitSig.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.open_anchor = {
|
||||
var __txid = this.txid
|
||||
var __outputIndex = this.outputIndex
|
||||
var __amount = this.amount
|
||||
var __commitSig = this.commitSig
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__txid = com.trueaccord.scalapb.LiteParser.readMessage(__input, __txid)
|
||||
case 16 =>
|
||||
__outputIndex = __input.readUInt32()
|
||||
case 24 =>
|
||||
__amount = __input.readUInt64()
|
||||
case 34 =>
|
||||
__commitSig = com.trueaccord.scalapb.LiteParser.readMessage(__input, __commitSig)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.open_anchor(
|
||||
txid = __txid,
|
||||
outputIndex = __outputIndex,
|
||||
amount = __amount,
|
||||
commitSig = __commitSig
|
||||
)
|
||||
}
|
||||
def withTxid(__v: lightning.sha256_hash): open_anchor = copy(txid = __v)
|
||||
def withOutputIndex(__v: Int): open_anchor = copy(outputIndex = __v)
|
||||
def withAmount(__v: Long): open_anchor = copy(amount = __v)
|
||||
def withCommitSig(__v: lightning.signature): open_anchor = copy(commitSig = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => txid
|
||||
case 2 => outputIndex
|
||||
case 3 => amount
|
||||
case 4 => commitSig
|
||||
}
|
||||
}
|
||||
def companion = lightning.open_anchor
|
||||
}
|
||||
|
||||
object open_anchor extends com.trueaccord.scalapb.GeneratedMessageCompanion[open_anchor] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[open_anchor] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.open_anchor = lightning.open_anchor(
|
||||
txid = fieldsMap(1).asInstanceOf[lightning.sha256_hash],
|
||||
outputIndex = fieldsMap(2).asInstanceOf[Int],
|
||||
amount = fieldsMap(3).asInstanceOf[Long],
|
||||
commitSig = fieldsMap(4).asInstanceOf[lightning.signature]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("open_anchor", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.open_anchor"))
|
||||
lazy val defaultInstance = lightning.open_anchor(
|
||||
txid = lightning.sha256_hash.defaultInstance,
|
||||
outputIndex = 0,
|
||||
amount = 0L,
|
||||
commitSig = lightning.signature.defaultInstance
|
||||
)
|
||||
implicit class open_anchorLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, open_anchor]) extends com.trueaccord.lenses.ObjectLens[UpperPB, open_anchor](_l) {
|
||||
def txid: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.txid)((c_, f_) => c_.copy(txid = f_))
|
||||
def outputIndex: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.outputIndex)((c_, f_) => c_.copy(outputIndex = f_))
|
||||
def amount: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.amount)((c_, f_) => c_.copy(amount = f_))
|
||||
def commitSig: com.trueaccord.lenses.Lens[UpperPB, lightning.signature] = field(_.commitSig)((c_, f_) => c_.copy(commitSig = f_))
|
||||
}
|
||||
final val TXID_FIELD_NUMBER = 1
|
||||
final val OUTPUT_INDEX_FIELD_NUMBER = 2
|
||||
final val AMOUNT_FIELD_NUMBER = 3
|
||||
final val COMMIT_SIG_FIELD_NUMBER = 4
|
||||
}
|
180
eclair-demo/src/main/scala/lightning/open_channel.scala
Normal file
180
eclair-demo/src/main/scala/lightning/open_channel.scala
Normal file
|
@ -0,0 +1,180 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class open_channel(
|
||||
delay: lightning.locktime,
|
||||
revocationHash: lightning.sha256_hash,
|
||||
commitKey: lightning.bitcoin_pubkey,
|
||||
finalKey: lightning.bitcoin_pubkey,
|
||||
anch: lightning.open_channel.anchor_offer,
|
||||
minDepth: Option[Int] = None,
|
||||
commitmentFee: Long
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[open_channel] with com.trueaccord.lenses.Updatable[open_channel] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(delay.serializedSize) + delay.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationHash.serializedSize) + revocationHash.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(commitKey.serializedSize) + commitKey.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(finalKey.serializedSize) + finalKey.serializedSize
|
||||
__size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, anch.id)
|
||||
if (minDepth.isDefined) { __size += com.google.protobuf.CodedOutputStream.computeUInt32Size(7, minDepth.get) }
|
||||
__size += com.google.protobuf.CodedOutputStream.computeUInt64Size(8, commitmentFee)
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(finalKey.serializedSize)
|
||||
finalKey.writeTo(output)
|
||||
output.writeTag(2, 2)
|
||||
output.writeRawVarint32(delay.serializedSize)
|
||||
delay.writeTo(output)
|
||||
output.writeTag(4, 2)
|
||||
output.writeRawVarint32(revocationHash.serializedSize)
|
||||
revocationHash.writeTo(output)
|
||||
output.writeTag(5, 2)
|
||||
output.writeRawVarint32(commitKey.serializedSize)
|
||||
commitKey.writeTo(output)
|
||||
output.writeEnum(6, anch.id)
|
||||
minDepth.foreach { v =>
|
||||
output.writeUInt32(7, v)
|
||||
}
|
||||
output.writeUInt64(8, commitmentFee)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.open_channel = {
|
||||
var __delay = this.delay
|
||||
var __revocationHash = this.revocationHash
|
||||
var __commitKey = this.commitKey
|
||||
var __finalKey = this.finalKey
|
||||
var __anch = this.anch
|
||||
var __minDepth = this.minDepth
|
||||
var __commitmentFee = this.commitmentFee
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 18 =>
|
||||
__delay = com.trueaccord.scalapb.LiteParser.readMessage(__input, __delay)
|
||||
case 34 =>
|
||||
__revocationHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationHash)
|
||||
case 42 =>
|
||||
__commitKey = com.trueaccord.scalapb.LiteParser.readMessage(__input, __commitKey)
|
||||
case 10 =>
|
||||
__finalKey = com.trueaccord.scalapb.LiteParser.readMessage(__input, __finalKey)
|
||||
case 48 =>
|
||||
__anch = lightning.open_channel.anchor_offer.fromValue(__input.readEnum())
|
||||
case 56 =>
|
||||
__minDepth = Some(__input.readUInt32())
|
||||
case 64 =>
|
||||
__commitmentFee = __input.readUInt64()
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.open_channel(
|
||||
delay = __delay,
|
||||
revocationHash = __revocationHash,
|
||||
commitKey = __commitKey,
|
||||
finalKey = __finalKey,
|
||||
anch = __anch,
|
||||
minDepth = __minDepth,
|
||||
commitmentFee = __commitmentFee
|
||||
)
|
||||
}
|
||||
def withDelay(__v: lightning.locktime): open_channel = copy(delay = __v)
|
||||
def withRevocationHash(__v: lightning.sha256_hash): open_channel = copy(revocationHash = __v)
|
||||
def withCommitKey(__v: lightning.bitcoin_pubkey): open_channel = copy(commitKey = __v)
|
||||
def withFinalKey(__v: lightning.bitcoin_pubkey): open_channel = copy(finalKey = __v)
|
||||
def withAnch(__v: lightning.open_channel.anchor_offer): open_channel = copy(anch = __v)
|
||||
def getMinDepth: Int = minDepth.getOrElse(0)
|
||||
def clearMinDepth: open_channel = copy(minDepth = None)
|
||||
def withMinDepth(__v: Int): open_channel = copy(minDepth = Some(__v))
|
||||
def withCommitmentFee(__v: Long): open_channel = copy(commitmentFee = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 2 => delay
|
||||
case 4 => revocationHash
|
||||
case 5 => commitKey
|
||||
case 1 => finalKey
|
||||
case 6 => anch
|
||||
case 7 => minDepth
|
||||
case 8 => commitmentFee
|
||||
}
|
||||
}
|
||||
def companion = lightning.open_channel
|
||||
}
|
||||
|
||||
object open_channel extends com.trueaccord.scalapb.GeneratedMessageCompanion[open_channel] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[open_channel] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.open_channel = lightning.open_channel(
|
||||
delay = fieldsMap(2).asInstanceOf[lightning.locktime],
|
||||
revocationHash = fieldsMap(4).asInstanceOf[lightning.sha256_hash],
|
||||
commitKey = fieldsMap(5).asInstanceOf[lightning.bitcoin_pubkey],
|
||||
finalKey = fieldsMap(1).asInstanceOf[lightning.bitcoin_pubkey],
|
||||
anch = fieldsMap(6).asInstanceOf[lightning.open_channel.anchor_offer],
|
||||
minDepth = fieldsMap.getOrElse(7, None).asInstanceOf[Option[Int]],
|
||||
commitmentFee = fieldsMap(8).asInstanceOf[Long]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("open_channel", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(lightning.open_channel.anchor_offer.descriptor),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.open_channel"))
|
||||
lazy val defaultInstance = lightning.open_channel(
|
||||
delay = lightning.locktime.defaultInstance,
|
||||
revocationHash = lightning.sha256_hash.defaultInstance,
|
||||
commitKey = lightning.bitcoin_pubkey.defaultInstance,
|
||||
finalKey = lightning.bitcoin_pubkey.defaultInstance,
|
||||
anch = lightning.open_channel.anchor_offer.WILL_CREATE_ANCHOR,
|
||||
commitmentFee = 0L
|
||||
)
|
||||
sealed trait anchor_offer extends com.trueaccord.scalapb.GeneratedEnum {
|
||||
def isWillCreateAnchor: Boolean = false
|
||||
def isWontCreateAnchor: Boolean = false
|
||||
}
|
||||
|
||||
object anchor_offer extends com.trueaccord.scalapb.GeneratedEnumCompanion[anchor_offer] {
|
||||
@SerialVersionUID(0L)
|
||||
case object WILL_CREATE_ANCHOR extends anchor_offer {
|
||||
val id = 1
|
||||
val name = "WILL_CREATE_ANCHOR"
|
||||
override def isWillCreateAnchor: Boolean = true
|
||||
}
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
case object WONT_CREATE_ANCHOR extends anchor_offer {
|
||||
val id = 2
|
||||
val name = "WONT_CREATE_ANCHOR"
|
||||
override def isWontCreateAnchor: Boolean = true
|
||||
}
|
||||
|
||||
lazy val values = Seq(WILL_CREATE_ANCHOR, WONT_CREATE_ANCHOR)
|
||||
def fromValue(value: Int): anchor_offer = value match {
|
||||
case 1 => WILL_CREATE_ANCHOR
|
||||
case 2 => WONT_CREATE_ANCHOR
|
||||
}
|
||||
lazy val descriptor = new Descriptors.EnumDescriptor(0, "anchor_offer", this)
|
||||
}
|
||||
implicit class open_channelLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, open_channel]) extends com.trueaccord.lenses.ObjectLens[UpperPB, open_channel](_l) {
|
||||
def delay: com.trueaccord.lenses.Lens[UpperPB, lightning.locktime] = field(_.delay)((c_, f_) => c_.copy(delay = f_))
|
||||
def revocationHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationHash)((c_, f_) => c_.copy(revocationHash = f_))
|
||||
def commitKey: com.trueaccord.lenses.Lens[UpperPB, lightning.bitcoin_pubkey] = field(_.commitKey)((c_, f_) => c_.copy(commitKey = f_))
|
||||
def finalKey: com.trueaccord.lenses.Lens[UpperPB, lightning.bitcoin_pubkey] = field(_.finalKey)((c_, f_) => c_.copy(finalKey = f_))
|
||||
def anch: com.trueaccord.lenses.Lens[UpperPB, lightning.open_channel.anchor_offer] = field(_.anch)((c_, f_) => c_.copy(anch = f_))
|
||||
def minDepth: com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getMinDepth)((c_, f_) => c_.copy(minDepth = Some(f_)))
|
||||
def optionalMinDepth: com.trueaccord.lenses.Lens[UpperPB, Option[Int]] = field(_.minDepth)((c_, f_) => c_.copy(minDepth = f_))
|
||||
def commitmentFee: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.commitmentFee)((c_, f_) => c_.copy(commitmentFee = f_))
|
||||
}
|
||||
final val DELAY_FIELD_NUMBER = 2
|
||||
final val REVOCATION_HASH_FIELD_NUMBER = 4
|
||||
final val COMMIT_KEY_FIELD_NUMBER = 5
|
||||
final val FINAL_KEY_FIELD_NUMBER = 1
|
||||
final val ANCH_FIELD_NUMBER = 6
|
||||
final val MIN_DEPTH_FIELD_NUMBER = 7
|
||||
final val COMMITMENT_FEE_FIELD_NUMBER = 8
|
||||
}
|
65
eclair-demo/src/main/scala/lightning/open_commit_sig.scala
Normal file
65
eclair-demo/src/main/scala/lightning/open_commit_sig.scala
Normal file
|
@ -0,0 +1,65 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class open_commit_sig(
|
||||
sig: lightning.signature
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[open_commit_sig] with com.trueaccord.lenses.Updatable[open_commit_sig] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(sig.serializedSize) + sig.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(sig.serializedSize)
|
||||
sig.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.open_commit_sig = {
|
||||
var __sig = this.sig
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__sig = com.trueaccord.scalapb.LiteParser.readMessage(__input, __sig)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.open_commit_sig(
|
||||
sig = __sig
|
||||
)
|
||||
}
|
||||
def withSig(__v: lightning.signature): open_commit_sig = copy(sig = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => sig
|
||||
}
|
||||
}
|
||||
def companion = lightning.open_commit_sig
|
||||
}
|
||||
|
||||
object open_commit_sig extends com.trueaccord.scalapb.GeneratedMessageCompanion[open_commit_sig] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[open_commit_sig] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.open_commit_sig = lightning.open_commit_sig(
|
||||
sig = fieldsMap(1).asInstanceOf[lightning.signature]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("open_commit_sig", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.open_commit_sig"))
|
||||
lazy val defaultInstance = lightning.open_commit_sig(
|
||||
sig = lightning.signature.defaultInstance
|
||||
)
|
||||
implicit class open_commit_sigLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, open_commit_sig]) extends com.trueaccord.lenses.ObjectLens[UpperPB, open_commit_sig](_l) {
|
||||
def sig: com.trueaccord.lenses.Lens[UpperPB, lightning.signature] = field(_.sig)((c_, f_) => c_.copy(sig = f_))
|
||||
}
|
||||
final val SIG_FIELD_NUMBER = 1
|
||||
}
|
69
eclair-demo/src/main/scala/lightning/open_complete.scala
Normal file
69
eclair-demo/src/main/scala/lightning/open_complete.scala
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class open_complete(
|
||||
blockid: Option[lightning.sha256_hash] = None
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[open_complete] with com.trueaccord.lenses.Updatable[open_complete] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
if (blockid.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(blockid.get.serializedSize) + blockid.get.serializedSize }
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
blockid.foreach { v =>
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.open_complete = {
|
||||
var __blockid = this.blockid
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__blockid = Some(com.trueaccord.scalapb.LiteParser.readMessage(__input, __blockid.getOrElse(lightning.sha256_hash.defaultInstance)))
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.open_complete(
|
||||
blockid = __blockid
|
||||
)
|
||||
}
|
||||
def getBlockid: lightning.sha256_hash = blockid.getOrElse(lightning.sha256_hash.defaultInstance)
|
||||
def clearBlockid: open_complete = copy(blockid = None)
|
||||
def withBlockid(__v: lightning.sha256_hash): open_complete = copy(blockid = Some(__v))
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => blockid
|
||||
}
|
||||
}
|
||||
def companion = lightning.open_complete
|
||||
}
|
||||
|
||||
object open_complete extends com.trueaccord.scalapb.GeneratedMessageCompanion[open_complete] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[open_complete] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.open_complete = lightning.open_complete(
|
||||
blockid = fieldsMap.getOrElse(1, None).asInstanceOf[Option[lightning.sha256_hash]]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("open_complete", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.open_complete"))
|
||||
lazy val defaultInstance = lightning.open_complete(
|
||||
)
|
||||
implicit class open_completeLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, open_complete]) extends com.trueaccord.lenses.ObjectLens[UpperPB, open_complete](_l) {
|
||||
def blockid: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.getBlockid)((c_, f_) => c_.copy(blockid = Some(f_)))
|
||||
def optionalBlockid: com.trueaccord.lenses.Lens[UpperPB, Option[lightning.sha256_hash]] = field(_.blockid)((c_, f_) => c_.copy(blockid = f_))
|
||||
}
|
||||
final val BLOCKID_FIELD_NUMBER = 1
|
||||
}
|
400
eclair-demo/src/main/scala/lightning/pkt.scala
Normal file
400
eclair-demo/src/main/scala/lightning/pkt.scala
Normal file
|
@ -0,0 +1,400 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class pkt(
|
||||
pkt: lightning.pkt.Pkt = lightning.pkt.Pkt.Empty
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[pkt] with com.trueaccord.lenses.Updatable[pkt] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
if (pkt.open.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.open.get.serializedSize) + pkt.open.get.serializedSize }
|
||||
if (pkt.openAnchor.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.openAnchor.get.serializedSize) + pkt.openAnchor.get.serializedSize }
|
||||
if (pkt.openCommitSig.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.openCommitSig.get.serializedSize) + pkt.openCommitSig.get.serializedSize }
|
||||
if (pkt.openComplete.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.openComplete.get.serializedSize) + pkt.openComplete.get.serializedSize }
|
||||
if (pkt.update.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.update.get.serializedSize) + pkt.update.get.serializedSize }
|
||||
if (pkt.updateAddHtlc.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateAddHtlc.get.serializedSize) + pkt.updateAddHtlc.get.serializedSize }
|
||||
if (pkt.updateAccept.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateAccept.get.serializedSize) + pkt.updateAccept.get.serializedSize }
|
||||
if (pkt.updateSignature.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateSignature.get.serializedSize) + pkt.updateSignature.get.serializedSize }
|
||||
if (pkt.updateComplete.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateComplete.get.serializedSize) + pkt.updateComplete.get.serializedSize }
|
||||
if (pkt.updateCompleteHtlc.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateCompleteHtlc.get.serializedSize) + pkt.updateCompleteHtlc.get.serializedSize }
|
||||
if (pkt.updateRemoveHtlc.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateRemoveHtlc.get.serializedSize) + pkt.updateRemoveHtlc.get.serializedSize }
|
||||
if (pkt.updateRemoveHtlcDelay.isDefined) { __size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.updateRemoveHtlcDelay.get.serializedSize) + pkt.updateRemoveHtlcDelay.get.serializedSize }
|
||||
if (pkt.close.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.close.get.serializedSize) + pkt.close.get.serializedSize }
|
||||
if (pkt.closeComplete.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.closeComplete.get.serializedSize) + pkt.closeComplete.get.serializedSize }
|
||||
if (pkt.error.isDefined) { __size += 2 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(pkt.error.get.serializedSize) + pkt.error.get.serializedSize }
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
pkt.update.foreach { v =>
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateAddHtlc.foreach { v =>
|
||||
output.writeTag(2, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateAccept.foreach { v =>
|
||||
output.writeTag(3, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateSignature.foreach { v =>
|
||||
output.writeTag(4, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateComplete.foreach { v =>
|
||||
output.writeTag(5, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateCompleteHtlc.foreach { v =>
|
||||
output.writeTag(6, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateRemoveHtlc.foreach { v =>
|
||||
output.writeTag(7, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.updateRemoveHtlcDelay.foreach { v =>
|
||||
output.writeTag(8, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.open.foreach { v =>
|
||||
output.writeTag(201, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.openAnchor.foreach { v =>
|
||||
output.writeTag(202, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.openCommitSig.foreach { v =>
|
||||
output.writeTag(203, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.openComplete.foreach { v =>
|
||||
output.writeTag(204, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.close.foreach { v =>
|
||||
output.writeTag(401, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.closeComplete.foreach { v =>
|
||||
output.writeTag(402, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
pkt.error.foreach { v =>
|
||||
output.writeTag(1000, 2)
|
||||
output.writeRawVarint32(v.serializedSize)
|
||||
v.writeTo(output)
|
||||
}
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.pkt = {
|
||||
var __pkt = this.pkt
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 1610 =>
|
||||
__pkt = lightning.pkt.Pkt.Open(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.open.getOrElse(lightning.open_channel.defaultInstance)))
|
||||
case 1618 =>
|
||||
__pkt = lightning.pkt.Pkt.OpenAnchor(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.openAnchor.getOrElse(lightning.open_anchor.defaultInstance)))
|
||||
case 1626 =>
|
||||
__pkt = lightning.pkt.Pkt.OpenCommitSig(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.openCommitSig.getOrElse(lightning.open_commit_sig.defaultInstance)))
|
||||
case 1634 =>
|
||||
__pkt = lightning.pkt.Pkt.OpenComplete(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.openComplete.getOrElse(lightning.open_complete.defaultInstance)))
|
||||
case 10 =>
|
||||
__pkt = lightning.pkt.Pkt.Update(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.update.getOrElse(lightning.update.defaultInstance)))
|
||||
case 18 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateAddHtlc(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateAddHtlc.getOrElse(lightning.update_add_htlc.defaultInstance)))
|
||||
case 26 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateAccept(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateAccept.getOrElse(lightning.update_accept.defaultInstance)))
|
||||
case 34 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateSignature(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateSignature.getOrElse(lightning.update_signature.defaultInstance)))
|
||||
case 42 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateComplete(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateComplete.getOrElse(lightning.update_complete.defaultInstance)))
|
||||
case 50 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateCompleteHtlc(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateCompleteHtlc.getOrElse(lightning.update_complete_htlc.defaultInstance)))
|
||||
case 58 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateRemoveHtlc(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateRemoveHtlc.getOrElse(lightning.update_remove_htlc.defaultInstance)))
|
||||
case 66 =>
|
||||
__pkt = lightning.pkt.Pkt.UpdateRemoveHtlcDelay(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.updateRemoveHtlcDelay.getOrElse(lightning.update_remove_htlc_delay.defaultInstance)))
|
||||
case 3210 =>
|
||||
__pkt = lightning.pkt.Pkt.Close(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.close.getOrElse(lightning.close_channel.defaultInstance)))
|
||||
case 3218 =>
|
||||
__pkt = lightning.pkt.Pkt.CloseComplete(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.closeComplete.getOrElse(lightning.close_channel_complete.defaultInstance)))
|
||||
case 8002 =>
|
||||
__pkt = lightning.pkt.Pkt.Error(com.trueaccord.scalapb.LiteParser.readMessage(__input, pkt.error.getOrElse(lightning.error.defaultInstance)))
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.pkt(
|
||||
pkt = __pkt
|
||||
)
|
||||
}
|
||||
def getOpen: lightning.open_channel = pkt.open.getOrElse(lightning.open_channel.defaultInstance)
|
||||
def withOpen(__v: lightning.open_channel): pkt = copy(pkt = lightning.pkt.Pkt.Open(__v))
|
||||
def getOpenAnchor: lightning.open_anchor = pkt.openAnchor.getOrElse(lightning.open_anchor.defaultInstance)
|
||||
def withOpenAnchor(__v: lightning.open_anchor): pkt = copy(pkt = lightning.pkt.Pkt.OpenAnchor(__v))
|
||||
def getOpenCommitSig: lightning.open_commit_sig = pkt.openCommitSig.getOrElse(lightning.open_commit_sig.defaultInstance)
|
||||
def withOpenCommitSig(__v: lightning.open_commit_sig): pkt = copy(pkt = lightning.pkt.Pkt.OpenCommitSig(__v))
|
||||
def getOpenComplete: lightning.open_complete = pkt.openComplete.getOrElse(lightning.open_complete.defaultInstance)
|
||||
def withOpenComplete(__v: lightning.open_complete): pkt = copy(pkt = lightning.pkt.Pkt.OpenComplete(__v))
|
||||
def getUpdate: lightning.update = pkt.update.getOrElse(lightning.update.defaultInstance)
|
||||
def withUpdate(__v: lightning.update): pkt = copy(pkt = lightning.pkt.Pkt.Update(__v))
|
||||
def getUpdateAddHtlc: lightning.update_add_htlc = pkt.updateAddHtlc.getOrElse(lightning.update_add_htlc.defaultInstance)
|
||||
def withUpdateAddHtlc(__v: lightning.update_add_htlc): pkt = copy(pkt = lightning.pkt.Pkt.UpdateAddHtlc(__v))
|
||||
def getUpdateAccept: lightning.update_accept = pkt.updateAccept.getOrElse(lightning.update_accept.defaultInstance)
|
||||
def withUpdateAccept(__v: lightning.update_accept): pkt = copy(pkt = lightning.pkt.Pkt.UpdateAccept(__v))
|
||||
def getUpdateSignature: lightning.update_signature = pkt.updateSignature.getOrElse(lightning.update_signature.defaultInstance)
|
||||
def withUpdateSignature(__v: lightning.update_signature): pkt = copy(pkt = lightning.pkt.Pkt.UpdateSignature(__v))
|
||||
def getUpdateComplete: lightning.update_complete = pkt.updateComplete.getOrElse(lightning.update_complete.defaultInstance)
|
||||
def withUpdateComplete(__v: lightning.update_complete): pkt = copy(pkt = lightning.pkt.Pkt.UpdateComplete(__v))
|
||||
def getUpdateCompleteHtlc: lightning.update_complete_htlc = pkt.updateCompleteHtlc.getOrElse(lightning.update_complete_htlc.defaultInstance)
|
||||
def withUpdateCompleteHtlc(__v: lightning.update_complete_htlc): pkt = copy(pkt = lightning.pkt.Pkt.UpdateCompleteHtlc(__v))
|
||||
def getUpdateRemoveHtlc: lightning.update_remove_htlc = pkt.updateRemoveHtlc.getOrElse(lightning.update_remove_htlc.defaultInstance)
|
||||
def withUpdateRemoveHtlc(__v: lightning.update_remove_htlc): pkt = copy(pkt = lightning.pkt.Pkt.UpdateRemoveHtlc(__v))
|
||||
def getUpdateRemoveHtlcDelay: lightning.update_remove_htlc_delay = pkt.updateRemoveHtlcDelay.getOrElse(lightning.update_remove_htlc_delay.defaultInstance)
|
||||
def withUpdateRemoveHtlcDelay(__v: lightning.update_remove_htlc_delay): pkt = copy(pkt = lightning.pkt.Pkt.UpdateRemoveHtlcDelay(__v))
|
||||
def getClose: lightning.close_channel = pkt.close.getOrElse(lightning.close_channel.defaultInstance)
|
||||
def withClose(__v: lightning.close_channel): pkt = copy(pkt = lightning.pkt.Pkt.Close(__v))
|
||||
def getCloseComplete: lightning.close_channel_complete = pkt.closeComplete.getOrElse(lightning.close_channel_complete.defaultInstance)
|
||||
def withCloseComplete(__v: lightning.close_channel_complete): pkt = copy(pkt = lightning.pkt.Pkt.CloseComplete(__v))
|
||||
def getError: lightning.error = pkt.error.getOrElse(lightning.error.defaultInstance)
|
||||
def withError(__v: lightning.error): pkt = copy(pkt = lightning.pkt.Pkt.Error(__v))
|
||||
def clearPkt: pkt = copy(pkt = lightning.pkt.Pkt.Empty)
|
||||
def withPkt(__v: lightning.pkt.Pkt): pkt = copy(pkt = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 201 => pkt.open
|
||||
case 202 => pkt.openAnchor
|
||||
case 203 => pkt.openCommitSig
|
||||
case 204 => pkt.openComplete
|
||||
case 1 => pkt.update
|
||||
case 2 => pkt.updateAddHtlc
|
||||
case 3 => pkt.updateAccept
|
||||
case 4 => pkt.updateSignature
|
||||
case 5 => pkt.updateComplete
|
||||
case 6 => pkt.updateCompleteHtlc
|
||||
case 7 => pkt.updateRemoveHtlc
|
||||
case 8 => pkt.updateRemoveHtlcDelay
|
||||
case 401 => pkt.close
|
||||
case 402 => pkt.closeComplete
|
||||
case 1000 => pkt.error
|
||||
}
|
||||
}
|
||||
def companion = lightning.pkt
|
||||
}
|
||||
|
||||
object pkt extends com.trueaccord.scalapb.GeneratedMessageCompanion[pkt] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[pkt] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.pkt = lightning.pkt(
|
||||
pkt = fieldsMap.getOrElse(201, None).asInstanceOf[Option[lightning.open_channel]].map(value => lightning.pkt.Pkt.Open(value)) orElse
|
||||
fieldsMap.getOrElse(202, None).asInstanceOf[Option[lightning.open_anchor]].map(value => lightning.pkt.Pkt.OpenAnchor(value)) orElse
|
||||
fieldsMap.getOrElse(203, None).asInstanceOf[Option[lightning.open_commit_sig]].map(value => lightning.pkt.Pkt.OpenCommitSig(value)) orElse
|
||||
fieldsMap.getOrElse(204, None).asInstanceOf[Option[lightning.open_complete]].map(value => lightning.pkt.Pkt.OpenComplete(value)) orElse
|
||||
fieldsMap.getOrElse(1, None).asInstanceOf[Option[lightning.update]].map(value => lightning.pkt.Pkt.Update(value)) orElse
|
||||
fieldsMap.getOrElse(2, None).asInstanceOf[Option[lightning.update_add_htlc]].map(value => lightning.pkt.Pkt.UpdateAddHtlc(value)) orElse
|
||||
fieldsMap.getOrElse(3, None).asInstanceOf[Option[lightning.update_accept]].map(value => lightning.pkt.Pkt.UpdateAccept(value)) orElse
|
||||
fieldsMap.getOrElse(4, None).asInstanceOf[Option[lightning.update_signature]].map(value => lightning.pkt.Pkt.UpdateSignature(value)) orElse
|
||||
fieldsMap.getOrElse(5, None).asInstanceOf[Option[lightning.update_complete]].map(value => lightning.pkt.Pkt.UpdateComplete(value)) orElse
|
||||
fieldsMap.getOrElse(6, None).asInstanceOf[Option[lightning.update_complete_htlc]].map(value => lightning.pkt.Pkt.UpdateCompleteHtlc(value)) orElse
|
||||
fieldsMap.getOrElse(7, None).asInstanceOf[Option[lightning.update_remove_htlc]].map(value => lightning.pkt.Pkt.UpdateRemoveHtlc(value)) orElse
|
||||
fieldsMap.getOrElse(8, None).asInstanceOf[Option[lightning.update_remove_htlc_delay]].map(value => lightning.pkt.Pkt.UpdateRemoveHtlcDelay(value)) orElse
|
||||
fieldsMap.getOrElse(401, None).asInstanceOf[Option[lightning.close_channel]].map(value => lightning.pkt.Pkt.Close(value)) orElse
|
||||
fieldsMap.getOrElse(402, None).asInstanceOf[Option[lightning.close_channel_complete]].map(value => lightning.pkt.Pkt.CloseComplete(value)) orElse
|
||||
fieldsMap.getOrElse(1000, None).asInstanceOf[Option[lightning.error]].map(value => lightning.pkt.Pkt.Error(value)) getOrElse lightning.pkt.Pkt.Empty
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("pkt", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.pkt"))
|
||||
lazy val defaultInstance = lightning.pkt(
|
||||
)
|
||||
sealed trait Pkt extends com.trueaccord.scalapb.GeneratedOneof {
|
||||
def isEmpty: Boolean = false
|
||||
def isDefined: Boolean = true
|
||||
def number: Int
|
||||
def isOpen: Boolean = false
|
||||
def isOpenAnchor: Boolean = false
|
||||
def isOpenCommitSig: Boolean = false
|
||||
def isOpenComplete: Boolean = false
|
||||
def isUpdate: Boolean = false
|
||||
def isUpdateAddHtlc: Boolean = false
|
||||
def isUpdateAccept: Boolean = false
|
||||
def isUpdateSignature: Boolean = false
|
||||
def isUpdateComplete: Boolean = false
|
||||
def isUpdateCompleteHtlc: Boolean = false
|
||||
def isUpdateRemoveHtlc: Boolean = false
|
||||
def isUpdateRemoveHtlcDelay: Boolean = false
|
||||
def isClose: Boolean = false
|
||||
def isCloseComplete: Boolean = false
|
||||
def isError: Boolean = false
|
||||
def open: Option[lightning.open_channel] = None
|
||||
def openAnchor: Option[lightning.open_anchor] = None
|
||||
def openCommitSig: Option[lightning.open_commit_sig] = None
|
||||
def openComplete: Option[lightning.open_complete] = None
|
||||
def update: Option[lightning.update] = None
|
||||
def updateAddHtlc: Option[lightning.update_add_htlc] = None
|
||||
def updateAccept: Option[lightning.update_accept] = None
|
||||
def updateSignature: Option[lightning.update_signature] = None
|
||||
def updateComplete: Option[lightning.update_complete] = None
|
||||
def updateCompleteHtlc: Option[lightning.update_complete_htlc] = None
|
||||
def updateRemoveHtlc: Option[lightning.update_remove_htlc] = None
|
||||
def updateRemoveHtlcDelay: Option[lightning.update_remove_htlc_delay] = None
|
||||
def close: Option[lightning.close_channel] = None
|
||||
def closeComplete: Option[lightning.close_channel_complete] = None
|
||||
def error: Option[lightning.error] = None
|
||||
}
|
||||
object Pkt extends {
|
||||
@SerialVersionUID(0L)
|
||||
case object Empty extends Pkt {
|
||||
override def isEmpty: Boolean = true
|
||||
override def isDefined: Boolean = false
|
||||
override def number: Int = 0
|
||||
}
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
case class Open(value: lightning.open_channel) extends Pkt {
|
||||
override def isOpen: Boolean = true
|
||||
override def open: Option[lightning.open_channel] = Some(value)
|
||||
override def number: Int = 201
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class OpenAnchor(value: lightning.open_anchor) extends Pkt {
|
||||
override def isOpenAnchor: Boolean = true
|
||||
override def openAnchor: Option[lightning.open_anchor] = Some(value)
|
||||
override def number: Int = 202
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class OpenCommitSig(value: lightning.open_commit_sig) extends Pkt {
|
||||
override def isOpenCommitSig: Boolean = true
|
||||
override def openCommitSig: Option[lightning.open_commit_sig] = Some(value)
|
||||
override def number: Int = 203
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class OpenComplete(value: lightning.open_complete) extends Pkt {
|
||||
override def isOpenComplete: Boolean = true
|
||||
override def openComplete: Option[lightning.open_complete] = Some(value)
|
||||
override def number: Int = 204
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class Update(value: lightning.update) extends Pkt {
|
||||
override def isUpdate: Boolean = true
|
||||
override def update: Option[lightning.update] = Some(value)
|
||||
override def number: Int = 1
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateAddHtlc(value: lightning.update_add_htlc) extends Pkt {
|
||||
override def isUpdateAddHtlc: Boolean = true
|
||||
override def updateAddHtlc: Option[lightning.update_add_htlc] = Some(value)
|
||||
override def number: Int = 2
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateAccept(value: lightning.update_accept) extends Pkt {
|
||||
override def isUpdateAccept: Boolean = true
|
||||
override def updateAccept: Option[lightning.update_accept] = Some(value)
|
||||
override def number: Int = 3
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateSignature(value: lightning.update_signature) extends Pkt {
|
||||
override def isUpdateSignature: Boolean = true
|
||||
override def updateSignature: Option[lightning.update_signature] = Some(value)
|
||||
override def number: Int = 4
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateComplete(value: lightning.update_complete) extends Pkt {
|
||||
override def isUpdateComplete: Boolean = true
|
||||
override def updateComplete: Option[lightning.update_complete] = Some(value)
|
||||
override def number: Int = 5
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateCompleteHtlc(value: lightning.update_complete_htlc) extends Pkt {
|
||||
override def isUpdateCompleteHtlc: Boolean = true
|
||||
override def updateCompleteHtlc: Option[lightning.update_complete_htlc] = Some(value)
|
||||
override def number: Int = 6
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateRemoveHtlc(value: lightning.update_remove_htlc) extends Pkt {
|
||||
override def isUpdateRemoveHtlc: Boolean = true
|
||||
override def updateRemoveHtlc: Option[lightning.update_remove_htlc] = Some(value)
|
||||
override def number: Int = 7
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class UpdateRemoveHtlcDelay(value: lightning.update_remove_htlc_delay) extends Pkt {
|
||||
override def isUpdateRemoveHtlcDelay: Boolean = true
|
||||
override def updateRemoveHtlcDelay: Option[lightning.update_remove_htlc_delay] = Some(value)
|
||||
override def number: Int = 8
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class Close(value: lightning.close_channel) extends Pkt {
|
||||
override def isClose: Boolean = true
|
||||
override def close: Option[lightning.close_channel] = Some(value)
|
||||
override def number: Int = 401
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class CloseComplete(value: lightning.close_channel_complete) extends Pkt {
|
||||
override def isCloseComplete: Boolean = true
|
||||
override def closeComplete: Option[lightning.close_channel_complete] = Some(value)
|
||||
override def number: Int = 402
|
||||
}
|
||||
@SerialVersionUID(0L)
|
||||
case class Error(value: lightning.error) extends Pkt {
|
||||
override def isError: Boolean = true
|
||||
override def error: Option[lightning.error] = Some(value)
|
||||
override def number: Int = 1000
|
||||
}
|
||||
}
|
||||
implicit class pktLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, pkt]) extends com.trueaccord.lenses.ObjectLens[UpperPB, pkt](_l) {
|
||||
def open: com.trueaccord.lenses.Lens[UpperPB, lightning.open_channel] = field(_.getOpen)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.Open(f_)))
|
||||
def openAnchor: com.trueaccord.lenses.Lens[UpperPB, lightning.open_anchor] = field(_.getOpenAnchor)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.OpenAnchor(f_)))
|
||||
def openCommitSig: com.trueaccord.lenses.Lens[UpperPB, lightning.open_commit_sig] = field(_.getOpenCommitSig)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.OpenCommitSig(f_)))
|
||||
def openComplete: com.trueaccord.lenses.Lens[UpperPB, lightning.open_complete] = field(_.getOpenComplete)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.OpenComplete(f_)))
|
||||
def update: com.trueaccord.lenses.Lens[UpperPB, lightning.update] = field(_.getUpdate)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.Update(f_)))
|
||||
def updateAddHtlc: com.trueaccord.lenses.Lens[UpperPB, lightning.update_add_htlc] = field(_.getUpdateAddHtlc)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateAddHtlc(f_)))
|
||||
def updateAccept: com.trueaccord.lenses.Lens[UpperPB, lightning.update_accept] = field(_.getUpdateAccept)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateAccept(f_)))
|
||||
def updateSignature: com.trueaccord.lenses.Lens[UpperPB, lightning.update_signature] = field(_.getUpdateSignature)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateSignature(f_)))
|
||||
def updateComplete: com.trueaccord.lenses.Lens[UpperPB, lightning.update_complete] = field(_.getUpdateComplete)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateComplete(f_)))
|
||||
def updateCompleteHtlc: com.trueaccord.lenses.Lens[UpperPB, lightning.update_complete_htlc] = field(_.getUpdateCompleteHtlc)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateCompleteHtlc(f_)))
|
||||
def updateRemoveHtlc: com.trueaccord.lenses.Lens[UpperPB, lightning.update_remove_htlc] = field(_.getUpdateRemoveHtlc)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateRemoveHtlc(f_)))
|
||||
def updateRemoveHtlcDelay: com.trueaccord.lenses.Lens[UpperPB, lightning.update_remove_htlc_delay] = field(_.getUpdateRemoveHtlcDelay)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.UpdateRemoveHtlcDelay(f_)))
|
||||
def close: com.trueaccord.lenses.Lens[UpperPB, lightning.close_channel] = field(_.getClose)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.Close(f_)))
|
||||
def closeComplete: com.trueaccord.lenses.Lens[UpperPB, lightning.close_channel_complete] = field(_.getCloseComplete)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.CloseComplete(f_)))
|
||||
def error: com.trueaccord.lenses.Lens[UpperPB, lightning.error] = field(_.getError)((c_, f_) => c_.copy(pkt = lightning.pkt.Pkt.Error(f_)))
|
||||
def pkt: com.trueaccord.lenses.Lens[UpperPB, lightning.pkt.Pkt] = field(_.pkt)((c_, f_) => c_.copy(pkt = f_))
|
||||
}
|
||||
final val OPEN_FIELD_NUMBER = 201
|
||||
final val OPEN_ANCHOR_FIELD_NUMBER = 202
|
||||
final val OPEN_COMMIT_SIG_FIELD_NUMBER = 203
|
||||
final val OPEN_COMPLETE_FIELD_NUMBER = 204
|
||||
final val UPDATE_FIELD_NUMBER = 1
|
||||
final val UPDATE_ADD_HTLC_FIELD_NUMBER = 2
|
||||
final val UPDATE_ACCEPT_FIELD_NUMBER = 3
|
||||
final val UPDATE_SIGNATURE_FIELD_NUMBER = 4
|
||||
final val UPDATE_COMPLETE_FIELD_NUMBER = 5
|
||||
final val UPDATE_COMPLETE_HTLC_FIELD_NUMBER = 6
|
||||
final val UPDATE_REMOVE_HTLC_FIELD_NUMBER = 7
|
||||
final val UPDATE_REMOVE_HTLC_DELAY_FIELD_NUMBER = 8
|
||||
final val CLOSE_FIELD_NUMBER = 401
|
||||
final val CLOSE_COMPLETE_FIELD_NUMBER = 402
|
||||
final val ERROR_FIELD_NUMBER = 1000
|
||||
}
|
102
eclair-demo/src/main/scala/lightning/sha256_hash.scala
Normal file
102
eclair-demo/src/main/scala/lightning/sha256_hash.scala
Normal file
|
@ -0,0 +1,102 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class sha256_hash(
|
||||
a: Long,
|
||||
b: Long,
|
||||
c: Long,
|
||||
d: Long
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[sha256_hash] with com.trueaccord.lenses.Updatable[sha256_hash] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(1, a)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(2, b)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(3, c)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(4, d)
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeFixed64(1, a)
|
||||
output.writeFixed64(2, b)
|
||||
output.writeFixed64(3, c)
|
||||
output.writeFixed64(4, d)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.sha256_hash = {
|
||||
var __a = this.a
|
||||
var __b = this.b
|
||||
var __c = this.c
|
||||
var __d = this.d
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 9 =>
|
||||
__a = __input.readFixed64()
|
||||
case 17 =>
|
||||
__b = __input.readFixed64()
|
||||
case 25 =>
|
||||
__c = __input.readFixed64()
|
||||
case 33 =>
|
||||
__d = __input.readFixed64()
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.sha256_hash(
|
||||
a = __a,
|
||||
b = __b,
|
||||
c = __c,
|
||||
d = __d
|
||||
)
|
||||
}
|
||||
def withA(__v: Long): sha256_hash = copy(a = __v)
|
||||
def withB(__v: Long): sha256_hash = copy(b = __v)
|
||||
def withC(__v: Long): sha256_hash = copy(c = __v)
|
||||
def withD(__v: Long): sha256_hash = copy(d = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => a
|
||||
case 2 => b
|
||||
case 3 => c
|
||||
case 4 => d
|
||||
}
|
||||
}
|
||||
def companion = lightning.sha256_hash
|
||||
}
|
||||
|
||||
object sha256_hash extends com.trueaccord.scalapb.GeneratedMessageCompanion[sha256_hash] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[sha256_hash] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.sha256_hash = lightning.sha256_hash(
|
||||
a = fieldsMap(1).asInstanceOf[Long],
|
||||
b = fieldsMap(2).asInstanceOf[Long],
|
||||
c = fieldsMap(3).asInstanceOf[Long],
|
||||
d = fieldsMap(4).asInstanceOf[Long]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("sha256_hash", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.sha256_hash"))
|
||||
lazy val defaultInstance = lightning.sha256_hash(
|
||||
a = 0L,
|
||||
b = 0L,
|
||||
c = 0L,
|
||||
d = 0L
|
||||
)
|
||||
implicit class sha256_hashLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, sha256_hash]) extends com.trueaccord.lenses.ObjectLens[UpperPB, sha256_hash](_l) {
|
||||
def a: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.a)((c_, f_) => c_.copy(a = f_))
|
||||
def b: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.b)((c_, f_) => c_.copy(b = f_))
|
||||
def c: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.c)((c_, f_) => c_.copy(c = f_))
|
||||
def d: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.d)((c_, f_) => c_.copy(d = f_))
|
||||
}
|
||||
final val A_FIELD_NUMBER = 1
|
||||
final val B_FIELD_NUMBER = 2
|
||||
final val C_FIELD_NUMBER = 3
|
||||
final val D_FIELD_NUMBER = 4
|
||||
}
|
154
eclair-demo/src/main/scala/lightning/signature.scala
Normal file
154
eclair-demo/src/main/scala/lightning/signature.scala
Normal file
|
@ -0,0 +1,154 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class signature(
|
||||
r1: Long,
|
||||
r2: Long,
|
||||
r3: Long,
|
||||
r4: Long,
|
||||
s1: Long,
|
||||
s2: Long,
|
||||
s3: Long,
|
||||
s4: Long
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[signature] with com.trueaccord.lenses.Updatable[signature] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(1, r1)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(2, r2)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(3, r3)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(4, r4)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(5, s1)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(6, s2)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(7, s3)
|
||||
__size += com.google.protobuf.CodedOutputStream.computeFixed64Size(8, s4)
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeFixed64(1, r1)
|
||||
output.writeFixed64(2, r2)
|
||||
output.writeFixed64(3, r3)
|
||||
output.writeFixed64(4, r4)
|
||||
output.writeFixed64(5, s1)
|
||||
output.writeFixed64(6, s2)
|
||||
output.writeFixed64(7, s3)
|
||||
output.writeFixed64(8, s4)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.signature = {
|
||||
var __r1 = this.r1
|
||||
var __r2 = this.r2
|
||||
var __r3 = this.r3
|
||||
var __r4 = this.r4
|
||||
var __s1 = this.s1
|
||||
var __s2 = this.s2
|
||||
var __s3 = this.s3
|
||||
var __s4 = this.s4
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 9 =>
|
||||
__r1 = __input.readFixed64()
|
||||
case 17 =>
|
||||
__r2 = __input.readFixed64()
|
||||
case 25 =>
|
||||
__r3 = __input.readFixed64()
|
||||
case 33 =>
|
||||
__r4 = __input.readFixed64()
|
||||
case 41 =>
|
||||
__s1 = __input.readFixed64()
|
||||
case 49 =>
|
||||
__s2 = __input.readFixed64()
|
||||
case 57 =>
|
||||
__s3 = __input.readFixed64()
|
||||
case 65 =>
|
||||
__s4 = __input.readFixed64()
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.signature(
|
||||
r1 = __r1,
|
||||
r2 = __r2,
|
||||
r3 = __r3,
|
||||
r4 = __r4,
|
||||
s1 = __s1,
|
||||
s2 = __s2,
|
||||
s3 = __s3,
|
||||
s4 = __s4
|
||||
)
|
||||
}
|
||||
def withR1(__v: Long): signature = copy(r1 = __v)
|
||||
def withR2(__v: Long): signature = copy(r2 = __v)
|
||||
def withR3(__v: Long): signature = copy(r3 = __v)
|
||||
def withR4(__v: Long): signature = copy(r4 = __v)
|
||||
def withS1(__v: Long): signature = copy(s1 = __v)
|
||||
def withS2(__v: Long): signature = copy(s2 = __v)
|
||||
def withS3(__v: Long): signature = copy(s3 = __v)
|
||||
def withS4(__v: Long): signature = copy(s4 = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => r1
|
||||
case 2 => r2
|
||||
case 3 => r3
|
||||
case 4 => r4
|
||||
case 5 => s1
|
||||
case 6 => s2
|
||||
case 7 => s3
|
||||
case 8 => s4
|
||||
}
|
||||
}
|
||||
def companion = lightning.signature
|
||||
}
|
||||
|
||||
object signature extends com.trueaccord.scalapb.GeneratedMessageCompanion[signature] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[signature] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.signature = lightning.signature(
|
||||
r1 = fieldsMap(1).asInstanceOf[Long],
|
||||
r2 = fieldsMap(2).asInstanceOf[Long],
|
||||
r3 = fieldsMap(3).asInstanceOf[Long],
|
||||
r4 = fieldsMap(4).asInstanceOf[Long],
|
||||
s1 = fieldsMap(5).asInstanceOf[Long],
|
||||
s2 = fieldsMap(6).asInstanceOf[Long],
|
||||
s3 = fieldsMap(7).asInstanceOf[Long],
|
||||
s4 = fieldsMap(8).asInstanceOf[Long]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("signature", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.signature"))
|
||||
lazy val defaultInstance = lightning.signature(
|
||||
r1 = 0L,
|
||||
r2 = 0L,
|
||||
r3 = 0L,
|
||||
r4 = 0L,
|
||||
s1 = 0L,
|
||||
s2 = 0L,
|
||||
s3 = 0L,
|
||||
s4 = 0L
|
||||
)
|
||||
implicit class signatureLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, signature]) extends com.trueaccord.lenses.ObjectLens[UpperPB, signature](_l) {
|
||||
def r1: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.r1)((c_, f_) => c_.copy(r1 = f_))
|
||||
def r2: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.r2)((c_, f_) => c_.copy(r2 = f_))
|
||||
def r3: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.r3)((c_, f_) => c_.copy(r3 = f_))
|
||||
def r4: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.r4)((c_, f_) => c_.copy(r4 = f_))
|
||||
def s1: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.s1)((c_, f_) => c_.copy(s1 = f_))
|
||||
def s2: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.s2)((c_, f_) => c_.copy(s2 = f_))
|
||||
def s3: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.s3)((c_, f_) => c_.copy(s3 = f_))
|
||||
def s4: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.s4)((c_, f_) => c_.copy(s4 = f_))
|
||||
}
|
||||
final val R1_FIELD_NUMBER = 1
|
||||
final val R2_FIELD_NUMBER = 2
|
||||
final val R3_FIELD_NUMBER = 3
|
||||
final val R4_FIELD_NUMBER = 4
|
||||
final val S1_FIELD_NUMBER = 5
|
||||
final val S2_FIELD_NUMBER = 6
|
||||
final val S3_FIELD_NUMBER = 7
|
||||
final val S4_FIELD_NUMBER = 8
|
||||
}
|
78
eclair-demo/src/main/scala/lightning/update.scala
Normal file
78
eclair-demo/src/main/scala/lightning/update.scala
Normal file
|
@ -0,0 +1,78 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update(
|
||||
revocationHash: lightning.sha256_hash,
|
||||
delta: Long
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update] with com.trueaccord.lenses.Updatable[update] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationHash.serializedSize) + revocationHash.serializedSize
|
||||
__size += com.google.protobuf.CodedOutputStream.computeSInt64Size(2, delta)
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(revocationHash.serializedSize)
|
||||
revocationHash.writeTo(output)
|
||||
output.writeSInt64(2, delta)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update = {
|
||||
var __revocationHash = this.revocationHash
|
||||
var __delta = this.delta
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__revocationHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationHash)
|
||||
case 16 =>
|
||||
__delta = __input.readSInt64()
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update(
|
||||
revocationHash = __revocationHash,
|
||||
delta = __delta
|
||||
)
|
||||
}
|
||||
def withRevocationHash(__v: lightning.sha256_hash): update = copy(revocationHash = __v)
|
||||
def withDelta(__v: Long): update = copy(delta = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => revocationHash
|
||||
case 2 => delta
|
||||
}
|
||||
}
|
||||
def companion = lightning.update
|
||||
}
|
||||
|
||||
object update extends com.trueaccord.scalapb.GeneratedMessageCompanion[update] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update = lightning.update(
|
||||
revocationHash = fieldsMap(1).asInstanceOf[lightning.sha256_hash],
|
||||
delta = fieldsMap(2).asInstanceOf[Long]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update"))
|
||||
lazy val defaultInstance = lightning.update(
|
||||
revocationHash = lightning.sha256_hash.defaultInstance,
|
||||
delta = 0L
|
||||
)
|
||||
implicit class updateLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update](_l) {
|
||||
def revocationHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationHash)((c_, f_) => c_.copy(revocationHash = f_))
|
||||
def delta: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.delta)((c_, f_) => c_.copy(delta = f_))
|
||||
}
|
||||
final val REVOCATION_HASH_FIELD_NUMBER = 1
|
||||
final val DELTA_FIELD_NUMBER = 2
|
||||
}
|
80
eclair-demo/src/main/scala/lightning/update_accept.scala
Normal file
80
eclair-demo/src/main/scala/lightning/update_accept.scala
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_accept(
|
||||
sig: lightning.signature,
|
||||
revocationHash: lightning.sha256_hash
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_accept] with com.trueaccord.lenses.Updatable[update_accept] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(sig.serializedSize) + sig.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationHash.serializedSize) + revocationHash.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(sig.serializedSize)
|
||||
sig.writeTo(output)
|
||||
output.writeTag(3, 2)
|
||||
output.writeRawVarint32(revocationHash.serializedSize)
|
||||
revocationHash.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_accept = {
|
||||
var __sig = this.sig
|
||||
var __revocationHash = this.revocationHash
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__sig = com.trueaccord.scalapb.LiteParser.readMessage(__input, __sig)
|
||||
case 26 =>
|
||||
__revocationHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationHash)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_accept(
|
||||
sig = __sig,
|
||||
revocationHash = __revocationHash
|
||||
)
|
||||
}
|
||||
def withSig(__v: lightning.signature): update_accept = copy(sig = __v)
|
||||
def withRevocationHash(__v: lightning.sha256_hash): update_accept = copy(revocationHash = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => sig
|
||||
case 3 => revocationHash
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_accept
|
||||
}
|
||||
|
||||
object update_accept extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_accept] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_accept] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_accept = lightning.update_accept(
|
||||
sig = fieldsMap(1).asInstanceOf[lightning.signature],
|
||||
revocationHash = fieldsMap(3).asInstanceOf[lightning.sha256_hash]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_accept", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_accept"))
|
||||
lazy val defaultInstance = lightning.update_accept(
|
||||
sig = lightning.signature.defaultInstance,
|
||||
revocationHash = lightning.sha256_hash.defaultInstance
|
||||
)
|
||||
implicit class update_acceptLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_accept]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_accept](_l) {
|
||||
def sig: com.trueaccord.lenses.Lens[UpperPB, lightning.signature] = field(_.sig)((c_, f_) => c_.copy(sig = f_))
|
||||
def revocationHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationHash)((c_, f_) => c_.copy(revocationHash = f_))
|
||||
}
|
||||
final val SIG_FIELD_NUMBER = 1
|
||||
final val REVOCATION_HASH_FIELD_NUMBER = 3
|
||||
}
|
108
eclair-demo/src/main/scala/lightning/update_add_htlc.scala
Normal file
108
eclair-demo/src/main/scala/lightning/update_add_htlc.scala
Normal file
|
@ -0,0 +1,108 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_add_htlc(
|
||||
revocationHash: lightning.sha256_hash,
|
||||
amount: Long,
|
||||
rHash: lightning.sha256_hash,
|
||||
expiry: lightning.locktime
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_add_htlc] with com.trueaccord.lenses.Updatable[update_add_htlc] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationHash.serializedSize) + revocationHash.serializedSize
|
||||
__size += com.google.protobuf.CodedOutputStream.computeUInt64Size(2, amount)
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(rHash.serializedSize) + rHash.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(expiry.serializedSize) + expiry.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(revocationHash.serializedSize)
|
||||
revocationHash.writeTo(output)
|
||||
output.writeUInt64(2, amount)
|
||||
output.writeTag(3, 2)
|
||||
output.writeRawVarint32(rHash.serializedSize)
|
||||
rHash.writeTo(output)
|
||||
output.writeTag(4, 2)
|
||||
output.writeRawVarint32(expiry.serializedSize)
|
||||
expiry.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_add_htlc = {
|
||||
var __revocationHash = this.revocationHash
|
||||
var __amount = this.amount
|
||||
var __rHash = this.rHash
|
||||
var __expiry = this.expiry
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__revocationHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationHash)
|
||||
case 16 =>
|
||||
__amount = __input.readUInt64()
|
||||
case 26 =>
|
||||
__rHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __rHash)
|
||||
case 34 =>
|
||||
__expiry = com.trueaccord.scalapb.LiteParser.readMessage(__input, __expiry)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_add_htlc(
|
||||
revocationHash = __revocationHash,
|
||||
amount = __amount,
|
||||
rHash = __rHash,
|
||||
expiry = __expiry
|
||||
)
|
||||
}
|
||||
def withRevocationHash(__v: lightning.sha256_hash): update_add_htlc = copy(revocationHash = __v)
|
||||
def withAmount(__v: Long): update_add_htlc = copy(amount = __v)
|
||||
def withRHash(__v: lightning.sha256_hash): update_add_htlc = copy(rHash = __v)
|
||||
def withExpiry(__v: lightning.locktime): update_add_htlc = copy(expiry = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => revocationHash
|
||||
case 2 => amount
|
||||
case 3 => rHash
|
||||
case 4 => expiry
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_add_htlc
|
||||
}
|
||||
|
||||
object update_add_htlc extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_add_htlc] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_add_htlc] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_add_htlc = lightning.update_add_htlc(
|
||||
revocationHash = fieldsMap(1).asInstanceOf[lightning.sha256_hash],
|
||||
amount = fieldsMap(2).asInstanceOf[Long],
|
||||
rHash = fieldsMap(3).asInstanceOf[lightning.sha256_hash],
|
||||
expiry = fieldsMap(4).asInstanceOf[lightning.locktime]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_add_htlc", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_add_htlc"))
|
||||
lazy val defaultInstance = lightning.update_add_htlc(
|
||||
revocationHash = lightning.sha256_hash.defaultInstance,
|
||||
amount = 0L,
|
||||
rHash = lightning.sha256_hash.defaultInstance,
|
||||
expiry = lightning.locktime.defaultInstance
|
||||
)
|
||||
implicit class update_add_htlcLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_add_htlc]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_add_htlc](_l) {
|
||||
def revocationHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationHash)((c_, f_) => c_.copy(revocationHash = f_))
|
||||
def amount: com.trueaccord.lenses.Lens[UpperPB, Long] = field(_.amount)((c_, f_) => c_.copy(amount = f_))
|
||||
def rHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.rHash)((c_, f_) => c_.copy(rHash = f_))
|
||||
def expiry: com.trueaccord.lenses.Lens[UpperPB, lightning.locktime] = field(_.expiry)((c_, f_) => c_.copy(expiry = f_))
|
||||
}
|
||||
final val REVOCATION_HASH_FIELD_NUMBER = 1
|
||||
final val AMOUNT_FIELD_NUMBER = 2
|
||||
final val R_HASH_FIELD_NUMBER = 3
|
||||
final val EXPIRY_FIELD_NUMBER = 4
|
||||
}
|
65
eclair-demo/src/main/scala/lightning/update_complete.scala
Normal file
65
eclair-demo/src/main/scala/lightning/update_complete.scala
Normal file
|
@ -0,0 +1,65 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_complete(
|
||||
revocationPreimage: lightning.sha256_hash
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_complete] with com.trueaccord.lenses.Updatable[update_complete] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationPreimage.serializedSize) + revocationPreimage.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(revocationPreimage.serializedSize)
|
||||
revocationPreimage.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_complete = {
|
||||
var __revocationPreimage = this.revocationPreimage
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__revocationPreimage = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationPreimage)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_complete(
|
||||
revocationPreimage = __revocationPreimage
|
||||
)
|
||||
}
|
||||
def withRevocationPreimage(__v: lightning.sha256_hash): update_complete = copy(revocationPreimage = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => revocationPreimage
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_complete
|
||||
}
|
||||
|
||||
object update_complete extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_complete] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_complete] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_complete = lightning.update_complete(
|
||||
revocationPreimage = fieldsMap(1).asInstanceOf[lightning.sha256_hash]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_complete", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_complete"))
|
||||
lazy val defaultInstance = lightning.update_complete(
|
||||
revocationPreimage = lightning.sha256_hash.defaultInstance
|
||||
)
|
||||
implicit class update_completeLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_complete]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_complete](_l) {
|
||||
def revocationPreimage: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationPreimage)((c_, f_) => c_.copy(revocationPreimage = f_))
|
||||
}
|
||||
final val REVOCATION_PREIMAGE_FIELD_NUMBER = 1
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_complete_htlc(
|
||||
revocationHash: lightning.sha256_hash,
|
||||
r: lightning.sha256_hash
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_complete_htlc] with com.trueaccord.lenses.Updatable[update_complete_htlc] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationHash.serializedSize) + revocationHash.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(r.serializedSize) + r.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(revocationHash.serializedSize)
|
||||
revocationHash.writeTo(output)
|
||||
output.writeTag(3, 2)
|
||||
output.writeRawVarint32(r.serializedSize)
|
||||
r.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_complete_htlc = {
|
||||
var __revocationHash = this.revocationHash
|
||||
var __r = this.r
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__revocationHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationHash)
|
||||
case 26 =>
|
||||
__r = com.trueaccord.scalapb.LiteParser.readMessage(__input, __r)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_complete_htlc(
|
||||
revocationHash = __revocationHash,
|
||||
r = __r
|
||||
)
|
||||
}
|
||||
def withRevocationHash(__v: lightning.sha256_hash): update_complete_htlc = copy(revocationHash = __v)
|
||||
def withR(__v: lightning.sha256_hash): update_complete_htlc = copy(r = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => revocationHash
|
||||
case 3 => r
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_complete_htlc
|
||||
}
|
||||
|
||||
object update_complete_htlc extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_complete_htlc] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_complete_htlc] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_complete_htlc = lightning.update_complete_htlc(
|
||||
revocationHash = fieldsMap(1).asInstanceOf[lightning.sha256_hash],
|
||||
r = fieldsMap(3).asInstanceOf[lightning.sha256_hash]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_complete_htlc", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_complete_htlc"))
|
||||
lazy val defaultInstance = lightning.update_complete_htlc(
|
||||
revocationHash = lightning.sha256_hash.defaultInstance,
|
||||
r = lightning.sha256_hash.defaultInstance
|
||||
)
|
||||
implicit class update_complete_htlcLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_complete_htlc]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_complete_htlc](_l) {
|
||||
def revocationHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationHash)((c_, f_) => c_.copy(revocationHash = f_))
|
||||
def r: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.r)((c_, f_) => c_.copy(r = f_))
|
||||
}
|
||||
final val REVOCATION_HASH_FIELD_NUMBER = 1
|
||||
final val R_FIELD_NUMBER = 3
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_remove_htlc(
|
||||
revocationHash: lightning.sha256_hash,
|
||||
rHash: lightning.sha256_hash
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_remove_htlc] with com.trueaccord.lenses.Updatable[update_remove_htlc] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationHash.serializedSize) + revocationHash.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(rHash.serializedSize) + rHash.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(revocationHash.serializedSize)
|
||||
revocationHash.writeTo(output)
|
||||
output.writeTag(3, 2)
|
||||
output.writeRawVarint32(rHash.serializedSize)
|
||||
rHash.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_remove_htlc = {
|
||||
var __revocationHash = this.revocationHash
|
||||
var __rHash = this.rHash
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__revocationHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationHash)
|
||||
case 26 =>
|
||||
__rHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __rHash)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_remove_htlc(
|
||||
revocationHash = __revocationHash,
|
||||
rHash = __rHash
|
||||
)
|
||||
}
|
||||
def withRevocationHash(__v: lightning.sha256_hash): update_remove_htlc = copy(revocationHash = __v)
|
||||
def withRHash(__v: lightning.sha256_hash): update_remove_htlc = copy(rHash = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => revocationHash
|
||||
case 3 => rHash
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_remove_htlc
|
||||
}
|
||||
|
||||
object update_remove_htlc extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_remove_htlc] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_remove_htlc] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_remove_htlc = lightning.update_remove_htlc(
|
||||
revocationHash = fieldsMap(1).asInstanceOf[lightning.sha256_hash],
|
||||
rHash = fieldsMap(3).asInstanceOf[lightning.sha256_hash]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_remove_htlc", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_remove_htlc"))
|
||||
lazy val defaultInstance = lightning.update_remove_htlc(
|
||||
revocationHash = lightning.sha256_hash.defaultInstance,
|
||||
rHash = lightning.sha256_hash.defaultInstance
|
||||
)
|
||||
implicit class update_remove_htlcLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_remove_htlc]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_remove_htlc](_l) {
|
||||
def revocationHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationHash)((c_, f_) => c_.copy(revocationHash = f_))
|
||||
def rHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.rHash)((c_, f_) => c_.copy(rHash = f_))
|
||||
}
|
||||
final val REVOCATION_HASH_FIELD_NUMBER = 1
|
||||
final val R_HASH_FIELD_NUMBER = 3
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_remove_htlc_delay(
|
||||
rHash: lightning.sha256_hash
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_remove_htlc_delay] with com.trueaccord.lenses.Updatable[update_remove_htlc_delay] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(rHash.serializedSize) + rHash.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(rHash.serializedSize)
|
||||
rHash.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_remove_htlc_delay = {
|
||||
var __rHash = this.rHash
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__rHash = com.trueaccord.scalapb.LiteParser.readMessage(__input, __rHash)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_remove_htlc_delay(
|
||||
rHash = __rHash
|
||||
)
|
||||
}
|
||||
def withRHash(__v: lightning.sha256_hash): update_remove_htlc_delay = copy(rHash = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => rHash
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_remove_htlc_delay
|
||||
}
|
||||
|
||||
object update_remove_htlc_delay extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_remove_htlc_delay] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_remove_htlc_delay] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_remove_htlc_delay = lightning.update_remove_htlc_delay(
|
||||
rHash = fieldsMap(1).asInstanceOf[lightning.sha256_hash]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_remove_htlc_delay", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_remove_htlc_delay"))
|
||||
lazy val defaultInstance = lightning.update_remove_htlc_delay(
|
||||
rHash = lightning.sha256_hash.defaultInstance
|
||||
)
|
||||
implicit class update_remove_htlc_delayLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_remove_htlc_delay]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_remove_htlc_delay](_l) {
|
||||
def rHash: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.rHash)((c_, f_) => c_.copy(rHash = f_))
|
||||
}
|
||||
final val R_HASH_FIELD_NUMBER = 1
|
||||
}
|
80
eclair-demo/src/main/scala/lightning/update_signature.scala
Normal file
80
eclair-demo/src/main/scala/lightning/update_signature.scala
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
|
||||
// Do not edit!
|
||||
|
||||
package lightning
|
||||
|
||||
|
||||
import com.trueaccord.scalapb.Descriptors
|
||||
|
||||
@SerialVersionUID(0L)
|
||||
final case class update_signature(
|
||||
sig: lightning.signature,
|
||||
revocationPreimage: lightning.sha256_hash
|
||||
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[update_signature] with com.trueaccord.lenses.Updatable[update_signature] {
|
||||
@transient
|
||||
lazy val serializedSize: Int = {
|
||||
var __size = 0
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(sig.serializedSize) + sig.serializedSize
|
||||
__size += 1 + com.google.protobuf.CodedOutputStream.computeRawVarint32Size(revocationPreimage.serializedSize) + revocationPreimage.serializedSize
|
||||
__size
|
||||
}
|
||||
def writeTo(output: com.google.protobuf.CodedOutputStream): Unit = {
|
||||
output.writeTag(1, 2)
|
||||
output.writeRawVarint32(sig.serializedSize)
|
||||
sig.writeTo(output)
|
||||
output.writeTag(2, 2)
|
||||
output.writeRawVarint32(revocationPreimage.serializedSize)
|
||||
revocationPreimage.writeTo(output)
|
||||
}
|
||||
def mergeFrom(__input: com.google.protobuf.CodedInputStream): lightning.update_signature = {
|
||||
var __sig = this.sig
|
||||
var __revocationPreimage = this.revocationPreimage
|
||||
var _done__ = false
|
||||
while (!_done__) {
|
||||
val _tag__ = __input.readTag()
|
||||
_tag__ match {
|
||||
case 0 => _done__ = true
|
||||
case 10 =>
|
||||
__sig = com.trueaccord.scalapb.LiteParser.readMessage(__input, __sig)
|
||||
case 18 =>
|
||||
__revocationPreimage = com.trueaccord.scalapb.LiteParser.readMessage(__input, __revocationPreimage)
|
||||
case tag => __input.skipField(tag)
|
||||
}
|
||||
}
|
||||
lightning.update_signature(
|
||||
sig = __sig,
|
||||
revocationPreimage = __revocationPreimage
|
||||
)
|
||||
}
|
||||
def withSig(__v: lightning.signature): update_signature = copy(sig = __v)
|
||||
def withRevocationPreimage(__v: lightning.sha256_hash): update_signature = copy(revocationPreimage = __v)
|
||||
def getField(__field: Descriptors.FieldDescriptor): Any = {
|
||||
__field.number match {
|
||||
case 1 => sig
|
||||
case 2 => revocationPreimage
|
||||
}
|
||||
}
|
||||
def companion = lightning.update_signature
|
||||
}
|
||||
|
||||
object update_signature extends com.trueaccord.scalapb.GeneratedMessageCompanion[update_signature] {
|
||||
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[update_signature] = this
|
||||
def fromFieldsMap(fieldsMap: Map[Int, Any]): lightning.update_signature = lightning.update_signature(
|
||||
sig = fieldsMap(1).asInstanceOf[lightning.signature],
|
||||
revocationPreimage = fieldsMap(2).asInstanceOf[lightning.sha256_hash]
|
||||
)
|
||||
lazy val descriptor = new Descriptors.MessageDescriptor("update_signature", this,
|
||||
None, m = Seq(),
|
||||
e = Seq(),
|
||||
f = lightning.InternalFields_srcMainProtobufLightningProto.internalFieldsFor("lightning.update_signature"))
|
||||
lazy val defaultInstance = lightning.update_signature(
|
||||
sig = lightning.signature.defaultInstance,
|
||||
revocationPreimage = lightning.sha256_hash.defaultInstance
|
||||
)
|
||||
implicit class update_signatureLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, update_signature]) extends com.trueaccord.lenses.ObjectLens[UpperPB, update_signature](_l) {
|
||||
def sig: com.trueaccord.lenses.Lens[UpperPB, lightning.signature] = field(_.sig)((c_, f_) => c_.copy(sig = f_))
|
||||
def revocationPreimage: com.trueaccord.lenses.Lens[UpperPB, lightning.sha256_hash] = field(_.revocationPreimage)((c_, f_) => c_.copy(revocationPreimage = f_))
|
||||
}
|
||||
final val SIG_FIELD_NUMBER = 1
|
||||
final val REVOCATION_PREIMAGE_FIELD_NUMBER = 2
|
||||
}
|
184
pom.xml
Normal file
184
pom.xml
Normal file
|
@ -0,0 +1,184 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>fr.acinq</groupId>
|
||||
<artifactId>eclair_2.11</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>eclair-demo</module>
|
||||
</modules>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<scala.version>2.11.7</scala.version>
|
||||
<scala.version.short>2.11</scala.version.short>
|
||||
<akka.version>2.3.12</akka.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process-resources</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/scala</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-test-source</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/scala</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>com.github.sstone</groupId>
|
||||
<artifactId>aws-maven</artifactId>
|
||||
<version>5.1.0.1</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>aws-releases</id>
|
||||
<name>AWS Release Repository</name>
|
||||
<url>s3://acinq-mvn-repo/releases</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>aws-snapshots</id>
|
||||
<name>AWS Snapshot Repository</name>
|
||||
<url>s3://acinq-mvn-repo/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aws-releases</id>
|
||||
<url>s3://acinq-mvn-repo/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aws-snapshots</id>
|
||||
<url>s3://acinq-mvn-repo/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.acinq</groupId>
|
||||
<artifactId>bitcoin-lib_2.11</artifactId>
|
||||
<version>0.9.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.trueaccord.scalapb</groupId>
|
||||
<artifactId>scalapb-runtime_2.11</artifactId>
|
||||
<version>0.4.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>2.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.trueaccord.lenses</groupId>
|
||||
<artifactId>lenses_2.11</artifactId>
|
||||
<version>0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json4s</groupId>
|
||||
<artifactId>json4s-jackson_${scala.version.short}</artifactId>
|
||||
<version>3.2.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>${scala.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scalatest</groupId>
|
||||
<artifactId>scalatest_2.11</artifactId>
|
||||
<version>2.2.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
Loading…
Add table
Reference in a new issue