Skip to content

Commit 79d3e8c

Browse files
committed
Merge development.
2 parents 46f7139 + 23da169 commit 79d3e8c

6 files changed

Lines changed: 118 additions & 24 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ tokio = { version = "1.28.2", features = ["full"] }
120120
[dev-dependencies]
121121
wasm-bindgen-test = "0.3.36"
122122

123+
[build-dependencies]
124+
anyhow = "1.0.71"
125+
rgb-std = { version = "0.10.2" }
126+
serde = "1.0.164"
127+
toml = { version = "0.7.5", features = ["preserve_order"] }
128+
123129
[patch.crates-io]
124130
# TODO: Remove this after support amplify 4.x (custom)
125131
bitcoin_scripts = { git = "https://github.com/crisdut/bp-foundation", branch = "release/0.10.0-alpha.2" }

RGB_LIB_IDs.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Auto-generated semantic IDs for RGB consensus-critical libraries and their corresponding versions of bitmask-core.
2+
3+
[LIB_ID_RGB]
4+
memphis_asia_crash_4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V = "0.6.0-rc.6"
5+
6+
[LIB_ID_RGB20]
7+
dragon_table_game_GVz4mvYE94aQ9q2HPtV9VuoppcDdduP54BMKffF7YoFH = "0.6.0-rc.6"
8+
9+
[LIB_ID_RGB21]
10+
benny_horse_salad_E3AsDKsHSqAPQLvJke3DcPrkErbS2Jxf8pQ8jYBQYJPA = "0.6.0-rc.6"
11+
12+
[LIB_ID_RGB25]
13+
ritual_mask_next_4JmGrg7oTgwuCQtyC4ezC38ToHMzgMCVS5kMSDPwo2ee = "0.6.0-rc.6"
14+
15+
[LIB_ID_RGB_CONTRACT]
16+
price_canvas_oliver_9Te5P6nq3oaDHMgttLEbkojbeQPTqqZLhjxZ3my1F8aJ = "0.6.0-rc.6"
17+
18+
[LIB_ID_RGB_STD]
19+
patent_iris_torch_Firwvn75qng8cm4n7iHXXiFDsG1V476vYGqdfwwFRT1b = "0.6.0-rc.6"

build.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
use std::{collections::BTreeMap, fs};
2+
3+
use anyhow::Result;
4+
use rgbstd::{
5+
interface::{LIB_ID_RGB20, LIB_ID_RGB21, LIB_ID_RGB25},
6+
stl::{LIB_ID_RGB, LIB_ID_RGB_CONTRACT, LIB_ID_RGB_STD},
7+
};
8+
use serde::{Deserialize, Serialize};
9+
10+
type IdVersionMap = BTreeMap<String, String>;
11+
12+
#[allow(non_snake_case)]
13+
#[derive(Deserialize, Serialize)]
14+
struct LibIds {
15+
LIB_ID_RGB: IdVersionMap,
16+
LIB_ID_RGB20: IdVersionMap,
17+
LIB_ID_RGB21: IdVersionMap,
18+
LIB_ID_RGB25: IdVersionMap,
19+
LIB_ID_RGB_CONTRACT: IdVersionMap,
20+
LIB_ID_RGB_STD: IdVersionMap,
21+
}
22+
23+
const LIB_IDS_FILE: &str = "RGB_LIB_IDs.toml";
24+
const NOTE_COMMENT: &str =
25+
"# Auto-generated semantic IDs for RGB consensus-critical libraries and their corresponding versions of bitmask-core.\n\n";
26+
27+
fn main() -> Result<()> {
28+
const BMC_VERSION: &str = env!("CARGO_PKG_VERSION");
29+
30+
let lib_ids_file = fs::read_to_string(LIB_IDS_FILE)?;
31+
let mut lib_ids: LibIds = toml::from_str(&lib_ids_file)?;
32+
33+
lib_ids
34+
.LIB_ID_RGB
35+
.entry(LIB_ID_RGB.to_owned())
36+
.or_insert(BMC_VERSION.to_owned());
37+
38+
lib_ids
39+
.LIB_ID_RGB20
40+
.entry(LIB_ID_RGB20.to_owned())
41+
.or_insert(BMC_VERSION.to_owned());
42+
43+
lib_ids
44+
.LIB_ID_RGB21
45+
.entry(LIB_ID_RGB21.to_owned())
46+
.or_insert(BMC_VERSION.to_owned());
47+
48+
lib_ids
49+
.LIB_ID_RGB25
50+
.entry(LIB_ID_RGB25.to_owned())
51+
.or_insert(BMC_VERSION.to_owned());
52+
53+
lib_ids
54+
.LIB_ID_RGB_CONTRACT
55+
.entry(LIB_ID_RGB_CONTRACT.to_owned())
56+
.or_insert(BMC_VERSION.to_owned());
57+
58+
lib_ids
59+
.LIB_ID_RGB_STD
60+
.entry(LIB_ID_RGB_STD.to_owned())
61+
.or_insert(BMC_VERSION.to_owned());
62+
63+
let toml = toml::to_string(&lib_ids)?;
64+
fs::write(LIB_IDS_FILE, format!("{NOTE_COMMENT}{toml}"))?;
65+
66+
Ok(())
67+
}

tests/rgb/unit/stl.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@ use rgbstd::{
77

88
#[tokio::test]
99
async fn check_rgb20_stl() -> Result<()> {
10-
let shema = rgb20_stl();
11-
assert_eq!(LIB_ID_RGB20, shema.id().to_string());
10+
let schema = rgb20_stl();
11+
assert_eq!(LIB_ID_RGB20, schema.id().to_string());
1212
Ok(())
1313
}
1414

1515
#[tokio::test]
1616
async fn check_rgb21_stl() -> Result<()> {
17-
let shema = rgb21_stl();
18-
assert_eq!(LIB_ID_RGB21, shema.id().to_string());
17+
let schema = rgb21_stl();
18+
assert_eq!(LIB_ID_RGB21, schema.id().to_string());
1919
Ok(())
2020
}
2121

2222
#[tokio::test]
2323
async fn check_rgb25_stl() -> Result<()> {
24-
let shema = rgb25_stl();
25-
assert_eq!(LIB_ID_RGB25, shema.id().to_string());
24+
let schema = rgb25_stl();
25+
assert_eq!(LIB_ID_RGB25, schema.id().to_string());
2626
Ok(())
2727
}
2828

2929
#[tokio::test]
3030
async fn check_rgbstd_stl() -> Result<()> {
31-
let shema = rgb_std_stl();
32-
assert_eq!(LIB_ID_RGB_STD, shema.id().to_string());
31+
let schema = rgb_std_stl();
32+
assert_eq!(LIB_ID_RGB_STD, schema.id().to_string());
3333
Ok(())
3434
}
3535

3636
#[tokio::test]
3737
async fn check_rgbcontract_stl() -> Result<()> {
38-
let shema = rgb_contract_stl();
39-
assert_eq!(LIB_ID_RGB_CONTRACT, shema.id().to_string());
38+
let schema = rgb_contract_stl();
39+
assert_eq!(LIB_ID_RGB_CONTRACT, schema.id().to_string());
4040
Ok(())
4141
}

tests/rgb/web/stl_ids.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ wasm_bindgen_test_configure!(run_in_browser);
1010

1111
#[wasm_bindgen_test]
1212
async fn check_rgb20_stl() {
13-
let shema = rgb20_stl();
14-
assert_eq!(LIB_ID_RGB20, shema.id().to_string());
13+
let schema = rgb20_stl();
14+
assert_eq!(LIB_ID_RGB20, schema.id().to_string());
1515
}
1616

1717
#[wasm_bindgen_test]
1818
async fn check_rgb21_stl() {
19-
let shema = rgb21_stl();
20-
assert_eq!(LIB_ID_RGB21, shema.id().to_string());
19+
let schema = rgb21_stl();
20+
assert_eq!(LIB_ID_RGB21, schema.id().to_string());
2121
}
2222

2323
#[wasm_bindgen_test]
2424
async fn check_rgb25_stl() {
25-
let shema = rgb25_stl();
26-
assert_eq!(LIB_ID_RGB25, shema.id().to_string());
25+
let schema = rgb25_stl();
26+
assert_eq!(LIB_ID_RGB25, schema.id().to_string());
2727
}
2828

2929
#[wasm_bindgen_test]
3030
async fn check_rgbstd_stl() {
31-
let shema = rgb_std_stl();
32-
assert_eq!(LIB_ID_RGB_STD, shema.id().to_string());
31+
let schema = rgb_std_stl();
32+
assert_eq!(LIB_ID_RGB_STD, schema.id().to_string());
3333
}
3434

3535
#[wasm_bindgen_test]
3636
async fn check_rgbcontract_stl() {
37-
let shema = rgb_contract_stl();
38-
assert_eq!(LIB_ID_RGB_CONTRACT, shema.id().to_string());
37+
let schema = rgb_contract_stl();
38+
assert_eq!(LIB_ID_RGB_CONTRACT, schema.id().to_string());
3939
}

0 commit comments

Comments
 (0)