Skip to content

Commit a315adf

Browse files
sdk - large scr value fix & test
1 parent a89768e commit a315adf

File tree

4 files changed

+426
-5
lines changed

4 files changed

+426
-5
lines changed

sdk/core/src/data/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub struct ApiLogs {
133133
pub struct ApiSmartContractResult {
134134
pub hash: String,
135135
pub nonce: u64,
136-
pub value: u64,
136+
pub value: u128, // consider switching to BigUint is this proves insufficient
137137
pub receiver: Bech32Address,
138138
pub sender: Bech32Address,
139139
#[serde(default)]

sdk/core/tests/retrieve_tx_on_network_test.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use multiversx_chain_core::types::ReturnCode;
22
use multiversx_sdk::{
3-
data::transaction::TransactionOnNetwork,
3+
data::transaction::{TransactionInfo, TransactionOnNetwork},
44
retrieve_tx_on_network::{
55
extract_message_from_string_reason, find_code_and_message, parse_reason,
66
replace_with_error_message,
@@ -1028,3 +1028,13 @@ fn replace_logs_reason_invalid_test() {
10281028
tx.logs.unwrap().events[0].topics
10291029
);
10301030
}
1031+
1032+
#[test]
1033+
fn tx_with_large_scr_value() {
1034+
let tx_str = include_str!("tx_with_large_scr_value.json");
1035+
1036+
let tx_info = serde_json::from_str::<TransactionInfo>(tx_str).unwrap();
1037+
1038+
let scr_with_large_value = &tx_info.data.unwrap().transaction.smart_contract_results[5];
1039+
assert!(scr_with_large_value.value > u64::MAX as u128);
1040+
}

0 commit comments

Comments
 (0)