Documentation
¶
Overview ¶
Package cli implements the command-line interface for the True Markets CLI.
Index ¶
Constants ¶
const ( BaseUSDC = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" SolanaUSDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" )
USDC addresses per chain.
const ( ExitSuccess = 0 ExitGeneral = 1 ExitUsage = 2 ExitAuth = 3 ExitAPI = 4 ExitNetwork = 5 )
Exit codes for the CLI.
Variables ¶
var ( Version = "dev" CommitSHA = "" )
Version and CommitSHA are set at build time via ldflags.
Functions ¶
func ContextAPIKey ¶
ContextAPIKey returns the resolved API key from the command context.
func ContextAuthToken ¶
ContextAuthToken returns the resolved auth token from the command context.
func ContextHost ¶
ContextHost returns the resolved API host from the command context.
func ContextOutputJSON ¶
ContextOutputJSON returns true if JSON output is requested.
Types ¶
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore manages per-user API key files under ~/.config/truemarkets/keys/.
func NewKeyStore ¶
func NewKeyStore() *KeyStore
NewKeyStore returns a KeyStore backed by ~/.config/truemarkets/keys/.
type TokenData ¶
type TokenData struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresAt time.Time `json:"expires_at"`
Email string `json:"email"`
}
TokenData represents stored token information.
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
TokenManager handles token storage and retrieval.
func NewTokenManager ¶
func NewTokenManager() *TokenManager
NewTokenManager creates a new token manager using ~/.config/truemarkets/credentials.json.
func (*TokenManager) ClearTokens ¶
func (tm *TokenManager) ClearTokens() error
ClearTokens removes stored tokens.
func (*TokenManager) GetValidAccessToken ¶
GetValidAccessToken returns a valid access token, refreshing if needed.
func (*TokenManager) LoadTokens ¶
func (tm *TokenManager) LoadTokens() (*TokenData, error)
LoadTokens loads tokens from local storage.
func (*TokenManager) StoreTokens ¶
func (tm *TokenManager) StoreTokens(tokens TokenData) error
StoreTokens saves tokens to local storage.