Skip to content

v0.23.0

Compare
Choose a tag to compare
@digorithm digorithm released this 08 Sep 17:10
· 538 commits to master since this release
82fa25d

What's Changed

Full Changelog: v0.22.0...v0.23.0

Breaking changes

Update to theProvider::connect() method

Provider::connect() now takes a string instead of a SocketAddr. This simplifies the process of connecting to a given node address. All you have to do is change from:

// This is the address of a running node.
let server_address: SocketAddr = "127.0.0.1:4000"
    .parse()
    .expect("Unable to parse socket address");

// Create the provider using the client.
let provider = Provider::connect(server_address).await.unwrap();

to:

let address = "[<port>:<IP> | <URL>]"; // port:IP like "127.0.0.1:4000" or a URL like "https://my-node-address.com"
let provider = Provider::connect(address).await.unwrap();

New features

Automatic fee estimation for hand-crafted transactions

When hand-crafting transactions with the SDK, you can now use add_fee_coins() to automatically add the necessary coins to that transaction, based on an automatic estimation:

let wallet_config = add_fee_coins_wallet_config(1);
let wallet = launch_custom_provider_and_get_wallets(wallet_config, None)
    .await
    .pop()
    .unwrap();
let mut tx = Wallet::build_transfer_tx(&[], &[], TxParameters::default());

wallet.add_fee_coins(&mut tx, 0, 0).await?;

Check out the cost estimation section in the SDK book.