This is a command-line interface for interacting with a Swig wallet. It's intention is to be rudimentary and demonstrate how to do things over to be a usable client for anything.
First, navigate to this directory and install the dependencies:
bun installTo create a new Swig account:
bun createThis will create a new Swig account and log its address.
To list all Swig accounts for the current user:
bun listTo transfer SOL from your Swig wallet to another address, use the transfer command:
bun transfer <RECIPIENT_ADDRESS> <AMOUNT> <SWIG_ACCOUNT_ADDRESS><RECIPIENT_ADDRESS>: The Solana address of the recipient.<AMOUNT>: The amount of SOL to transfer.<SWIG_ACCOUNT_ADDRESS>: The specific Swig account to use.
To transfer SPL tokens from your Swig wallet to another address, use the transfer-spl command:
bun transfer-spl <RECIPIENT_ADDRESS> <MINT_ADDRESS> <AMOUNT> <SWIG_ACCOUNT_ADDRESS><RECIPIENT_ADDRESS>: The Solana address of the recipient.<MINT_ADDRESS>: The mint address of the SPL token.<AMOUNT>: The amount of tokens to transfer (in the smallest unit of the token).<SWIG_ACCOUNT_ADDRESS>: The specific Swig account to use.
To swap tokens using Jupiter, use the swap command:
bun swap <AMOUNT> <SWIG_ACCOUNT_ADDRESS> [FROM_TOKEN] [TO_TOKEN]<AMOUNT>: The amount of tokens to swap.<SWIG_ACCOUNT_ADDRESS>: The specific Swig account to use.[FROM_TOKEN]: The token to swap from (defaults tosol).[TO_TOKEN]: The token to swap to (defaults tousdc).
To close a Swig account and reclaim the rent, use the close command:
bun close <SWIG_ACCOUNT_ADDRESS><SWIG_ACCOUNT_ADDRESS>: The Swig account to close.
To close all Swig accounts for the current user:
bun close-allTo grant swap permissions to a Swig account:
bun give-permission swap <SWIG_ACCOUNT_ADDRESS><SWIG_ACCOUNT_ADDRESS>: The Swig account to grant permission to.