Struct polymesh_api::polymesh::api::asset::AssetCallApi
source · pub struct AssetCallApi<'api> { /* private fields */ }Implementations§
source§impl<'api> AssetCallApi<'api>
impl<'api> AssetCallApi<'api>
sourcepub fn register_ticker(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn register_ticker(&self, ticker: Ticker) -> Result<WrappedCall>
Registers a new ticker or extends validity of an existing ticker. NB: Ticker validity does not get carry forward when renewing ticker.
§Arguments
originIt contains the secondary key of the caller (i.e. who signed the transaction to execute this function).tickerticker to register.
§Permissions
- Asset
sourcepub fn accept_ticker_transfer(&self, auth_id: u64) -> Result<WrappedCall>
pub fn accept_ticker_transfer(&self, auth_id: u64) -> Result<WrappedCall>
Accepts a ticker transfer.
Consumes the authorization auth_id (see pallet_identity::consume_auth).
NB: To reject the transfer, call remove auth function in identity module.
§Arguments
originIt contains the secondary key of the caller (i.e. who signed the transaction to execute this function).auth_idAuthorization ID of ticker transfer authorization.
§Errors
AuthorizationError::BadTypeifauth_idis not a valid ticket transfer authorization.
sourcepub fn accept_asset_ownership_transfer(
&self,
auth_id: u64
) -> Result<WrappedCall>
pub fn accept_asset_ownership_transfer( &self, auth_id: u64 ) -> Result<WrappedCall>
This function is used to accept a token ownership transfer. NB: To reject the transfer, call remove auth function in identity module.
§Arguments
originIt contains the secondary key of the caller (i.e. who signed the transaction to execute this function).auth_idAuthorization ID of the token ownership transfer authorization.
sourcepub fn create_asset(
&self,
name: AssetName,
ticker: Ticker,
divisible: bool,
asset_type: AssetType,
identifiers: Vec<AssetIdentifier>,
funding_round: Option<FundingRoundName>
) -> Result<WrappedCall>
pub fn create_asset( &self, name: AssetName, ticker: Ticker, divisible: bool, asset_type: AssetType, identifiers: Vec<AssetIdentifier>, funding_round: Option<FundingRoundName> ) -> Result<WrappedCall>
Initializes a new security token, with the initiating account as its owner.
The total supply will initially be zero. To mint tokens, use issue.
§Arguments
origin- contains the secondary key of the caller (i.e. who signed the transaction to execute this function).name- the name of the token.ticker- the ticker symbol of the token.divisible- a boolean to identify the divisibility status of the token.asset_type- the asset type.identifiers- a vector of asset identifiers.funding_round- name of the funding round.
§Errors
InvalidAssetIdentifierif any ofidentifiersare invalid.MaxLengthOfAssetNameExceededifname’s length exceedsT::AssetNameMaxLength.FundingRoundNameMaxLengthExceededif the name of the funding round is longer thatT::FundingRoundNameMaxLength.AssetAlreadyCreatedif asset was already created.TickerTooLongifticker’s length is greater thanconfig.max_ticker_lengthchain parameter.TickerNotAlphanumericiftickeris not yet registered, and contains non-alphanumeric characters or any character after first occurrence of\0.
§Permissions
- Portfolio
sourcepub fn freeze(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn freeze(&self, ticker: Ticker) -> Result<WrappedCall>
sourcepub fn unfreeze(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn unfreeze(&self, ticker: Ticker) -> Result<WrappedCall>
sourcepub fn rename_asset(
&self,
ticker: Ticker,
name: AssetName
) -> Result<WrappedCall>
pub fn rename_asset( &self, ticker: Ticker, name: AssetName ) -> Result<WrappedCall>
sourcepub fn issue(
&self,
ticker: Ticker,
amount: u128,
portfolio_kind: PortfolioKind
) -> Result<WrappedCall>
pub fn issue( &self, ticker: Ticker, amount: u128, portfolio_kind: PortfolioKind ) -> Result<WrappedCall>
Issue, or mint, new tokens to the caller, which must be an authorized external agent.
§Arguments
origin- A signer that has permissions to act as an agent ofticker.ticker- The [Ticker] of the token.amount- The amount of tokens that will be issued.portfolio_kind- The [PortfolioKind] of the portfolio that will receive the minted tokens.
§Permissions
- Asset
- Portfolio
sourcepub fn redeem(&self, ticker: Ticker, value: u128) -> Result<WrappedCall>
pub fn redeem(&self, ticker: Ticker, value: u128) -> Result<WrappedCall>
Redeems existing tokens by reducing the balance of the caller’s default portfolio and the total supply of the token
§Arguments
originis a signer that has permissions to act as an agent ofticker.tickerTicker of the token.valueAmount of tokens to redeem.
§Errors
UnauthorizedIf called by someone without the appropriate external agent permissionsInvalidGranularityIf the amount is not divisible by 10^6 for non-divisible tokensInsufficientPortfolioBalanceIf the caller’s default portfolio doesn’t have enough free balance
§Permissions
- Asset
- Portfolio
sourcepub fn make_divisible(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn make_divisible(&self, ticker: Ticker) -> Result<WrappedCall>
sourcepub fn add_documents(
&self,
docs: Vec<Document>,
ticker: Ticker
) -> Result<WrappedCall>
pub fn add_documents( &self, docs: Vec<Document>, ticker: Ticker ) -> Result<WrappedCall>
sourcepub fn remove_documents(
&self,
ids: Vec<DocumentId>,
ticker: Ticker
) -> Result<WrappedCall>
pub fn remove_documents( &self, ids: Vec<DocumentId>, ticker: Ticker ) -> Result<WrappedCall>
sourcepub fn set_funding_round(
&self,
ticker: Ticker,
name: FundingRoundName
) -> Result<WrappedCall>
pub fn set_funding_round( &self, ticker: Ticker, name: FundingRoundName ) -> Result<WrappedCall>
Sets the name of the current funding round.
§Arguments
origin- a signer that has permissions to act as an agent ofticker.ticker- the ticker of the token.name- the desired name of the current funding round.
§Errors
FundingRoundNameMaxLengthExceededif length ofnameis greater thanT::FundingRoundNameMaxLength.
§Permissions
- Asset
sourcepub fn update_identifiers(
&self,
ticker: Ticker,
asset_identifiers: Vec<AssetIdentifier>
) -> Result<WrappedCall>
pub fn update_identifiers( &self, ticker: Ticker, asset_identifiers: Vec<AssetIdentifier> ) -> Result<WrappedCall>
Updates the asset identifiers.
§Arguments
origin- a signer that has permissions to act as an agent ofticker.ticker- the ticker of the token.asset_identifiers- the asset identifiers to be updated in the form of a vector of pairs ofIdentifierTypeandAssetIdentifiervalue.
§Errors
InvalidAssetIdentifierifidentifierscontains any invalid identifier.
§Permissions
- Asset
sourcepub fn controller_transfer(
&self,
ticker: Ticker,
value: u128,
from_portfolio: PortfolioId
) -> Result<WrappedCall>
pub fn controller_transfer( &self, ticker: Ticker, value: u128, from_portfolio: PortfolioId ) -> Result<WrappedCall>
Forces a transfer of token from from_portfolio to the caller’s default portfolio.
§Arguments
originMust be an external agent with appropriate permissions for a given ticker.tickerTicker symbol of the asset.valueAmount of tokens need to force transfer.from_portfolioFrom whom portfolio tokens gets transferred.
sourcepub fn register_custom_asset_type(&self, ty: Vec<u8>) -> Result<WrappedCall>
pub fn register_custom_asset_type(&self, ty: Vec<u8>) -> Result<WrappedCall>
Registers a custom asset type.
The provided ty will be bound to an ID in storage.
The ID can then be used in AssetType::Custom.
Should the ty already exist in storage, no second ID is assigned to it.
§Arguments
originwho called the extrinsic.tycontains the string representation of the asset type.
sourcepub fn create_asset_with_custom_type(
&self,
name: AssetName,
ticker: Ticker,
divisible: bool,
custom_asset_type: Vec<u8>,
identifiers: Vec<AssetIdentifier>,
funding_round: Option<FundingRoundName>
) -> Result<WrappedCall>
pub fn create_asset_with_custom_type( &self, name: AssetName, ticker: Ticker, divisible: bool, custom_asset_type: Vec<u8>, identifiers: Vec<AssetIdentifier>, funding_round: Option<FundingRoundName> ) -> Result<WrappedCall>
Utility extrinsic to batch create_asset and register_custom_asset_type.
sourcepub fn set_asset_metadata(
&self,
ticker: Ticker,
key: AssetMetadataKey,
value: AssetMetadataValue,
detail: Option<AssetMetadataValueDetail<u64>>
) -> Result<WrappedCall>
pub fn set_asset_metadata( &self, ticker: Ticker, key: AssetMetadataKey, value: AssetMetadataValue, detail: Option<AssetMetadataValueDetail<u64>> ) -> Result<WrappedCall>
Set asset metadata value.
§Arguments
originis a signer that has permissions to act as an agent ofticker.tickerTicker of the token.keyMetadata key.valueMetadata value.detailsOptional Metadata value details (expire, lock status).
§Errors
AssetMetadataKeyIsMissingif the metadata type key doesn’t exist.AssetMetadataValueIsLockedif the metadata value forkeyis locked.AssetMetadataValueMaxLengthExceededif the metadata value exceeds the maximum length.
§Permissions
- Agent
- Asset
sourcepub fn set_asset_metadata_details(
&self,
ticker: Ticker,
key: AssetMetadataKey,
detail: AssetMetadataValueDetail<u64>
) -> Result<WrappedCall>
pub fn set_asset_metadata_details( &self, ticker: Ticker, key: AssetMetadataKey, detail: AssetMetadataValueDetail<u64> ) -> Result<WrappedCall>
Set asset metadata value details (expire, lock status).
§Arguments
originis a signer that has permissions to act as an agent ofticker.tickerTicker of the token.keyMetadata key.detailsMetadata value details (expire, lock status).
§Errors
AssetMetadataKeyIsMissingif the metadata type key doesn’t exist.AssetMetadataValueIsLockedif the metadata value forkeyis locked.
§Permissions
- Agent
- Asset
sourcepub fn register_and_set_local_asset_metadata(
&self,
ticker: Ticker,
name: AssetMetadataName,
spec: AssetMetadataSpec,
value: AssetMetadataValue,
detail: Option<AssetMetadataValueDetail<u64>>
) -> Result<WrappedCall>
pub fn register_and_set_local_asset_metadata( &self, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, value: AssetMetadataValue, detail: Option<AssetMetadataValueDetail<u64>> ) -> Result<WrappedCall>
Registers and set local asset metadata.
§Arguments
originis a signer that has permissions to act as an agent ofticker.tickerTicker of the token.nameMetadata name.specMetadata type definition.valueMetadata value.detailsOptional Metadata value details (expire, lock status).
§Errors
AssetMetadataLocalKeyAlreadyExistsif a local metadata type withnamealready exists forticker.AssetMetadataNameMaxLengthExceededif the metadatanameexceeds the maximum length.AssetMetadataTypeDefMaxLengthExceededif the metadataspectype definition exceeds the maximum length.AssetMetadataValueMaxLengthExceededif the metadata value exceeds the maximum length.
§Permissions
- Agent
- Asset
sourcepub fn register_asset_metadata_local_type(
&self,
ticker: Ticker,
name: AssetMetadataName,
spec: AssetMetadataSpec
) -> Result<WrappedCall>
pub fn register_asset_metadata_local_type( &self, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec ) -> Result<WrappedCall>
Registers asset metadata local type.
§Arguments
originis a signer that has permissions to act as an agent ofticker.tickerTicker of the token.nameMetadata name.specMetadata type definition.
§Errors
AssetMetadataLocalKeyAlreadyExistsif a local metadata type withnamealready exists forticker.AssetMetadataNameMaxLengthExceededif the metadatanameexceeds the maximum length.AssetMetadataTypeDefMaxLengthExceededif the metadataspectype definition exceeds the maximum length.
§Permissions
- Agent
- Asset
sourcepub fn register_asset_metadata_global_type(
&self,
name: AssetMetadataName,
spec: AssetMetadataSpec
) -> Result<WrappedCall>
pub fn register_asset_metadata_global_type( &self, name: AssetMetadataName, spec: AssetMetadataSpec ) -> Result<WrappedCall>
Registers asset metadata global type.
§Arguments
originis a signer that has permissions to act as an agent ofticker.nameMetadata name.specMetadata type definition.
§Errors
AssetMetadataGlobalKeyAlreadyExistsif a globa metadata type withnamealready exists.AssetMetadataNameMaxLengthExceededif the metadatanameexceeds the maximum length.AssetMetadataTypeDefMaxLengthExceededif the metadataspectype definition exceeds the maximum length.
sourcepub fn redeem_from_portfolio(
&self,
ticker: Ticker,
value: u128,
portfolio: PortfolioKind
) -> Result<WrappedCall>
pub fn redeem_from_portfolio( &self, ticker: Ticker, value: u128, portfolio: PortfolioKind ) -> Result<WrappedCall>
Redeems existing tokens by reducing the balance of the caller’s portfolio and the total supply of the token
§Arguments
originis a signer that has permissions to act as an agent ofticker.tickerTicker of the token.valueAmount of tokens to redeem.portfolioFrom whom portfolio tokens gets transferred.
§Errors
UnauthorizedIf called by someone without the appropriate external agent permissionsInvalidGranularityIf the amount is not divisible by 10^6 for non-divisible tokensInsufficientPortfolioBalanceIf the caller’sportfoliodoesn’t have enough free balancePortfolioDoesNotExistIf the portfolio doesn’t exist.
§Permissions
- Asset
- Portfolio
sourcepub fn update_asset_type(
&self,
ticker: Ticker,
asset_type: AssetType
) -> Result<WrappedCall>
pub fn update_asset_type( &self, ticker: Ticker, asset_type: AssetType ) -> Result<WrappedCall>
sourcepub fn remove_local_metadata_key(
&self,
ticker: Ticker,
local_key: AssetMetadataLocalKey
) -> Result<WrappedCall>
pub fn remove_local_metadata_key( &self, ticker: Ticker, local_key: AssetMetadataLocalKey ) -> Result<WrappedCall>
Removes the asset metadata key and value of a local key.
§Arguments
origin- the secondary key of the sender.ticker- the ticker of the local metadata key.local_key- the local metadata key.
§Errors
SecondaryKeyNotAuthorizedForAsset- if called by someone without the appropriate external agent permissions.UnauthorizedAgent- if called by someone without the appropriate external agent permissions.AssetMetadataKeyIsMissing- if the key doens’t exist.AssetMetadataValueIsLocked- if the value of the key is locked.- AssetMetadataKeyBelongsToNFTCollection - if the key is a mandatory key in an NFT collection.
§Permissions
- Asset
sourcepub fn remove_metadata_value(
&self,
ticker: Ticker,
metadata_key: AssetMetadataKey
) -> Result<WrappedCall>
pub fn remove_metadata_value( &self, ticker: Ticker, metadata_key: AssetMetadataKey ) -> Result<WrappedCall>
Removes the asset metadata value of a metadata key.
§Arguments
origin- the secondary key of the sender.ticker- the ticker of the local metadata key.metadata_key- the metadata key that will have its value deleted.
§Errors
SecondaryKeyNotAuthorizedForAsset- if called by someone without the appropriate external agent permissions.UnauthorizedAgent- if called by someone without the appropriate external agent permissions.AssetMetadataKeyIsMissing- if the key doens’t exist.AssetMetadataValueIsLocked- if the value of the key is locked.
§Permissions
- Asset
sourcepub fn exempt_ticker_affirmation(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn exempt_ticker_affirmation(&self, ticker: Ticker) -> Result<WrappedCall>
sourcepub fn remove_ticker_affirmation_exemption(
&self,
ticker: Ticker
) -> Result<WrappedCall>
pub fn remove_ticker_affirmation_exemption( &self, ticker: Ticker ) -> Result<WrappedCall>
sourcepub fn pre_approve_ticker(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn pre_approve_ticker(&self, ticker: Ticker) -> Result<WrappedCall>
sourcepub fn remove_ticker_pre_approval(&self, ticker: Ticker) -> Result<WrappedCall>
pub fn remove_ticker_pre_approval(&self, ticker: Ticker) -> Result<WrappedCall>
sourcepub fn add_mandatory_mediators(
&self,
ticker: Ticker,
mediators: BTreeSet<IdentityId>
) -> Result<WrappedCall>
pub fn add_mandatory_mediators( &self, ticker: Ticker, mediators: BTreeSet<IdentityId> ) -> Result<WrappedCall>
Sets all identities in the mediators set as mandatory mediators for any instruction transfering ticker.
§Arguments
origin: The secondary key of the sender.ticker: The [Ticker] of the asset that will require the mediators.mediators: A set of [IdentityId] of all the mandatory mediators for the given ticker.
§Permissions
- Asset
sourcepub fn remove_mandatory_mediators(
&self,
ticker: Ticker,
mediators: BTreeSet<IdentityId>
) -> Result<WrappedCall>
pub fn remove_mandatory_mediators( &self, ticker: Ticker, mediators: BTreeSet<IdentityId> ) -> Result<WrappedCall>
Removes all identities in the mediators set from the mandatory mediators list for the given ticker.
§Arguments
origin: The secondary key of the sender.ticker: The [Ticker] of the asset that will have mediators removed.mediators: A set of [IdentityId] of all the mediators that will be removed from the mandatory mediators list.
§Permissions
- Asset
sourcepub fn create_asset_v2(
&self,
name: AssetName,
ticker: Option<Ticker>,
divisible: bool,
asset_type: AssetType,
identifiers: Vec<AssetIdentifier>,
funding_round: Option<FundingRoundName>
) -> Result<WrappedCall>
pub fn create_asset_v2( &self, name: AssetName, ticker: Option<Ticker>, divisible: bool, asset_type: AssetType, identifiers: Vec<AssetIdentifier>, funding_round: Option<FundingRoundName> ) -> Result<WrappedCall>
Initializes a new security token, with the initiating account as its owner.
The total supply will initially be zero. To mint tokens, use issue.
§Arguments
origin- contains the secondary key of the caller (i.e. who signed the transaction to execute this function).name- the name of the token.ticker- the ticker symbol of the token.divisible- a boolean to identify the divisibility status of the token.asset_type- the asset type.identifiers- a vector of asset identifiers.funding_round- name of the funding round.
§Errors
InvalidAssetIdentifierif any ofidentifiersare invalid.MaxLengthOfAssetNameExceededifname’s length exceedsT::AssetNameMaxLength.FundingRoundNameMaxLengthExceededif the name of the funding round is longer thatT::FundingRoundNameMaxLength.AssetAlreadyCreatedif asset was already created.TickerTooLongifticker’s length is greater thanconfig.max_ticker_lengthchain parameter.TickerNotAlphanumericiftickeris not yet registered, and contains non-alphanumeric characters or any character after first occurrence of\0.
§Permissions
- Portfolio
Trait Implementations§
source§impl<'api> Clone for AssetCallApi<'api>
impl<'api> Clone for AssetCallApi<'api>
source§fn clone(&self) -> AssetCallApi<'api>
fn clone(&self) -> AssetCallApi<'api>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'api> Freeze for AssetCallApi<'api>
impl<'api> !RefUnwindSafe for AssetCallApi<'api>
impl<'api> Send for AssetCallApi<'api>
impl<'api> Sync for AssetCallApi<'api>
impl<'api> Unpin for AssetCallApi<'api>
impl<'api> !UnwindSafe for AssetCallApi<'api>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.