Type Alias hedera::TokenCreateTransaction
source · pub type TokenCreateTransaction = Transaction<TokenCreateTransactionData>;
Expand description
Create a new token.
After the token is created, the TokenId
for it is in the receipt.
The specified treasury account receives the initial supply of tokens, as well as the tokens
from a TokenMintTransaction
once executed.
The balance of the treasury account is decreased when a TokenBurnTransaction
is executed.
The initial_supply
is in the lowest denomination of the token (like a tinybar, not an hbar).
Note that a created token is immutable if the admin_key
is omitted. No property of
an immutable token can ever change, with the sole exception of its expiry. Anyone can pay to
extend the expiry time of an immutable token.
-
If
NonFungibleUnique
is used, theinitial_supply
should explicitly be set to 0 (which is the default). If not, the transaction will resolve toInvalidTokenInitialSupply
. -
If
Infinite
is used, themax_supply
should explicitly be set to 0 (which is the default). If it is not 0, the transaction will resolve toInvalidTokenMaxSupply
.
Aliased Type§
struct TokenCreateTransaction { /* private fields */ }
Implementations§
source§impl TokenCreateTransaction
impl TokenCreateTransaction
sourcepub fn name(&mut self, name: impl Into<String>) -> &mut Self
pub fn name(&mut self, name: impl Into<String>) -> &mut Self
Sets the publicly visible name of the token.
Maximum 100 characters.
sourcepub fn get_symbol(&self) -> &str
pub fn get_symbol(&self) -> &str
Returns the publicly visible token symbol.
sourcepub fn symbol(&mut self, symbol: impl Into<String>) -> &mut Self
pub fn symbol(&mut self, symbol: impl Into<String>) -> &mut Self
Sets the publicly visible token symbol.
Maximum 100 characters.
sourcepub fn get_decimals(&self) -> u32
pub fn get_decimals(&self) -> u32
Returns the number of decimal places the token is divisble by.
sourcepub fn decimals(&mut self, decimals: u32) -> &mut Self
pub fn decimals(&mut self, decimals: u32) -> &mut Self
Sets the number of decimal places a token is divisible by.
sourcepub fn get_initial_supply(&self) -> u64
pub fn get_initial_supply(&self) -> u64
Returns the initial supply of tokens to be put into circulation.
sourcepub fn initial_supply(&mut self, initial_supply: u64) -> &mut Self
pub fn initial_supply(&mut self, initial_supply: u64) -> &mut Self
Sets the initial supply of tokens to be put in circulation.
sourcepub fn get_treasury_account_id(&self) -> Option<AccountId>
pub fn get_treasury_account_id(&self) -> Option<AccountId>
Returns the account which will act as a treasury for the token.
sourcepub fn treasury_account_id(
&mut self,
treasury_account_id: AccountId
) -> &mut Self
pub fn treasury_account_id( &mut self, treasury_account_id: AccountId ) -> &mut Self
Sets the account which will act as a treasury for the token.
sourcepub fn get_admin_key(&self) -> Option<&Key>
pub fn get_admin_key(&self) -> Option<&Key>
Returns the key whcih can perform update/delete operations on the token.
sourcepub fn admin_key(&mut self, admin_key: impl Into<Key>) -> &mut Self
pub fn admin_key(&mut self, admin_key: impl Into<Key>) -> &mut Self
Sets the key which can perform update/delete operations on the token.
sourcepub fn get_kyc_key(&self) -> Option<&Key>
pub fn get_kyc_key(&self) -> Option<&Key>
Returns the key which can grant or revoke KYC of an account for the token’s transactions.
sourcepub fn kyc_key(&mut self, kyc_key: impl Into<Key>) -> &mut Self
pub fn kyc_key(&mut self, kyc_key: impl Into<Key>) -> &mut Self
Sets the key which can grant or revoke KYC of an account for the token’s transactions.
sourcepub fn get_freeze_key(&self) -> Option<&Key>
pub fn get_freeze_key(&self) -> Option<&Key>
Returns the key which can sign to freeze or unfreeze an account for token transactions.
sourcepub fn freeze_key(&mut self, freeze_key: impl Into<Key>) -> &mut Self
pub fn freeze_key(&mut self, freeze_key: impl Into<Key>) -> &mut Self
Sets the key which can sign to freeze or unfreeze an account for token transactions.
sourcepub fn get_wipe_key(&self) -> Option<&Key>
pub fn get_wipe_key(&self) -> Option<&Key>
Returns the key which can wipe the token balance of an account.
sourcepub fn wipe_key(&mut self, wipe_key: impl Into<Key>) -> &mut Self
pub fn wipe_key(&mut self, wipe_key: impl Into<Key>) -> &mut Self
Sets the key which can wipe the token balance of an account.
sourcepub fn get_supply_key(&self) -> Option<&Key>
pub fn get_supply_key(&self) -> Option<&Key>
Returns the key which can change the supply of the token.
sourcepub fn supply_key(&mut self, supply_key: impl Into<Key>) -> &mut Self
pub fn supply_key(&mut self, supply_key: impl Into<Key>) -> &mut Self
Sets the key which can change the supply of the token.
sourcepub fn get_freeze_default(&self) -> bool
pub fn get_freeze_default(&self) -> bool
Returnsthe default freeze status (frozen or unfrozen) of hedera accounts relative to this token. If true, an account must be unfrozen before it can receive the token.
sourcepub fn freeze_default(&mut self, freeze_default: bool) -> &mut Self
pub fn freeze_default(&mut self, freeze_default: bool) -> &mut Self
Sets the default freeze status (frozen or unfrozen) of hedera accounts relative to this token. If true, an account must be unfrozen before it can receive the token.
sourcepub fn get_expiration_time(&self) -> Option<OffsetDateTime>
pub fn get_expiration_time(&self) -> Option<OffsetDateTime>
Returns the time at which the token should expire.
sourcepub fn expiration_time(&mut self, expiration_time: OffsetDateTime) -> &mut Self
pub fn expiration_time(&mut self, expiration_time: OffsetDateTime) -> &mut Self
Sets the time at which the token should expire.
sourcepub fn get_auto_renew_account_id(&self) -> Option<AccountId>
pub fn get_auto_renew_account_id(&self) -> Option<AccountId>
Returns the account which will be automatically charged to renew the token’s expiration.
sourcepub fn auto_renew_account_id(
&mut self,
auto_renew_account_id: AccountId
) -> &mut Self
pub fn auto_renew_account_id( &mut self, auto_renew_account_id: AccountId ) -> &mut Self
Sets the account which will be automatically charged to renew the token’s expiration.
sourcepub fn get_auto_renew_period(&self) -> Option<Duration>
pub fn get_auto_renew_period(&self) -> Option<Duration>
Returns the interval at which the auto renew account will be charged to extend the token’s expiry.
sourcepub fn auto_renew_period(&mut self, auto_renew_period: Duration) -> &mut Self
pub fn auto_renew_period(&mut self, auto_renew_period: Duration) -> &mut Self
Sets the interval at which the auto renew account will be charged to extend the token’s expiry.
sourcepub fn get_token_memo(&self) -> &str
pub fn get_token_memo(&self) -> &str
Returns the memo associated with the token.
sourcepub fn token_memo(&mut self, memo: impl Into<String>) -> &mut Self
pub fn token_memo(&mut self, memo: impl Into<String>) -> &mut Self
Sets the memo associated with the token.
Maximum 100 bytes.
sourcepub fn get_token_type(&self) -> TokenType
pub fn get_token_type(&self) -> TokenType
Returns the token type.
sourcepub fn token_type(&mut self, token_type: TokenType) -> &mut Self
pub fn token_type(&mut self, token_type: TokenType) -> &mut Self
Sets the token type. Defaults to FungibleCommon
.
sourcepub fn get_token_supply_type(&self) -> TokenSupplyType
pub fn get_token_supply_type(&self) -> TokenSupplyType
Returns the token supply type.
sourcepub fn token_supply_type(
&mut self,
token_supply_type: TokenSupplyType
) -> &mut Self
pub fn token_supply_type( &mut self, token_supply_type: TokenSupplyType ) -> &mut Self
Sets the token supply type. Defaults to Infinite
.
sourcepub fn get_max_supply(&self) -> u64
pub fn get_max_supply(&self) -> u64
Returns the maximum number of tokens that can be in circulation.
sourcepub fn max_supply(&mut self, max_supply: u64) -> &mut Self
pub fn max_supply(&mut self, max_supply: u64) -> &mut Self
Sets the maximum number of tokens that can be in circulation.
sourcepub fn get_fee_schedule_key(&self) -> Option<&Key>
pub fn get_fee_schedule_key(&self) -> Option<&Key>
Returns the key which can change the token’s custom fee schedule.
sourcepub fn fee_schedule_key(
&mut self,
fee_schedule_key: impl Into<Key>
) -> &mut Self
pub fn fee_schedule_key( &mut self, fee_schedule_key: impl Into<Key> ) -> &mut Self
Sets the key which can change the token’s custom fee schedule.
sourcepub fn get_custom_fees(&self) -> &[AnyCustomFee]
pub fn get_custom_fees(&self) -> &[AnyCustomFee]
Returns the custom fees to be assessed during a transfer.
sourcepub fn custom_fees(
&mut self,
custom_fees: impl IntoIterator<Item = AnyCustomFee>
) -> &mut Self
pub fn custom_fees( &mut self, custom_fees: impl IntoIterator<Item = AnyCustomFee> ) -> &mut Self
Sets the custom fees to be assessed during a transfer.
sourcepub fn get_pause_key(&self) -> Option<&Key>
pub fn get_pause_key(&self) -> Option<&Key>
Returns the key which can pause and unpause the token.
sourcepub fn pause_key(&mut self, pause_key: impl Into<Key>) -> &mut Self
pub fn pause_key(&mut self, pause_key: impl Into<Key>) -> &mut Self
Sets the key which can pause and unpause the token.
sourcepub fn get_metadata(&self) -> Vec<u8> ⓘ
pub fn get_metadata(&self) -> Vec<u8> ⓘ
Returns the metadata of the created token definition.
sourcepub fn metadata(&mut self, metadata: Vec<u8>) -> &mut Self
pub fn metadata(&mut self, metadata: Vec<u8>) -> &mut Self
Sets metadata of the created token definition.
sourcepub fn get_metadata_key(&self) -> Option<&Key>
pub fn get_metadata_key(&self) -> Option<&Key>
Returns the key which can change the metadata of a token.
sourcepub fn metadata_key(&mut self, metadata_key: impl Into<Key>) -> &mut Self
pub fn metadata_key(&mut self, metadata_key: impl Into<Key>) -> &mut Self
Sets the key which can change the metadata of a token.