1#![forbid(unsafe_code)]
36#![deny(clippy::all)]
37#![warn(clippy::pedantic)]
38#![warn(clippy::nursery)]
39#![allow(clippy::missing_errors_doc)]
40#![allow(clippy::missing_panics_doc)]
41
42pub mod simple_client;
43pub mod ata;
45pub mod dashboard;
46pub mod dashboard_types;
47pub mod error;
48pub mod event_query;
49pub mod events;
50pub mod keypair;
51pub mod pda;
52pub mod program_types;
53pub mod signature;
54pub mod transaction_builder;
55pub mod transaction_utils;
56pub mod utils;
57pub mod validation;
58
59pub use simple_client::SimpleTallyClient;
61pub use dashboard::DashboardClient;
63pub use dashboard_types::{
64 DashboardEvent, DashboardEventType, DashboardSubscription, EventStream, Overview,
65 PlanAnalytics, SubscriptionStatus,
66};
67pub use error::{Result, TallyError};
68pub use event_query::{EventQueryClient, EventQueryClientConfig, EventQueryConfig, ParsedEvent};
69pub use events::{
70 create_receipt, create_receipt_legacy, extract_memo_from_logs, parse_events_from_logs,
71 parse_events_with_context, Canceled, ParsedEventWithContext, PaymentFailed, ReceiptParams,
72 Renewed, StreamableEventData, Subscribed, TallyEvent, TallyReceipt,
73};
74pub use keypair::load_keypair;
75pub use program_types::*;
76pub use transaction_builder::{
77 accept_authority, admin_withdraw_fees, cancel_authority_transfer, cancel_subscription,
78 close_subscription, create_merchant, create_plan, init_config, pause, renew_subscription,
79 start_subscription, transfer_authority, unpause, update_config, update_merchant_tier,
80 update_plan_terms, AcceptAuthorityBuilder, AdminWithdrawFeesBuilder,
81 CancelAuthorityTransferBuilder, CancelSubscriptionBuilder, CloseSubscriptionBuilder,
82 CreateMerchantBuilder, CreatePlanBuilder, InitConfigBuilder, PauseBuilder,
83 RenewSubscriptionBuilder, StartSubscriptionBuilder, TransferAuthorityBuilder, UnpauseBuilder,
84 UpdateConfigBuilder, UpdateMerchantTierBuilder, UpdatePlanTermsBuilder,
85};
86pub use validation::*;
87
88pub use signature::{
90 extract_transaction_signature, is_valid_wallet_address, normalize_signature_format,
91 prepare_transaction_for_signing, transaction_signing, verify_signed_transaction,
92 verify_wallet_signature,
93};
94
95pub use transaction_utils::{
97 build_transaction, convert_anchor_pubkey, create_memo_instruction, get_user_usdc_ata,
98 map_tally_error_to_string, SubscribeTransactionParams,
99};
100
101pub use utils::{
103 calculate_next_renewal, format_duration, is_renewal_due, is_subscription_overdue,
104 is_valid_pubkey, micro_lamports_to_usdc, system_programs, usdc_to_micro_lamports,
105};
106
107pub use anchor_client::solana_account_decoder;
109pub use anchor_client::solana_client;
110pub use anchor_client::solana_sdk;
111pub use anchor_client::ClientError;
112pub use anchor_lang::{AnchorDeserialize, AnchorSerialize};
113pub use spl_associated_token_account;
114pub use spl_token;
115
116pub const DEFAULT_PROGRAM_ID: &str = "Fwrs8tRRtw8HwmQZFS3XRRVcKBQhe1nuZ5heB4FgySXV";
118
119#[must_use]
121pub fn program_id_string() -> String {
122 std::env::var("PROGRAM_ID").unwrap_or_else(|_| DEFAULT_PROGRAM_ID.to_string())
123}
124
125#[must_use]
130pub fn program_id() -> anchor_client::solana_sdk::pubkey::Pubkey {
131 program_id_string().parse().expect("Valid program ID")
132}