Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
- name: Generate dotnet v1beta
run: buf generate --template buf.gen.dotnet.v1beta.yaml

- name: Generate dotnet v1
run: buf generate --template buf.gen.dotnet.v1.yaml

# The protobuf Python plugin emits absolute imports rooted at the proto
# package (e.g. `from utxorpc.v1alpha...`), which do not resolve once the
# code is packaged under `utxorpc_spec`. protoletariat rewrites the
Expand All @@ -89,7 +92,7 @@ jobs:
run: |
pip install --quiet protobuf grpcio
cd gen/python
python -c "import utxorpc_spec.utxorpc.v1alpha.sync.sync_pb2, utxorpc_spec.utxorpc.v1beta.sync.sync_pb2; print('python import OK')"
python -c "import utxorpc_spec.utxorpc.v1alpha.sync.sync_pb2, utxorpc_spec.utxorpc.v1beta.sync.sync_pb2, utxorpc_spec.utxorpc.v1.sync.sync_pb2; print('python import OK')"

- name: Create codegen artifact
uses: actions/upload-artifact@v4
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ gen/dotnet/*
!gen/dotnet/Utxorpc.Spec.csproj
gen/go/utxorpc/
gen/haskell/Proto
gen/node/src/
gen/node/src/*
!gen/node/src/index.ts
!gen/node/src/v1.ts
!gen/node/src/v1alpha.ts
!gen/node/src/v1beta.ts
gen/openapi/
gen/jsonschema/schema/
gen/typebox/src/
Expand Down
13 changes: 13 additions & 0 deletions buf.gen.dotnet.v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: v2

inputs:
- directory: proto
paths:
- proto/utxorpc/v1

plugins:
- remote: buf.build/grpc/csharp:v1.76.0
out: gen/dotnet/v1

- remote: buf.build/protocolbuffers/csharp:v29.3
out: gen/dotnet/v1
4 changes: 3 additions & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ plugins:
out: gen/haskell

# dotnet
# NOTE: C# plugins are run separately via buf generate --path to handle v1alpha/v1beta separation
# NOTE: the C# generators emit flat files named after the proto basename, so every
# interface version would collide on Query.cs, Sync.cs, etc. in a single output dir.
# They run as one buf invocation per version instead, from buf.gen.dotnet.<version>.yaml.
# See generate.yml workflow for details

# other
Expand Down
30 changes: 30 additions & 0 deletions gen/haskell/utxorpc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ extra-source-files:

library
exposed-modules:
Proto.Utxorpc.V1.Bitcoin.Bitcoin
Proto.Utxorpc.V1.Bitcoin.Bitcoin_Fields
Proto.Utxorpc.V1.Cardano.Cardano
Proto.Utxorpc.V1.Cardano.Cardano_Fields
Proto.Utxorpc.V1.Handshake.Handshake
Proto.Utxorpc.V1.Handshake.Handshake_Fields
Proto.Utxorpc.V1.Query.Query
Proto.Utxorpc.V1.Query.Query_Fields
Proto.Utxorpc.V1.Submit.Submit
Proto.Utxorpc.V1.Submit.Submit_Fields
Proto.Utxorpc.V1.Sync.Sync
Proto.Utxorpc.V1.Sync.Sync_Fields
Proto.Utxorpc.V1.Watch.Watch
Proto.Utxorpc.V1.Watch.Watch_Fields
Proto.Utxorpc.V1alpha.Bitcoin.Bitcoin
Proto.Utxorpc.V1alpha.Bitcoin.Bitcoin_Fields
Proto.Utxorpc.V1alpha.Cardano.Cardano
Proto.Utxorpc.V1alpha.Cardano.Cardano_Fields
Proto.Utxorpc.V1alpha.Query.Query
Expand All @@ -36,6 +52,20 @@ library
Proto.Utxorpc.V1alpha.Sync.Sync_Fields
Proto.Utxorpc.V1alpha.Watch.Watch
Proto.Utxorpc.V1alpha.Watch.Watch_Fields
Proto.Utxorpc.V1beta.Bitcoin.Bitcoin
Proto.Utxorpc.V1beta.Bitcoin.Bitcoin_Fields
Proto.Utxorpc.V1beta.Cardano.Cardano
Proto.Utxorpc.V1beta.Cardano.Cardano_Fields
Proto.Utxorpc.V1beta.Handshake.Handshake
Proto.Utxorpc.V1beta.Handshake.Handshake_Fields
Proto.Utxorpc.V1beta.Query.Query
Proto.Utxorpc.V1beta.Query.Query_Fields
Proto.Utxorpc.V1beta.Submit.Submit
Proto.Utxorpc.V1beta.Submit.Submit_Fields
Proto.Utxorpc.V1beta.Sync.Sync
Proto.Utxorpc.V1beta.Sync.Sync_Fields
Proto.Utxorpc.V1beta.Watch.Watch
Proto.Utxorpc.V1beta.Watch.Watch_Fields
hs-source-dirs:
.
build-depends:
Expand Down
17 changes: 8 additions & 9 deletions gen/node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export * as cardano from "./utxorpc/v1alpha/cardano/cardano_pb.js";
export * as query from "./utxorpc/v1alpha/query/query_pb.js";
export * as queryConnect from "./utxorpc/v1alpha/query/query_connect.js";
export * as submit from "./utxorpc/v1alpha/submit/submit_pb.js";
export * as submitConnect from "./utxorpc/v1alpha/submit/submit_connect.js";
export * as sync from "./utxorpc/v1alpha/sync/sync_pb.js";
export * as syncConnect from "./utxorpc/v1alpha/sync/sync_connect.js";
export * as watch from "./utxorpc/v1alpha/watch/watch_pb.js";
export * as watchConnect from "./utxorpc/v1alpha/watch/watch_connect.js";
export * as v1 from "./v1.js";
export * as v1alpha from "./v1alpha.js";
export * as v1beta from "./v1beta.js";

// Back-compat: before the interface held side-by-side versions, this package
// re-exported v1alpha's modules at the root. Keep resolving them there so
// existing `spec.sync` / `spec.cardano` callers are unaffected.
export * from "./v1alpha.js";
11 changes: 11 additions & 0 deletions gen/node/src/v1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export * as bitcoin from "./utxorpc/v1/bitcoin/bitcoin_pb.js";
export * as cardano from "./utxorpc/v1/cardano/cardano_pb.js";
export * as handshake from "./utxorpc/v1/handshake/handshake_pb.js";
export * as query from "./utxorpc/v1/query/query_pb.js";
export * as queryConnect from "./utxorpc/v1/query/query_connect.js";
export * as submit from "./utxorpc/v1/submit/submit_pb.js";
export * as submitConnect from "./utxorpc/v1/submit/submit_connect.js";
export * as sync from "./utxorpc/v1/sync/sync_pb.js";
export * as syncConnect from "./utxorpc/v1/sync/sync_connect.js";
export * as watch from "./utxorpc/v1/watch/watch_pb.js";
export * as watchConnect from "./utxorpc/v1/watch/watch_connect.js";
10 changes: 10 additions & 0 deletions gen/node/src/v1alpha.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export * as bitcoin from "./utxorpc/v1alpha/bitcoin/bitcoin_pb.js";
export * as cardano from "./utxorpc/v1alpha/cardano/cardano_pb.js";
export * as query from "./utxorpc/v1alpha/query/query_pb.js";
export * as queryConnect from "./utxorpc/v1alpha/query/query_connect.js";
export * as submit from "./utxorpc/v1alpha/submit/submit_pb.js";
export * as submitConnect from "./utxorpc/v1alpha/submit/submit_connect.js";
export * as sync from "./utxorpc/v1alpha/sync/sync_pb.js";
export * as syncConnect from "./utxorpc/v1alpha/sync/sync_connect.js";
export * as watch from "./utxorpc/v1alpha/watch/watch_pb.js";
export * as watchConnect from "./utxorpc/v1alpha/watch/watch_connect.js";
11 changes: 11 additions & 0 deletions gen/node/src/v1beta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export * as bitcoin from "./utxorpc/v1beta/bitcoin/bitcoin_pb.js";
export * as cardano from "./utxorpc/v1beta/cardano/cardano_pb.js";
export * as handshake from "./utxorpc/v1beta/handshake/handshake_pb.js";
export * as query from "./utxorpc/v1beta/query/query_pb.js";
export * as queryConnect from "./utxorpc/v1beta/query/query_connect.js";
export * as submit from "./utxorpc/v1beta/submit/submit_pb.js";
export * as submitConnect from "./utxorpc/v1beta/submit/submit_connect.js";
export * as sync from "./utxorpc/v1beta/sync/sync_pb.js";
export * as syncConnect from "./utxorpc/v1beta/sync/sync_connect.js";
export * as watch from "./utxorpc/v1beta/watch/watch_pb.js";
export * as watchConnect from "./utxorpc/v1beta/watch/watch_connect.js";
12 changes: 10 additions & 2 deletions gen/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ tonic = { version = "0.12.3", default-features = false, features = ["codegen", "

[features]
default = ["proto_full"]
ledgers = ["utxorpc-v1alpha-cardano"]
ledgers = ["utxorpc-v1alpha-cardano", "utxorpc-v1-cardano"]
# @@protoc_deletion_point(features)
# This section is automatically generated by protoc-gen-prost-crate.
# Changes in this area may be lost on regeneration.
proto_full = ["utxorpc-v1alpha-bitcoin","utxorpc-v1alpha-cardano","utxorpc-v1alpha-query","utxorpc-v1alpha-submit","utxorpc-v1alpha-sync","utxorpc-v1alpha-watch","utxorpc-v1beta-bitcoin","utxorpc-v1beta-cardano","utxorpc-v1beta-query","utxorpc-v1beta-submit","utxorpc-v1beta-sync","utxorpc-v1beta-watch"]
proto_full = ["utxorpc-v1-bitcoin","utxorpc-v1-cardano","utxorpc-v1-handshake","utxorpc-v1-query","utxorpc-v1-submit","utxorpc-v1-sync","utxorpc-v1-watch","utxorpc-v1alpha-bitcoin","utxorpc-v1alpha-cardano","utxorpc-v1alpha-query","utxorpc-v1alpha-submit","utxorpc-v1alpha-sync","utxorpc-v1alpha-watch","utxorpc-v1beta-bitcoin","utxorpc-v1beta-cardano","utxorpc-v1beta-handshake","utxorpc-v1beta-query","utxorpc-v1beta-submit","utxorpc-v1beta-sync","utxorpc-v1beta-watch"]
"utxorpc-v1-bitcoin" = []
"utxorpc-v1-cardano" = []
"utxorpc-v1-handshake" = []
"utxorpc-v1-query" = ["utxorpc-v1-cardano"]
"utxorpc-v1-submit" = ["utxorpc-v1-cardano"]
"utxorpc-v1-sync" = ["utxorpc-v1-cardano"]
"utxorpc-v1-watch" = ["utxorpc-v1-cardano"]
"utxorpc-v1alpha-bitcoin" = []
"utxorpc-v1alpha-cardano" = []
"utxorpc-v1alpha-query" = ["utxorpc-v1alpha-cardano"]
Expand All @@ -35,6 +42,7 @@ proto_full = ["utxorpc-v1alpha-bitcoin","utxorpc-v1alpha-cardano","utxorpc-v1alp
"utxorpc-v1alpha-watch" = ["utxorpc-v1alpha-cardano"]
"utxorpc-v1beta-bitcoin" = []
"utxorpc-v1beta-cardano" = []
"utxorpc-v1beta-handshake" = []
"utxorpc-v1beta-query" = ["utxorpc-v1beta-cardano"]
"utxorpc-v1beta-submit" = ["utxorpc-v1beta-cardano"]
"utxorpc-v1beta-sync" = ["utxorpc-v1beta-cardano"]
Expand Down
50 changes: 50 additions & 0 deletions gen/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
// @generated
pub mod utxorpc {
pub mod v1 {
#[cfg(feature = "utxorpc-v1-bitcoin")]
// @@protoc_insertion_point(attribute:utxorpc.v1.bitcoin)
pub mod bitcoin {
include!("utxorpc.v1.bitcoin.rs");
// @@protoc_insertion_point(utxorpc.v1.bitcoin)
}
#[cfg(feature = "utxorpc-v1-cardano")]
// @@protoc_insertion_point(attribute:utxorpc.v1.cardano)
pub mod cardano {
include!("utxorpc.v1.cardano.rs");
// @@protoc_insertion_point(utxorpc.v1.cardano)
}
#[cfg(feature = "utxorpc-v1-handshake")]
// @@protoc_insertion_point(attribute:utxorpc.v1.handshake)
pub mod handshake {
include!("utxorpc.v1.handshake.rs");
// @@protoc_insertion_point(utxorpc.v1.handshake)
}
#[cfg(feature = "utxorpc-v1-query")]
// @@protoc_insertion_point(attribute:utxorpc.v1.query)
pub mod query {
include!("utxorpc.v1.query.rs");
// @@protoc_insertion_point(utxorpc.v1.query)
}
#[cfg(feature = "utxorpc-v1-submit")]
// @@protoc_insertion_point(attribute:utxorpc.v1.submit)
pub mod submit {
include!("utxorpc.v1.submit.rs");
// @@protoc_insertion_point(utxorpc.v1.submit)
}
#[cfg(feature = "utxorpc-v1-sync")]
// @@protoc_insertion_point(attribute:utxorpc.v1.sync)
pub mod sync {
include!("utxorpc.v1.sync.rs");
// @@protoc_insertion_point(utxorpc.v1.sync)
}
#[cfg(feature = "utxorpc-v1-watch")]
// @@protoc_insertion_point(attribute:utxorpc.v1.watch)
pub mod watch {
include!("utxorpc.v1.watch.rs");
// @@protoc_insertion_point(utxorpc.v1.watch)
}
}
pub mod v1alpha {
#[cfg(feature = "utxorpc-v1alpha-bitcoin")]
// @@protoc_insertion_point(attribute:utxorpc.v1alpha.bitcoin)
Expand Down Expand Up @@ -51,6 +95,12 @@ pub mod utxorpc {
include!("utxorpc.v1beta.cardano.rs");
// @@protoc_insertion_point(utxorpc.v1beta.cardano)
}
#[cfg(feature = "utxorpc-v1beta-handshake")]
// @@protoc_insertion_point(attribute:utxorpc.v1beta.handshake)
pub mod handshake {
include!("utxorpc.v1beta.handshake.rs");
// @@protoc_insertion_point(utxorpc.v1beta.handshake)
}
#[cfg(feature = "utxorpc-v1beta-query")]
// @@protoc_insertion_point(attribute:utxorpc.v1beta.query)
pub mod query {
Expand Down
48 changes: 48 additions & 0 deletions proto/utxorpc/v1/bitcoin/bitcoin.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
syntax = "proto3";

package utxorpc.v1.bitcoin;

// Represents an input in a Bitcoin transaction.
message TxInput {
optional bytes txid = 1; // Hash of the previous transaction output, corresponds to txid
optional bytes scriptSig = 2; // Unlocking script for spending the UTXO
uint32 sequence = 3; // Used for relative timelocks
optional bytes coinbase = 4; // Coinbase transactions have this instead of txid and scriptSig
repeated bytes txinwitness = 5; // Witness data for SegWit transactions
}

// Represents an output in a Bitcoin transaction.
message TxOutput {
uint64 value = 1; // Amount of Bitcoin in Satoshis
ScriptPubKey scriptPubKey = 2; // Locking script defining spendability
}

// Represents a script pub key in the output.
message ScriptPubKey {
bytes asm = 1; // Script in human-readable format
bytes hex = 2; // Script in hexadecimal format
bytes type = 3;
optional bytes address = 4; // Some outputs have addresses
}

// Represents a transaction in the Bitcoin network.
message Transaction {
uint32 version = 1; // Transaction version number. Currently 1
repeated TxInput vin = 2; // List of transaction inputs
repeated TxOutput vout = 3; // List of transaction outputs
uint32 locktime = 4; // Block height or timestamp when transaction is final
bytes hash = 5; // Hash of the transaction
optional bytes blockhash = 6; // Transactions reference their block
optional uint32 time = 7; // Timestamp of the transaction
}

// Represents a block in the Bitcoin blockchain.
message Block {
uint32 version = 1; // Block version number
optional bytes previousblockhash = 2; // Hash of the previous block
bytes merkleroot = 3; // Root hash of the Merkle tree
uint32 time = 4; // Time when the block was created
uint32 bits = 5; // Target difficulty value
uint32 nonce = 6; // Value used for Proof-of-Work
repeated Transaction tx = 7; // List of transactions included in the block
}
Loading
Loading