v0.47.0
What's Changed
- chore: remove forc patch branch by @hal3e in #1083
- separate send_transaction and get_receipts by @Salka1988 in #1073
- chore: check doc links for private items in CI by @Br1ght0ne in #1095
- style!: unify string type names by @iqdecay in #1090
- style!: rename 'set_' to 'with_' by @MujkicA in #1096
- feat!: resolve witness indexes automatically by @hal3e in #1069
- fix: validate multi-calls wrt to heap types by @hal3e in #1100
- chore: replace deprecated
chrono
functions by @hal3e in #1111 - fix: pull max gas from provider by @MujkicA in #1115
- Bump versions to 0.47.0 by @digorithm in #1116
Full Changelog: v0.46.0...v0.47.0
Breaking changes
*_set
methods renamed to *_with
Some *_set
methods were renamed to *_with
to reflect better the ownership model they follow.
For instance, this:
let configuration = LoadConfiguration::default()
.set_storage_configuration(storage_configuration)
.set_salt(salt);
// Optional: Configure deployment parameters
let tx_parameters = TxParameters::default()
.set_gas_price(0)
.set_gas_limit(1_000_000)
.set_maturity(0);
Becomes:
let configuration = LoadConfiguration::default()
.with_storage_configuration(storage_configuration)
.with_salt(salt);
// Optional: Configure deployment parameters
let tx_parameters = TxParameters::default()
.with_gas_price(0)
.with_gas_limit(1_000_000)
.with_maturity(0);
As well as
set_contract_ids
->with_contract_ids
set_gas_forwarded
->with_gas_forwarded
CallParameters::default().set_amount(deposit_amount).set_asset_id(base_asset_id);
->CallParameters::default().with_amount(deposit_amount).with_asset_id(base_asset_id);
set_consensus_parameters(consensus_parameters);
->with_consensus_parameters(consensus_parameters);
So, when migrating to this version, some things will break, and to fix it is easy: rename these methods with set
in them to with
, and it should work seamlessly.
String types
Sway's String
type is equivalent to the Rust String
. This change was impossible before because the String name was already taken for statically-sized strings, now called StringArray
s.
This only affects you if you use ParamType
s directly: ParamType::String(len)
is now ParamType::StringArray(len)
and ParamType::StdString
is now ParamType::String
.
Sending transactions doesn't return receipts anymore, only the transaction ID
send_transaction(&tx)
used to wait for the transaction to be completed and then it would return the receipts. That's not the case anymore; Now, it returns the transactions ID and then you use this ID to query for the receipts:
let receipts = self.try_provider()?.send_transaction(&tx).await?;
Becomes
let tx_id = self.try_provider()?.send_transaction(&tx).await?;
let receipts = provider.get_receipts(&tx_id).await?;
This allows more flexibility to send transactions asynchronously and then grab the receipts if needed.