Skip to content

Commit

Permalink
Fixes for new sdk version (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keshoid authored Jun 18, 2020
1 parent 46dd951 commit 3c69bd3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
license = "Apache-2.0"
keywords = ["TON", "SDK", "smart contract", "tonlabs"]
edition = "2018"
version = "0.1.7"
version = "0.1.8"

[dependencies]
base64 = "0.10.1"
Expand All @@ -26,9 +26,9 @@ serde_derive = "1.0.91"
sha2 = "0.8"

ton_abi = { git = "https://github.com/tonlabs/ton-labs-abi.git" }
ton-client-rs = { git = 'https://github.com/tonlabs/ton-client-rs.git', default-features = false, branch = "0.23.0-rc" }
ton_client = { git = 'https://github.com/tonlabs/TON-SDK.git', default_features = false, features = ["node_interaction"] }
ton_sdk = { git = 'https://github.com/tonlabs/TON-SDK.git', default-features = false }
ton-client-rs = { git = 'https://github.com/tonlabs/ton-client-rs.git', tag = "0.24.0" }
ton_client = { git = 'https://github.com/tonlabs/TON-SDK.git', tag = "0" }
ton_sdk = { git = 'https://github.com/tonlabs/TON-SDK.git', tag = "0" }
ton_types = { git = "https://github.com/tonlabs/ton-labs-types.git" }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ pub fn get_account(conf: Config, addr: &str) -> Result<(), String> {

println!("Processing...");
let query_result = ton.queries.accounts.query(
&json!({
json!({
"id": { "eq": addr }
}).to_string(),
}).into(),
ACCOUNT_FIELDS,
None,
None,
Expand Down
14 changes: 8 additions & 6 deletions src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn prepare_message(

ton.contracts.create_run_message(
addr,
abi,
abi.into(),
method,
header.map(|v| v.into()),
params.into(),
Expand Down Expand Up @@ -126,7 +126,7 @@ fn decode_call_parameters(ton: &TonClient, msg: &EncodedMessage, abi: &str) -> R
.map_err(|e| format!("couldn't create body BOC: {}", e))?;

let result = ton.contracts.decode_input_message_body(
&abi,
abi.into(),
&data[..],
false
).map_err(|e| format!("couldn't decode message body: {}", e))?;
Expand Down Expand Up @@ -210,11 +210,13 @@ pub fn call_contract_with_result(
ton.contracts.run_local(
&ton_addr,
None,
&abi,
abi.into(),
method,
None,
params.into(),
None
None,
None,
false
)
.map_err(|e| format!("run failed: {}", e.to_string()))?
.output
Expand All @@ -234,7 +236,7 @@ pub fn call_contract_with_result(
print_encoded_message(&msg);
println!("Processing... ");

ton.contracts.process_message(msg, Some(&abi), Some(method), None)
ton.contracts.process_message(msg, Some(abi.into()), Some(method), None)
.map_err(|e| format!("Failed: {}", e.to_string()))?
.output
};
Expand Down Expand Up @@ -311,7 +313,7 @@ pub fn call_contract_with_msg(conf: Config, str_msg: String, abi: String) -> Res
println!("Processing... ");
let result = ton.contracts.process_message(
msg,
Some(&abi),
Some(abi.into()),
Some(&method),
None
)
Expand Down
2 changes: 1 addition & 1 deletion src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn deploy_contract(conf: Config, tvc: &str, abi: &str, params: &str, keys_fi
.map_err(|e| format!("failed to read smart contract file: {}", e.to_string()))?;

println!("Deploying...");
let result = ton.contracts.deploy(&abi, &contract, None, params.into(), None, &keys, wc)
let result = ton.contracts.deploy(abi.into(), &contract, None, params.into(), None, &keys, wc)
.map_err(|e| format!("deploy failed: {}", e.to_string()))?;

println!("Transaction succeeded.");
Expand Down
2 changes: 1 addition & 1 deletion src/genaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn generate_address(
.unwrap_or(conf.wc);

let addr = ton.contracts.get_deploy_address(
&abi,
abi.clone().into(),
&contract,
initial_data.clone().map(|d| d.into()),
&keys.public,
Expand Down
6 changes: 3 additions & 3 deletions src/getconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,21 @@ pub fn query_global_config(conf: Config, index: &str) -> Result<(), String> {
let config_name = format!("p{}", index);

let last_key_block_query = ton.queries.blocks.query(
"{}",
"{}".into(),
"id prev_key_block_seqno",
Some(OrderBy{ path: "seq_no".to_owned(), direction: SortDirection::Descending }),
Some(1),
).map_err(|e| format!("failed to query last key block: {}", e.to_string()))?;

let config_query = ton.queries.blocks.query(
&json!({
json!({
"seq_no": {
"eq": last_key_block_query[0]["prev_key_block_seqno"].as_u64().unwrap()
},
"workchain_id": {
"eq": -1
}
}).to_string(),
}).into(),
QUERY_FIELDS,
None,
None,
Expand Down
2 changes: 1 addition & 1 deletion src/voting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ pub fn decode_proposal(
.map_err(|e| format!("failed to create tonclient: {}", e.to_string()))?;

let result = ton.contracts.decode_input_message_body(
TRANSFER_WITH_COMMENT,
TRANSFER_WITH_COMMENT.into(),
&base64::decode(&body).unwrap(),
true,
).map_err(|e| format!("failed to decode proposal payload: {}", e))?;
Expand Down

0 comments on commit 3c69bd3

Please sign in to comment.