#![forbid(unsafe_code)]
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![warn(clippy::nursery)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::missing_panics_doc)]
pub mod simple_client;
pub mod ata;
pub mod dashboard;
pub mod dashboard_types;
pub mod error;
pub mod event_query;
pub mod events;
pub mod keypair;
pub mod pda;
pub mod program_types;
pub mod signature;
pub mod transaction_builder;
pub mod transaction_utils;
pub mod utils;
pub mod validation;
pub use simple_client::SimpleTallyClient;
pub use dashboard::DashboardClient;
pub use dashboard_types::{
DashboardEvent, DashboardEventType, DashboardSubscription, EventStream, Overview,
PlanAnalytics, SubscriptionStatus,
};
pub use error::{Result, TallyError};
pub use event_query::{EventQueryClient, EventQueryClientConfig, EventQueryConfig, ParsedEvent};
pub use events::{
create_receipt, create_receipt_legacy, extract_memo_from_logs, parse_events_from_logs,
parse_events_with_context, Canceled, ParsedEventWithContext, PaymentFailed, ReceiptParams,
Renewed, StreamableEventData, Subscribed, TallyEvent, TallyReceipt,
};
pub use keypair::load_keypair;
pub use program_types::*;
pub use transaction_builder::{
accept_authority, admin_withdraw_fees, cancel_authority_transfer, cancel_subscription,
close_subscription, create_merchant, create_plan, init_config, pause, renew_subscription,
start_subscription, transfer_authority, unpause, update_config, update_merchant_tier,
update_plan_terms, AcceptAuthorityBuilder, AdminWithdrawFeesBuilder,
CancelAuthorityTransferBuilder, CancelSubscriptionBuilder, CloseSubscriptionBuilder,
CreateMerchantBuilder, CreatePlanBuilder, InitConfigBuilder, PauseBuilder,
RenewSubscriptionBuilder, StartSubscriptionBuilder, TransferAuthorityBuilder, UnpauseBuilder,
UpdateConfigBuilder, UpdateMerchantTierBuilder, UpdatePlanTermsBuilder,
};
pub use validation::*;
pub use signature::{
extract_transaction_signature, is_valid_wallet_address, normalize_signature_format,
prepare_transaction_for_signing, transaction_signing, verify_signed_transaction,
verify_wallet_signature,
};
pub use transaction_utils::{
build_transaction, convert_anchor_pubkey, create_memo_instruction, get_user_usdc_ata,
map_tally_error_to_string, SubscribeTransactionParams,
};
pub use utils::{
calculate_next_renewal, format_duration, is_renewal_due, is_subscription_overdue,
is_valid_pubkey, micro_lamports_to_usdc, system_programs, usdc_to_micro_lamports,
};
pub use anchor_client::solana_account_decoder;
pub use anchor_client::solana_client;
pub use anchor_client::solana_sdk;
pub use anchor_client::ClientError;
pub use anchor_lang::{AnchorDeserialize, AnchorSerialize};
pub use spl_associated_token_account;
pub use spl_token;
pub const DEFAULT_PROGRAM_ID: &str = "Fwrs8tRRtw8HwmQZFS3XRRVcKBQhe1nuZ5heB4FgySXV";
#[must_use]
pub fn program_id_string() -> String {
std::env::var("PROGRAM_ID").unwrap_or_else(|_| DEFAULT_PROGRAM_ID.to_string())
}
#[must_use]
pub fn program_id() -> anchor_client::solana_sdk::pubkey::Pubkey {
program_id_string().parse().expect("Valid program ID")
}