The support functions for Metadata have been removed. They have been moved to sway-standards.
Before:
use sway_libs::asset::metadata::*;
fn foo(my_metadata: Metadata) {
let res: bool = my_metadata.is_b256();
let res: bool = my_metadata.is_string();
let res: bool = my_metadata.is_bytes();
let res: bool = my_metadata.is_uint();
}
After:
use standards::src7::*;
fn foo(my_metadata: Metadata) {
let res: bool = my_metadata.is_b256();
let res: bool = my_metadata.is_string();
let res: bool = my_metadata.is_bytes();
let res: bool = my_metadata.is_uint();
}
The SetMetadata and _set_metadata function definitions have changed. The metadata argument is now an Option<Metadata> and the argument order has changed.
Type of change
Breaking
The following breaking changes have been made:
Metadata
have been removed. They have been moved to sway-standards.Before:
After:
SetMetadata
and_set_metadata
function definitions have changed. Themetadata
argument is now anOption<Metadata>
and the argument order has changed.Before:
After:
_set_name()
function'sname
argument is now anOption<String>
Before:
After:
_set_symbol()
function'sname
argument is now anOption<String>
Before:
After:
_mint()
function'ssub_id
argument is now anOption<SubId>
Before:
After:
Changes
The following changes have been made:
Forc.toml
files to use sway-standardsv0.6.0
Metadata
convenience functions_metadata()
function has been added_set_metadata()
function'smetadata
argument is now anOption<Metadata>
and the argument order has changedSetMetadata
abi'sset_metadata()
metadata
argument is now anOption<Metadata>
and the argument order has changed_set_metadata()
now reverts if the metadata is an empty string_set_metadata()
now reverts if the metadata are empty bytes_set_name()
function'sname
argument is now anOption<String>
_set_name()
now reverts if thename
argument is an empty string_set_symbol()
function'sname
argument is now anOption<String>
_set_symbol()
now reverts if thesymbol
argument is an empty string_mint()
function'ssub_id
argument is now anOption<SubId>
_mint()
now reverts if theamount
argument is zero_burn()
now reverts if theamount
argument is zero_mint()
have been added_burn()
have been added_set_name()
have been added_set_symbol()
have been added_set_decimals()
have been addedChecklist
Breaking*
orNew Feature
labels where relevant.