This document contains the help content for the scripts command-line program.
Command Overview:
scripts↴scripts new-wallet↴scripts create-spl↴scripts mint-spl↴scripts associated-token-balance↴scripts creation-date↴scripts nft-owner↴scripts list-nfts↴scripts pubsub↴scripts fetch-idl↴scripts transfer-sol↴scripts wrap-sol↴
A collection of Solana scripts.
Run a command with cargo run -- <COMMAND>. Options can also be set with environment variables (e.g. RPC_URL, SIGNER_KEYPAIR), see <COMMAND> --help for the names.
Usage: scripts <COMMAND>
new-wallet— Generate a new wallet and print the pubkey, Base58 private key, and JSON private keycreate-spl— Create a new SPL token mint accountmint-spl— Mint SPL tokens to the associated token account of a wallet (signer must be the mint authority)associated-token-balance— Print the balance of an associated token account, for a wallet and mintcreation-date— Print the creation timestamp of an accountnft-owner— Print the wallet address that owns an NFTlist-nfts— Print the mint pubkeys of every NFT in a walletpubsub— Listen to slotSubscribe eventsfetch-idl— Fetch the onchain Anchor IDL of a programtransfer-sol— Transfer SOL with a memo and priority feewrap-sol— Wrap SOL into the signer's WSOL associated token account
Generate a new wallet and print the pubkey, Base58 private key, and JSON private key
Usage: scripts new-wallet
Create a new SPL token mint account
Usage: scripts create-spl [OPTIONS] --rpc-url <RPC_URL> --signer-keypair <KEYPAIR> --mint-keypair <MINT_KEYPAIR>
-
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com -
--signer-keypair <KEYPAIR>— Base58 encoded keypair that signs and pays for the transaction -
--mint-keypair <MINT_KEYPAIR>— Base58 encoded keypair, representing the new mint account -
--decimals <DECIMALS>— Number of decimals for the new mintDefault value:
9
Mint SPL tokens to the associated token account of a wallet (signer must be the mint authority)
Usage: scripts mint-spl [OPTIONS] --rpc-url <RPC_URL> --signer-keypair <KEYPAIR> --mint-account-pubkey <MINT_ACCOUNT_PUBKEY> --receiver-pubkey <RECEIVER_PUBKEY>
-
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com -
--signer-keypair <KEYPAIR>— Base58 encoded keypair that signs and pays for the transaction -
--mint-account-pubkey <MINT_ACCOUNT_PUBKEY>— The pubkey address of the SPL Token mint account -
--receiver-pubkey <RECEIVER_PUBKEY>— The pubkey address of the wallet you want to fund with the tokens -
--amount <AMOUNT>— Amount to mint, in base unitsDefault value:
10000
Print the balance of an associated token account, for a wallet and mint
Usage: scripts associated-token-balance --rpc-url <RPC_URL> --wallet-pubkey <WALLET_PUBKEY> --mint-account-pubkey <MINT_ACCOUNT_PUBKEY>
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com--wallet-pubkey <WALLET_PUBKEY>— The pubkey address of the wallet that owns the tokens--mint-account-pubkey <MINT_ACCOUNT_PUBKEY>— The pubkey address of the SPL Token mint account
Print the creation timestamp of an account
Usage: scripts creation-date --rpc-url <RPC_URL> --account-pubkey <ACCOUNT_PUBKEY>
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com--account-pubkey <ACCOUNT_PUBKEY>— The pubkey address of the account you want to introspect
Print the wallet address that owns an NFT
Usage: scripts nft-owner --rpc-url <RPC_URL> --mint-account-pubkey <MINT_ACCOUNT_PUBKEY>
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com--mint-account-pubkey <MINT_ACCOUNT_PUBKEY>— The pubkey address of the SPL Token mint account
Print the mint pubkeys of every NFT in a wallet
Usage: scripts list-nfts --rpc-url <RPC_URL> --wallet-pubkey <WALLET_PUBKEY>
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com--wallet-pubkey <WALLET_PUBKEY>— The pubkey address of the wallet that owns the NFTs
Listen to slotSubscribe events
Usage: scripts pubsub [OPTIONS] --ws-url <WS_URL>
-
--ws-url <WS_URL>— Solana websocket endpoint, e.g. wss://api.mainnet-beta.solana.com -
--count <COUNT>— Number of slot updates to print before exitingDefault value:
5
Fetch the onchain Anchor IDL of a program
Usage: scripts fetch-idl --rpc-url <RPC_URL> --program-id <PROGRAM_ID>
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com--program-id <PROGRAM_ID>— The program address pubkey, e.g. whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc
Transfer SOL with a memo and priority fee
Usage: scripts transfer-sol [OPTIONS] --rpc-url <RPC_URL> --signer-keypair <KEYPAIR> --receiver-pubkey <RECEIVER_PUBKEY>
-
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com -
--signer-keypair <KEYPAIR>— Base58 encoded keypair that signs and pays for the transaction -
--receiver-pubkey <RECEIVER_PUBKEY>— The pubkey address of the wallet receiving the SOL -
--amount <AMOUNT>— Amount to send, in lamportsDefault value:
1000000 -
--memo <MEMO>— Memo attached to the transferDefault value:
hello solana
Wrap SOL into the signer's WSOL associated token account
Usage: scripts wrap-sol [OPTIONS] --rpc-url <RPC_URL> --signer-keypair <KEYPAIR>
-
--rpc-url <RPC_URL>— Solana RPC endpoint, e.g. https://api.mainnet-beta.solana.com -
--signer-keypair <KEYPAIR>— Base58 encoded keypair that signs and pays for the transaction -
--amount <AMOUNT>— Amount of SOL to wrap, in lamportsDefault value:
1000000000