I have set up a custom Substrate chain, and I want to modify the display name of my token.
What do I need to modify such that Polkadot JS and other APIs can discover my token name?
By default it is "Unit".
You can add the symbol and pass it to the Polkadot JS UI using the chainspec properties
.
In chain_spec.rs
import the use serde_json::json;
and then:
let mut props : Properties = Properties::new();
let value = json!("USD"); <--- (1)
props.insert("tokenSymbol".to_string(), value); <--- (2)
Ok(ChainSpec::from_genesis(
// Name
"Development",
// ID
"dev",
ChainType::Development,
move || testnet_genesis(
wasm_binary,
// Initial PoA authorities
vec![
authority_keys_from_seed("Alice"),
],
// Sudo account
get_account_id_from_seed::<sr25519::Public>("Alice"),
// Pre-funded accounts
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
true,
),
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
None,
// Properties
Some(props), <------------------------------ (3)
// Extensions
None,
))
Notice the 3 highlighted lines above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With