Learn what token extensions are, and how to create tokens that use their features.
non-transferable token
extension in the new Token Extension Program. Which
is a core Nexis Native Chain program, adopted by everyone.
This is why the Token Extension Program was created, to vastly improve the
functionality and customization of the most wanted and requested features from
the original Token Program. And it does so by 100% supporting all of the
functions developers are used to in the original and leaves room for future
improvements. Though it is a second program, two programs are much easier to
adopt than dozens.
This being said, the Token Extensions Program, is deployed to a separate
address. Even if the interfaces of these two programs are same, the addresses of
these programs are not interchangeable in any case. Meaning a token created
with the Token Program, cannot interact with the Token Extension Program. As a
result, if we want to add support for Token Extensions program, our client
application will need some extra logic to differentiate between the tokens owned
by these two programs.
Last note - The Token Extension Program does not completely replace the Token
Program, if the use-case of a particular token is very simple, it may not need
extensions. In this case, the original Token Program would be ever-so-slightly
preferable to use since the program does not need to go through any of the
additional extension checks.
spl-token-cli
CLI.
spl-token-cli
. Follow
the instructions in this guide. After the
installation, verify it by running the following command:
create-token
: The instruction that we want to execute.--program-id
: This flag is used to specified which program ID to use.
TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
is the public address at which
the Token Extension Program is deployed.--enable-close
: This flag specifies that we want to initialize the mint
with close authority.display
command.
This command will show relent details for a token mint, account or multisig.
Let’s pass it mint address of the previous step.
<TOKEN_MINT_ADDRESS>
is the resulting address from the previous step.
immutable owner
extension. By default all ATAs enable the
immutable owner
extension. And all token accounts made with the CLI will be
ATAs, so immutable owner
will be enabled.
This extension requires following arguments:
create-account
: The instruction that we want to execute.--program-id
(optional): The program ID we want to use. This is optional
because the CLI will figure out the owning program of the mint.--owner
(optional): Public key of the owner’s wallet. It will default to the
current working public key which we can get by running the command
nexis address
.--fee-payer
(optional): Keypair of the wallet paying for the transaction. It
will default to the current working keypair, which can be found with
nexis config get
.<TOKEN_MINT_ADDRESS>
: this is the mint account we got from the
create-token
command.mint
function. Here are the
arguments we have to provide:
mint
: The instruction<TOKEN_MINT_ADDRESS>
: The address of the mint we got from the first step<TOKEN_AMOUNT>
: Amount to mint in tokens<RECIPIENT_TOKEN_ACCOUNT_ADDRESS>
(optional): This is the token account used
to hold the tokens we created in the previous step. However, this defaults to
the ATA of our current working keypair and mint. So this will automatically
use the account from our last step.spl-token display
command to get some info about the mint
and token account.
create-token
: The instruction that we want to execute.--program-id
: The program ID we want to use.--decimals
: NFTs are usually whole, and have 0 decimals--enable-metadata
: The metadata extension flag. (This initializes the
metadata and metadata pointer extensions)--enable-non-transferable
: The non-transferable extension flag.<YOUR_TOKEN_NAME>
: Name of the token<YOUR_TOKEN_SYMBOL>
: Symbol by which the token will be identified.<YOUR_TOKEN_URI>
: URI for the token.--update-authority
(optional): The address of the account with the authority
to update the metadata. This will default to the current working public key.display
command.
--help
flag: