Skip to content

Commit 2903e92

Browse files
committed
node and persistence init
1 parent 7a825df commit 2903e92

17 files changed

Lines changed: 234 additions & 472 deletions

File tree

Cargo.lock

Lines changed: 50 additions & 371 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@ native_model = "0.4.20"
3434

3535
serde = { version = "1", features = ["derive"] }
3636
serde_yaml = "0.9.34"
37+
toml = "0.9.2"
3738
ciborium = "0.2.2"
3839

3940
clap = { version = "4.4.8", features = ["derive", "env"] }
4041
clap_complete = "4.5.7"
4142
log = { version = "0.4" }
4243
loglevel = { version = "0.2.0" }
4344
shellexpand = { version = "3.1.0" }
44-
dotenv = { version = "0.15" }
45-
settings = { version = "0.14", package = "config" }
46-
configure_me = { version = "0.4" }
47-
configure_me_codegen = "0.4.4"
4845

4946
[package]
5047
name = "rgb-node"
@@ -83,23 +80,22 @@ native_db.workspace = true
8380
native_model.workspace = true
8481
async-channel = { version = "2.3.1", optional = true }
8582
serde.workspace = true
83+
toml = { workspace = true, optional = true }
8684
log.workspace = true
8785
loglevel.workspace = true
8886
clap = { workspace = true, optional = true }
8987
shellexpand = { workspace = true, optional = true }
90-
settings = { workspace = true, optional = true }
91-
configure_me = { workspace = true, optional = true }
92-
dotenv = { workspace = true, optional = true }
9388

9489
[build-dependencies]
9590
amplify.workspace = true
9691
bp-std.workspace = true
9792
rgb-rpc = { version = "0.12.0-alpha.1", path = "rpc" }
93+
serde.workspace = true
94+
toml.workspace = true
9895
clap.workspace = true
9996
clap_complete.workspace = true
10097
log.workspace = true
10198
shellexpand.workspace = true
102-
configure_me_codegen.workspace = true
10399

104100
[features]
105101
default = []
@@ -108,7 +104,7 @@ all = ["server"]
108104
# Server is a standalone application that runs daemons.
109105
# Required for all apps that can be launched from a command-line shell as binaries
110106
# (i.e., both servers and cli)
111-
server = ["dep:dotenv", "dep:clap", "dep:settings", "dep:configure_me", "dep:shellexpand"]
107+
server = ["dep:clap", "dep:shellexpand", "dep:toml"]
112108
embedded = ["async-channel"]
113109

114110
[package.metadata.configure_me]

build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ compile_error!("Either `embedded` or `server` feature must be used");
2727
#[cfg(feature = "server")]
2828
#[macro_use]
2929
extern crate amplify;
30+
#[macro_use]
31+
extern crate serde;
3032
#[cfg(feature = "server")]
3133
#[macro_use]
3234
extern crate clap;
@@ -42,7 +44,7 @@ pub mod rgbnode {
4244
}
4345

