2 unstable releases

0.1.0 Apr 18, 2024
0.0.0 Feb 27, 2024

#5 in #nifty

Download history

109 downloads per month

Custom license

265KB
1K SLoC

Rust 1K SLoC // 0.0% comments Shell 142 SLoC // 0.1% comments

Nifty CLI

A CLI for interacting with the Nifty asset program.

Installation

Via install script:

bash <(curl -sSf https://raw.githubusercontent.com/nifty-oss/cli/main/scripts/install.sh)

From source:

cargo install --path .

Commands

Burn

Burns an asset, closing the account reclaiming all rent.

Usage: nifty burn [OPTIONS] <ASSET> [RECIPIENT]

Arguments:
  <ASSET>      The asset to burn
  [RECIPIENT]  The recipient to receive reclaimed rent. Defaults to the signer

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Examples:

No recipient specified, so reclaimed rent goes to the signing keypair:

nifty burn 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

Recipient specified and receives reclaimed rent:

nifty burn 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP 9Z3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

Mint

Create an asset with extension data

Usage: nifty mint [OPTIONS] <ASSET_FILE_PATH>

Arguments:
  <ASSET_FILE_PATH>  

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Mint-Batch

Create a batch of assets with extension data

Usage: nifty mint-batch [OPTIONS] <ASSET_FILES_DIR>

Arguments:
  <ASSET_FILES_DIR>

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Create

Creates a new asset.

Usage: nifty create [OPTIONS] --name <NAME>

Options:
  -k, --keypair-path <KEYPAIR_PATH>
          Path to the keypair file
  -n, --name <NAME>
          The name of the asset
  -a, --asset-keypair-path <ASSET_KEYPAIR_PATH>
          Path to the mint keypair file
  -r, --rpc-url <RPC_URL>
          RPC URL for the Solana cluster
      --immutable
          Create the asset as immutable
  -o, --owner <OWNER>
          Owner of the created asset, defaults to authority pubkey
  -h, --help
          Print help

Examples:

Create a mutable asset:

nifty create --name "My Asset"

Create an immutable asset:

nifty create --name "My Immutable Asset" --immutable

Create an asset with a specific owner:

nifty create --name "My Asset" --owner 9Z3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

Create an asset from an existing keypair file:

nifty create --name "My Asset" --asset-keypair-path /path/to/asset-keypair.json

Decode

Decodes an asset into a human readable format.

Usage: nifty decode [OPTIONS] <ASSET>

Arguments:
  <ASSET>

Options:
  -f, --field <FIELD>                The field to decode. If not specified, the entire asset will be decoded
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Example:

nifty decode 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

Decode a specific field:

nifty decode 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP --field state

prints only the state information of the asset.

Approve

Set a delegate on an asset with specific roles

Usage: nifty approve [OPTIONS] <ASSET> <DELEGATE>

Arguments:
  <ASSET>     The asset to delegate
  <DELEGATE>  The address to delegate to

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -R, --role <ROLE>                  The role for the delegate to have: "burn", "lock", "transfer". Specify each one separately: --role burn --role lock --role transfer
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Example:

```bash
nifty approve 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP 9Z3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP --role burn --role lock

Revoke

Revoke a delegate from an asset

Revoke a delegate from an asset

Usage: nifty revoke [OPTIONS] <ASSET>

Arguments:
  <ASSET>  The asset to revoke the delegate from

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -R, --role <ROLE>                  The roles to revoke: "burn", "lock", "transfer". Specify each one separately: --role burn --role lock --role transfer
      --all                          Revoke all roles from the delegate and clear it
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Lock

Lock an asset, preventing any actions to be performed on it.

Usage: nifty lock [OPTIONS] <ASSET> [DELEGATE_KEYPAIR_PATH]

Arguments:
  <ASSET>                  The asset to lock
  [DELEGATE_KEYPAIR_PATH]  Path to the delegate keypair file. Defaults to the signer

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Example:

nifty lock 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

The keypair used must be the delegate of the asset.

Unlock

Unlock an asset, allowing actions to be performed on it.

Usage: nifty unlock [OPTIONS] <ASSET> [DELEGATE_KEYPAIR_PATH]

Arguments:
  <ASSET>                  The asset to unlock
  [DELEGATE_KEYPAIR_PATH]  Path to the delegate keypair file. Defaults to the signer

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Example:

nifty unlock 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

The keypair used must be the delegate of the asset.

Transfer

Transfers an asset to a new owner.

Usage: nifty transfer [OPTIONS] <ASSET> <RECIPIENT>

Arguments:
  <ASSET>      The asset to transfer
  <RECIPIENT>  The recipient of the asset

Options:
  -k, --keypair-path <KEYPAIR_PATH>  Path to the keypair file
  -r, --rpc-url <RPC_URL>            RPC URL for the Solana cluster
  -h, --help                         Print help

Example:

nifty transfer 92D3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP 9Z3tDoqtREj3Exkr5ws9UPawG3yhaEwjSP4J5GumuRP

Dependencies

~80MB
~1.5M SLoC