Skip to content

Commit

Permalink
feat: add ton address generator and sign feat
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoguang1010 committed Dec 13, 2024
1 parent 58e67d9 commit 7bbfe6d
Show file tree
Hide file tree
Showing 12 changed files with 456 additions and 514 deletions.
31 changes: 1 addition & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions token-core/tcx-libs/tonlib-core/src/cell/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ mod types;
pub(crate) use builder::DictBuilder;
pub(crate) use parser::DictParser;
pub use types::{KeyReader, SnakeFormatDict, ValReader, ValWriter};

#[cfg(test)]
mod tests;
232 changes: 0 additions & 232 deletions token-core/tcx-libs/tonlib-core/src/cell/dict/tests.rs

This file was deleted.

61 changes: 0 additions & 61 deletions token-core/tcx-libs/tonlib-core/src/cell/state_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,64 +66,3 @@ impl StateInit {
.cell_hash())
}
}

#[cfg(test)]
mod tests {
use std::sync::Arc;

use super::StateInitBuilder;
use crate::cell::{CellBuilder, TonCellError};

#[test]
fn test_state_init() -> Result<(), TonCellError> {
let code = Arc::new(CellBuilder::new().store_string("code")?.build()?);
let data = Arc::new(CellBuilder::new().store_string("data")?.build()?);
let state_init = StateInitBuilder::new(&code, &data)
.with_split_depth(true)
.with_tick_tock(true)
.with_library(true)
.build()?;

assert_eq!(state_init.data[0], 0b11111000);
println!("{:08b}", state_init.data[0]);

let code = Arc::new(CellBuilder::new().store_string("code")?.build()?);
let data = Arc::new(CellBuilder::new().store_string("data")?.build()?);
let state_init = StateInitBuilder::new(&code, &data)
.with_split_depth(false)
.with_tick_tock(false)
.with_library(false)
.build()?;

assert_eq!(state_init.data[0], 0b00110000);

let code = Arc::new(CellBuilder::new().store_string("code")?.build()?);
let data = Arc::new(CellBuilder::new().store_string("data")?.build()?);
let state_init = StateInitBuilder::new(&code, &data)
.with_split_depth(true)
.with_tick_tock(false)
.with_library(false)
.build()?;

assert_eq!(state_init.data[0], 0b10110000);

let code = Arc::new(CellBuilder::new().store_string("code")?.build()?);
let data = Arc::new(CellBuilder::new().store_string("data")?.build()?);
let state_init = StateInitBuilder::new(&code, &data)
.with_split_depth(false)
.with_tick_tock(true)
.with_library(false)
.build()?;
assert_eq!(state_init.data[0], 0b01110000);

let code = Arc::new(CellBuilder::new().store_string("code")?.build()?);
let data = Arc::new(CellBuilder::new().store_string("data")?.build()?);
let state_init = StateInitBuilder::new(&code, &data)
.with_split_depth(false)
.with_tick_tock(false)
.with_library(true)
.build()?;
assert_eq!(state_init.data[0], 0b00111000);
Ok(())
}
}
6 changes: 2 additions & 4 deletions token-core/tcx-libs/tonlib-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ pub mod cell;
// pub mod message;
// pub mod mnemonic;
pub mod types;
// pub mod wallet;
pub mod wallet;

pub use crate::types::{
TonAddress, TonAddressParseError, TonHash,
};
pub use crate::types::{TonAddress, TonAddressParseError, TonHash};
Loading

0 comments on commit 7bbfe6d

Please sign in to comment.