You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
use anyhow::anyhow;
use num_bigint::BigUint;
use std::time::SystemTime;
use std::sync::Arc;
use tonlib_core::TonAddress;
use tonlib_core::cell::BagOfCells;
use tonlib_core::message::TransferMessage;
use tonlib_core::wallet::TonWallet;
use tonlib_client::client::TonClient;
use tonlib_client::client::TonClientInterface;
use tonlib_core::mnemonic::KeyPair;
use tonlib_core::mnemonic::Mnemonic;
use tonlib_core::wallet::WalletVersion;
use tonlib_core::message::TonMessage;
use tonlib_core::message::CommonMsgInfo;
use tonlib_core::message::ExternalIncomingMessage;
let client = TonClient::default().await?;
let wallet = TonWallet::derive_default(WalletVersion::V4R2, &key_pair)?;
let src: TonAddress = "<source wallet address>".parse()?;
let dest: TonAddress = "<destination wallet address>".parse()?;
let value = BigUint::from(10000000u64); // 0.01 TON
let external_msg_info = ExternalIncomingMessage{
src,
dest,
import_fee: value,
};
let common_msg_info = CommonMsgInfo::ExternalIncomingMessage(external_msg_info);
let transfer = TransferMessage::new(common_msg_info).build()?;
let now = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)?
.as_secs() as u32;
let body = wallet.create_external_body(now + 60, seqno, vec![Arc::new(transfer)])?;
let signed = wallet.sign_external_body(&body)?;
let wrapped = wallet.wrap_signed_body(signed, true)?;
let boc = BagOfCells::from_root(wrapped);
let tx = boc.serialize(true)?;
let hash = client.send_raw_message_return_hash(tx.as_slice()).await?;
Ok(())
`
use anyhow::anyhow;
use num_bigint::BigUint;
use std::time::SystemTime;
use std::sync::Arc;
use tonlib_core::TonAddress;
use tonlib_core::cell::BagOfCells;
use tonlib_core::message::TransferMessage;
use tonlib_core::wallet::TonWallet;
use tonlib_client::client::TonClient;
use tonlib_client::client::TonClientInterface;
use tonlib_core::mnemonic::KeyPair;
use tonlib_core::mnemonic::Mnemonic;
use tonlib_core::wallet::WalletVersion;
use tonlib_core::message::TonMessage;
use tonlib_core::message::CommonMsgInfo;
use tonlib_core::message::ExternalIncomingMessage;
async fn create_simple_transfer() -> anyhow::Result<()> {
let mnemonic = Mnemonic::new(
vec![
"dose", "ice", "enrich", "trigger", "test", "dove", "century", "still", "betray",
"gas", "diet", "dune",
],
&None,
)?;
let key_pair = mnemonic.to_key_pair()?;
let seqno = 30000000;
}`
I use this code, and the send ton result like this:
https://testnet.tonviewer.com/transaction/40078342e4f95883f9a8b54195687f41327d1b8defcf46bb776239c48af0aaac
Please check the error. thanks.
The text was updated successfully, but these errors were encountered: