Skip to content

Commit 112279a

Browse files
committed
fixed dst model for raw message
1 parent 664aae3 commit 112279a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/models.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ pub fn make_raw_message(raw: ton_types::Cell) -> JsRawMessage {
436436
#[derive(Default)]
437437
struct MessageCommon {
438438
pub src: Option<MsgAddressInt>,
439-
pub dst: Option<MsgAddressInt>,
439+
pub dst: Option<String>,
440440
pub value: u64,
441441
pub bounce: bool,
442442
pub bounced: bool,
@@ -449,24 +449,27 @@ pub fn make_raw_message(raw: ton_types::Cell) -> JsRawMessage {
449449
ton_block::MsgAddressIntOrNone::Some(addr) => Some(addr.clone()),
450450
ton_block::MsgAddressIntOrNone::None => None,
451451
},
452-
dst: Some(header.dst.clone()),
452+
dst: Some(header.dst.to_string()),
453453
value: header.value.grams.as_u128() as u64,
454454
bounce: header.bounce,
455455
bounced: header.bounced,
456456
msg_type: "IntMsg".to_string(),
457457
},
458458
ton_block::CommonMsgInfo::ExtInMsgInfo(header) => MessageCommon {
459459
src: None,
460-
dst: Some(header.dst.clone()),
460+
dst: Some(header.dst.to_string()),
461461
msg_type: "ExtIn".to_string(),
462462
..Default::default()
463463
},
464464
ton_block::CommonMsgInfo::ExtOutMsgInfo(header) => {
465465
let dst = match header.dst.clone() {
466466
MsgAddressExt::AddrNone => None,
467-
MsgAddressExt::AddrExtern(mut addr) => {
468-
MsgAddressInt::construct_from(&mut addr.external_address).ok()
469-
}
467+
MsgAddressExt::AddrExtern(addr) => Some(
468+
addr.external_address
469+
.as_hex_string()
470+
.drain(..addr.len.as_u32() as usize)
471+
.collect(),
472+
),
470473
};
471474
MessageCommon {
472475
src: match &header.src {
@@ -508,7 +511,7 @@ pub fn make_raw_message(raw: ton_types::Cell) -> JsRawMessage {
508511
ObjectBuilder::new()
509512
.set("hash", hash.to_hex_string())
510513
.set("src", common.src.as_ref().map(ToString::to_string))
511-
.set("dst", common.dst.as_ref().map(ToString::to_string))
514+
.set("dst", common.dst)
512515
.set("value", common.value.to_string())
513516
.set("bounce", common.bounce)
514517
.set("bounced", common.bounced)

0 commit comments

Comments
 (0)