4446
#[cfg(feature = "server")]
45-
fn main() -> Result<(), configure_me_codegen::Error> {
47+
fn main() -> Result<(), clap::Error> {
4648
use std::fs;
4749

4850
use clap::CommandFactory;
@@ -60,7 +62,6 @@ fn main() -> Result<(), configure_me_codegen::Error> {
6062
generate_to(Zsh, app, &name, outdir)?;
6163
}
6264

63-
// configure_me_codegen::build_script_auto()
6465
Ok(())
6566
}
6667

client/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ amplify.workspace = true
3636
clap.workspace = true
3737
clap_complete.workspace = true
3838
rgb-rpc = { version = "0.12.0-alpha.1", path = "../rpc" }
39-
configure_me_codegen.workspace = true
4039

4140
[features]
4241
default = ["cli"]

client/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub mod cli {
3434
include!("src/args.rs");
3535
}
3636

37-
fn main() -> Result<(), configure_me_codegen::Error> {
37+
fn main() -> Result<(), clap::Error> {
3838
let outdir = "../shell";
3939

4040
fs::create_dir_all(outdir).expect("failed to create shell dir");
@@ -46,6 +46,5 @@ fn main() -> Result<(), configure_me_codegen::Error> {
4646
generate_to(Zsh, app, &name, outdir)?;
4747
}
4848

49-
// configure_me_codegen::build_script_auto()
5049
Ok(())
5150
}

config_spec.toml

Lines changed: 0 additions & 16 deletions
This file was deleted.

rpc/src/request.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use std::io::{Read, Write};
2323

2424
use amplify::confinement::{SmallBlob, TinyBlob};
25+
use bpstd::Network;
2526
use netservices::Frame;
2627
use sonicapi::{CodexId, ContractId};
2728

@@ -31,6 +32,9 @@ use crate::CiboriumError;
3132
#[display(UPPERCASE)]
3233
#[derive(Serialize, Deserialize)]
3334
pub enum RgbRpcReq {
35+
#[display("HELLO({0})")]
36+
Hello(Network),
37+
3438
#[display("PING")]
3539
Ping(TinyBlob),
3640

rpc/src/response.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ use crate::{CiboriumError, Failure, Status};
3737
#[derive(Clone, Debug, Display)]
3838
#[derive(Serialize, Deserialize)]
3939
pub enum RgbRpcResp {
40+
#[display("MESSAGE({0})")]
41+
Message(String),
42+
4043
#[display("FAILURE({0})")]
4144
Failure(Failure),
4245

shell/_rgb-node

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ _rgb-node() {
1717
_arguments "${_arguments_options[@]}" : \
1818
'-d+[Location of the data directory]:DATA_DIR:_files -/' \
1919
'--data-dir=[Location of the data directory]:DATA_DIR:_files -/' \
20+
'-c+[]:CONFIG:_files -/' \
21+
'--config=[]:CONFIG:_files -/' \
2022
'-n+[Bitcoin network]:NETWORK:_default' \
2123
'--network=[Bitcoin network]:NETWORK:_default' \
2224
'*-l+[Address(es) to listen for client RPC connections]:LISTEN:_default' \
2325
'*--listen=[Address(es) to listen for client RPC connections]:LISTEN:_default' \
2426
'*-v[Set a verbosity level]' \
2527
'*--verbose[Set a verbosity level]' \
26-
'--no-network-prefix[Do not add network name as a prefix to the data directory]' \
2728
'-h[Print help (see more with '\''--help'\'')]' \
2829
'--help[Print help (see more with '\''--help'\'')]' \
2930
'-V[Print version]' \
@@ -41,11 +42,12 @@ _rgb-node() {
4142
_arguments "${_arguments_options[@]}" : \
4243
'-d+[Location of the data directory]:DATA_DIR:_files -/' \
4344
'--data-dir=[Location of the data directory]:DATA_DIR:_files -/' \
45+
'-c+[]:CONFIG:_files -/' \
46+
'--config=[]:CONFIG:_files -/' \
4447
'-n+[Bitcoin network]:NETWORK:_default' \
4548
'--network=[Bitcoin network]:NETWORK:_default' \
4649
'*-v[Set a verbosity level]' \
4750
'*--verbose[Set a verbosity level]' \
48-
'--no-network-prefix[Do not add network name as a prefix to the data directory]' \
4951
'-h[Print help (see more with '\''--help'\'')]' \
5052
'--help[Print help (see more with '\''--help'\'')]' \
5153
&& ret=0

shell/_rgb-node.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ Register-ArgumentCompleter -Native -CommandName 'rgb-node' -ScriptBlock {
2323
'rgb-node' {
2424
[CompletionResult]::new('-d', '-d', [CompletionResultType]::ParameterName, 'Location of the data directory')
2525
[CompletionResult]::new('--data-dir', '--data-dir', [CompletionResultType]::ParameterName, 'Location of the data directory')
26+
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
27+
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'config')
2628
[CompletionResult]::new('-n', '-n', [CompletionResultType]::ParameterName, 'Bitcoin network')
2729
[CompletionResult]::new('--network', '--network', [CompletionResultType]::ParameterName, 'Bitcoin network')
2830
[CompletionResult]::new('-l', '-l', [CompletionResultType]::ParameterName, 'Address(es) to listen for client RPC connections')
2931
[CompletionResult]::new('--listen', '--listen', [CompletionResultType]::ParameterName, 'Address(es) to listen for client RPC connections')
3032
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'Set a verbosity level')
3133
[CompletionResult]::new('--verbose', '--verbose', [CompletionResultType]::ParameterName, 'Set a verbosity level')
32-
[CompletionResult]::new('--no-network-prefix', '--no-network-prefix', [CompletionResultType]::ParameterName, 'Do not add network name as a prefix to the data directory')
3334
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
3435
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
3536
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
@@ -41,11 +42,12 @@ Register-ArgumentCompleter -Native -CommandName 'rgb-node' -ScriptBlock {
4142
'rgb-node;init' {
4243
[CompletionResult]::new('-d', '-d', [CompletionResultType]::ParameterName, 'Location of the data directory')
4344
[CompletionResult]::new('--data-dir', '--data-dir', [CompletionResultType]::ParameterName, 'Location of the data directory')
45+
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
46+
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'config')
4447
[CompletionResult]::new('-n', '-n', [CompletionResultType]::ParameterName, 'Bitcoin network')
4548
[CompletionResult]::new('--network', '--network', [CompletionResultType]::ParameterName, 'Bitcoin network')
4649
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'Set a verbosity level')
4750
[CompletionResult]::new('--verbose', '--verbose', [CompletionResultType]::ParameterName, 'Set a verbosity level')
48-
[CompletionResult]::new('--no-network-prefix', '--no-network-prefix', [CompletionResultType]::ParameterName, 'Do not add network name as a prefix to the data directory')
4951
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
5052
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
5153
break

0 commit comments

Comments
 (0)