Documentation
¶
Index ¶
- Constants
- Variables
- type APIProvider
- type AdsRechargeResult
- type AdsTopupResult
- type AlreadySubscribedError
- type AnonymousNumberError
- type AuctionFilter
- type AuctionItem
- type Client
- func (c *Client) APIKey() string
- func (c *Client) APIProvider() APIProvider
- func (c *Client) Call(ctx context.Context, method string, data map[string]any, pageURL string) (map[string]any, error)
- func (c *Client) Close() error
- func (c *Client) GetLoginCode(ctx context.Context, number string) (*LoginCodeResult, error)
- func (c *Client) GetWallet(ctx context.Context) (*WalletInfo, error)
- func (c *Client) GiveawayPremium(ctx context.Context, channel string, winners int, months int, ...) (*PremiumGiveawayResult, error)
- func (c *Client) GiveawayStars(ctx context.Context, channel string, winners, amount int, ...) (*StarsGiveawayResult, error)
- func (c *Client) Logger() *slog.Logger
- func (c *Client) PurchasePremium(ctx context.Context, username string, months int, opts ...PurchaseOption) (*PremiumResult, error)
- func (c *Client) PurchaseStars(ctx context.Context, username string, amount int, opts ...PurchaseOption) (*StarsResult, error)
- func (c *Client) RechargeAds(ctx context.Context, account string, amount int) (*AdsRechargeResult, error)
- func (c *Client) SearchGifts(ctx context.Context, opts ...SearchOption) (*GiftsResult, error)
- func (c *Client) SearchNumbers(ctx context.Context, opts ...SearchOption) (*NumbersResult, error)
- func (c *Client) SearchUsernames(ctx context.Context, opts ...SearchOption) (*UsernamesResult, error)
- func (c *Client) Seed() string
- func (c *Client) TerminateSessions(ctx context.Context, number string) (*TerminateSessionsResult, error)
- func (c *Client) ToggleLoginCodes(ctx context.Context, number string, canReceive bool) error
- func (c *Client) TopupGram(ctx context.Context, username string, amount int, opts ...PurchaseOption) (*AdsTopupResult, error)
- func (c *Client) WalletVersion() WalletVersion
- type ConfigurationError
- func ErrInvalidGramAmount() *ConfigurationError
- func ErrInvalidMnemonic(count int) *ConfigurationError
- func ErrInvalidMonths() *ConfigurationError
- func ErrInvalidPaymentMethod(method PaymentMethod) *ConfigurationError
- func ErrInvalidStarsAmount() *ConfigurationError
- func ErrInvalidStarsPerWinner() *ConfigurationError
- func ErrInvalidUsername(username string) *ConfigurationError
- func ErrInvalidWinnersPremium() *ConfigurationError
- func ErrInvalidWinnersStars() *ConfigurationError
- func ErrMissingVars(keys ...string) *ConfigurationError
- func ErrUnsupportedProvider(provider string) *ConfigurationError
- func ErrUnsupportedVersion(version string) *ConfigurationError
- type CookieError
- func ErrBrowserReadFailed(browser string, exc error) *CookieError
- func ErrCookieExpired(expires string) *CookieError
- func ErrCookieMissingBrowserKeys(browser string, keys ...string) *CookieError
- func ErrCookieMissingKeys(keys ...string) *CookieError
- func ErrCookieReadFailed(exc error) *CookieError
- func ErrUnsupportedBrowser(browser string) *CookieError
- type CookieResult
- type FragmentAPIError
- type FragmentError
- type FragmentPageError
- type GiftsResult
- type GiveawayOption
- type LoginCodeResult
- type NumbersResult
- type OperationError
- type Option
- type ParseError
- type PaymentMethod
- type PremiumGiveawayResult
- type PremiumResult
- type PurchaseOption
- type SearchOption
- func WithAttr(attr map[string][]string) SearchOption
- func WithCollection(c string) SearchOption
- func WithFilter(f AuctionFilter) SearchOption
- func WithOffset(offset int) SearchOption
- func WithOffsetID(id string) SearchOption
- func WithQuery(q string) SearchOption
- func WithSort(s SortOrder) SearchOption
- func WithView(v string) SearchOption
- type SortOrder
- type StarsGiveawayResult
- type StarsResult
- type SupportedBrowser
- type TerminateSessionsResult
- type TransactionError
- type UnexpectedError
- type UserNotFoundError
- type UsernamesResult
- type VerificationError
- type WalletError
- func ErrAccountInfoFailed(exc error) *WalletError
- func ErrGramBalanceCheckFailed(exc error) *WalletError
- func ErrLowGramBalance(balance, required float64) *WalletError
- func ErrLowUSDTBalance(balance, required float64) *WalletError
- func ErrUSDTBalanceCheckFailed(exc error) *WalletError
- func ErrWalletInfoFailed(exc error) *WalletError
- type WalletInfo
- type WalletVersion
Constants ¶
View Source
const ( FragmentDomain = "fragment.com" FragmentBaseURL = "https://" + FragmentDomain StarsPage = FragmentBaseURL + "/stars/buy" StarsGiveawayPage = FragmentBaseURL + "/stars/giveaway" PremiumPage = FragmentBaseURL + "/premium/gift" PremiumGiveawayPage = FragmentBaseURL + "/premium/giveaway" AdsTopupPage = FragmentBaseURL + "/ads/topup" NumbersPage = FragmentBaseURL + "/numbers" GiftsPage = FragmentBaseURL + "/gifts" DefaultTimeout = 30 * time.Second )
View Source
const ( StarsPurchaseMin = 50 StarsPurchaseMax = 10_000_000 StarsGiveawayMin = 500 StarsGiveawayMax = 1_000_000 StarsWinnersMin = 1 StarsWinnersMax = 15 PremiumWinnersMin = 1 PremiumWinnersMax = 24_000 GramTopupMin = 1 GramTopupMax = 1_000_000_000 MinGramBalance = 0.33 MinUSDTBalance = 0.75 )
View Source
const USDTGramMasterAddress = "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
Variables ¶
View Source
var BaseHeaders = map[string]string{ "accept": "application/json, text/javascript, */*; q=0.01", "accept-language": "en-US,en;q=0.9,uk;q=0.8,ru;q=0.7", "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "origin": FragmentBaseURL, "priority": "u=1, i", "sec-ch-ua": `"Google Chrome";v="147", "Not.A/Brand";v="8", "Chromium";v="147"`, "sec-ch-ua-mobile": "?1", "sec-ch-ua-platform": `"Android"`, "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36", "x-requested-with": "XMLHttpRequest", }
View Source
var MnemonicWordCountsValid = map[int]struct{}{12: {}, 24: {}}
View Source
var PremiumMonthsValid = map[int]struct{}{3: {}, 6: {}, 12: {}}
View Source
var RequiredCookieKeys = [4]string{"stel_ssid", "stel_dt", "stel_token", "stel_ton_token"}
Functions ¶
This section is empty.
Types ¶
type APIProvider ¶
type APIProvider string
const ( ProviderLiteclient APIProvider = "liteclient" ProviderTonapi APIProvider = "tonapi" ProviderToncenter APIProvider = "toncenter" )
func ValidAPIProviders ¶
func ValidAPIProviders() []APIProvider
func (APIProvider) Valid ¶
func (p APIProvider) Valid() bool
type AdsRechargeResult ¶
func (*AdsRechargeResult) String ¶
func (r *AdsRechargeResult) String() string
type AdsTopupResult ¶
func (*AdsTopupResult) String ¶
func (r *AdsTopupResult) String() string
type AlreadySubscribedError ¶
type AlreadySubscribedError struct{ FragmentAPIError }
func ErrPremiumActive ¶
func ErrPremiumActive() *AlreadySubscribedError
type AnonymousNumberError ¶
type AnonymousNumberError struct{ FragmentAPIError }
func ErrNumberNotOwned ¶
func ErrNumberNotOwned(number string) *AnonymousNumberError
func ErrTerminateFailed ¶
func ErrTerminateFailed(number string, exc error) *AnonymousNumberError
type AuctionFilter ¶
type AuctionFilter string
const ( FilterAuction AuctionFilter = "auction" FilterSale AuctionFilter = "sale" FilterSold AuctionFilter = "sold" FilterAvailable AuctionFilter = "" )
type AuctionItem ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) APIProvider ¶
func (c *Client) APIProvider() APIProvider
func (*Client) GetLoginCode ¶
func (*Client) GiveawayPremium ¶
func (c *Client) GiveawayPremium(ctx context.Context, channel string, winners int, months int, opts ...GiveawayOption) (*PremiumGiveawayResult, error)
func (*Client) GiveawayStars ¶
func (c *Client) GiveawayStars(ctx context.Context, channel string, winners, amount int, opts ...GiveawayOption) (*StarsGiveawayResult, error)
func (*Client) PurchasePremium ¶
func (c *Client) PurchasePremium(ctx context.Context, username string, months int, opts ...PurchaseOption) (*PremiumResult, error)
func (*Client) PurchaseStars ¶
func (c *Client) PurchaseStars(ctx context.Context, username string, amount int, opts ...PurchaseOption) (*StarsResult, error)
func (*Client) RechargeAds ¶
func (*Client) SearchGifts ¶
func (c *Client) SearchGifts(ctx context.Context, opts ...SearchOption) (*GiftsResult, error)
func (*Client) SearchNumbers ¶
func (c *Client) SearchNumbers(ctx context.Context, opts ...SearchOption) (*NumbersResult, error)
func (*Client) SearchUsernames ¶
func (c *Client) SearchUsernames(ctx context.Context, opts ...SearchOption) (*UsernamesResult, error)
func (*Client) TerminateSessions ¶
func (*Client) ToggleLoginCodes ¶
func (*Client) TopupGram ¶
func (c *Client) TopupGram(ctx context.Context, username string, amount int, opts ...PurchaseOption) (*AdsTopupResult, error)
func (*Client) WalletVersion ¶
func (c *Client) WalletVersion() WalletVersion
type ConfigurationError ¶
type ConfigurationError struct{ FragmentError }
func ErrInvalidGramAmount ¶
func ErrInvalidGramAmount() *ConfigurationError
func ErrInvalidMnemonic ¶
func ErrInvalidMnemonic(count int) *ConfigurationError
func ErrInvalidMonths ¶
func ErrInvalidMonths() *ConfigurationError
func ErrInvalidPaymentMethod ¶
func ErrInvalidPaymentMethod(method PaymentMethod) *ConfigurationError
func ErrInvalidStarsAmount ¶
func ErrInvalidStarsAmount() *ConfigurationError
func ErrInvalidStarsPerWinner ¶
func ErrInvalidStarsPerWinner() *ConfigurationError
func ErrInvalidUsername ¶
func ErrInvalidUsername(username string) *ConfigurationError
func ErrInvalidWinnersPremium ¶
func ErrInvalidWinnersPremium() *ConfigurationError
func ErrInvalidWinnersStars ¶
func ErrInvalidWinnersStars() *ConfigurationError
func ErrMissingVars ¶
func ErrMissingVars(keys ...string) *ConfigurationError
func ErrUnsupportedProvider ¶
func ErrUnsupportedProvider(provider string) *ConfigurationError
func ErrUnsupportedVersion ¶
func ErrUnsupportedVersion(version string) *ConfigurationError
type CookieError ¶
type CookieError struct{ FragmentError }
func ErrBrowserReadFailed ¶
func ErrBrowserReadFailed(browser string, exc error) *CookieError
func ErrCookieExpired ¶
func ErrCookieExpired(expires string) *CookieError
func ErrCookieMissingBrowserKeys ¶
func ErrCookieMissingBrowserKeys(browser string, keys ...string) *CookieError
func ErrCookieMissingKeys ¶
func ErrCookieMissingKeys(keys ...string) *CookieError
func ErrCookieReadFailed ¶
func ErrCookieReadFailed(exc error) *CookieError
func ErrUnsupportedBrowser ¶
func ErrUnsupportedBrowser(browser string) *CookieError
type CookieResult ¶
func GetCookiesFromBrowser ¶
func GetCookiesFromBrowser(browser string) (*CookieResult, error)
func (*CookieResult) String ¶
func (r *CookieResult) String() string
type FragmentAPIError ¶
type FragmentAPIError struct{ FragmentError }
func ErrNoRequestID ¶
func ErrNoRequestID(context string) *FragmentAPIError
type FragmentError ¶
func (*FragmentError) Error ¶
func (e *FragmentError) Error() string
func (*FragmentError) Unwrap ¶
func (e *FragmentError) Unwrap() error
type FragmentPageError ¶
type FragmentPageError struct{ FragmentAPIError }
func ErrBadStatus ¶
func ErrBadStatus(status int, url string) *FragmentPageError
func ErrHashNotFound ¶
func ErrHashNotFound(url string) *FragmentPageError
type GiftsResult ¶
type GiftsResult struct {
Items []AuctionItem
NextOffset int
HasNext bool
}
func (*GiftsResult) String ¶
func (r *GiftsResult) String() string
type GiveawayOption ¶
type GiveawayOption func(*giveawayOpts)
func WithGiveawayPaymentMethod ¶
func WithGiveawayPaymentMethod(m PaymentMethod) GiveawayOption
type LoginCodeResult ¶
func (*LoginCodeResult) String ¶
func (r *LoginCodeResult) String() string
type NumbersResult ¶
type NumbersResult struct {
Items []AuctionItem
NextOffsetID string
}
func (*NumbersResult) String ¶
func (r *NumbersResult) String() string
type OperationError ¶
type OperationError struct{ FragmentError }
type Option ¶
type Option func(*Client)
func WithAPIProvider ¶
func WithAPIProvider(p APIProvider) Option
func WithDefaultHeaders ¶
func WithDefaultHeaders() Option
func WithHeaders ¶
func WithTimeout ¶
func WithWalletVersion ¶
func WithWalletVersion(v WalletVersion) Option
type ParseError ¶
type ParseError struct{ FragmentAPIError }
func ErrUnparseable ¶
func ErrUnparseable(context string, exc error) *ParseError
type PaymentMethod ¶
type PaymentMethod string
const ( PayGRAM PaymentMethod = "ton" PayUSDTGram PaymentMethod = "usdt_ton" PayUSDTEth PaymentMethod = "usdt_eth" PayUSDTPol PaymentMethod = "usdt_pol" PayUSDCEth PaymentMethod = "usdc_eth" PayUSDCBase PaymentMethod = "usdc_base" PayUSDCPol PaymentMethod = "usdc_pol" )
func ValidPaymentMethods ¶
func ValidPaymentMethods() []PaymentMethod
func (PaymentMethod) Valid ¶
func (m PaymentMethod) Valid() bool
type PremiumGiveawayResult ¶
func (*PremiumGiveawayResult) String ¶
func (r *PremiumGiveawayResult) String() string
type PremiumResult ¶
func (*PremiumResult) String ¶
func (r *PremiumResult) String() string
type PurchaseOption ¶
type PurchaseOption func(*purchaseOpts)
func WithPaymentMethod ¶
func WithPaymentMethod(m PaymentMethod) PurchaseOption
func WithShowSender ¶
func WithShowSender(show bool) PurchaseOption
type SearchOption ¶
type SearchOption func(*searchOpts)
func WithAttr ¶
func WithAttr(attr map[string][]string) SearchOption
func WithCollection ¶
func WithCollection(c string) SearchOption
func WithFilter ¶
func WithFilter(f AuctionFilter) SearchOption
func WithOffset ¶
func WithOffset(offset int) SearchOption
func WithOffsetID ¶
func WithOffsetID(id string) SearchOption
func WithQuery ¶
func WithQuery(q string) SearchOption
func WithSort ¶
func WithSort(s SortOrder) SearchOption
func WithView ¶
func WithView(v string) SearchOption
type StarsGiveawayResult ¶
func (*StarsGiveawayResult) String ¶
func (r *StarsGiveawayResult) String() string
type StarsResult ¶
func (*StarsResult) String ¶
func (r *StarsResult) String() string
type SupportedBrowser ¶
type SupportedBrowser string
const ( BrowserChrome SupportedBrowser = "chrome" BrowserFirefox SupportedBrowser = "firefox" BrowserEdge SupportedBrowser = "edge" BrowserBrave SupportedBrowser = "brave" )
type TerminateSessionsResult ¶
func (*TerminateSessionsResult) String ¶
func (r *TerminateSessionsResult) String() string
type TransactionError ¶
type TransactionError struct{ FragmentAPIError }
func ErrBroadcastFailed ¶
func ErrBroadcastFailed(exc error) *TransactionError
func ErrBroadcastFailedSSL ¶
func ErrBroadcastFailedSSL(exc error) *TransactionError
func ErrDuplicateSeqno ¶
func ErrDuplicateSeqno() *TransactionError
func ErrInvalidPayload ¶
func ErrInvalidPayload() *TransactionError
type UnexpectedError ¶
type UnexpectedError struct{ OperationError }
func ErrUnexpected ¶
func ErrUnexpected(exc error) *UnexpectedError
type UserNotFoundError ¶
type UserNotFoundError struct{ FragmentAPIError }
func ErrNotAUser ¶
func ErrNotAUser(username string) *UserNotFoundError
func ErrUserNotFound ¶
func ErrUserNotFound(username string) *UserNotFoundError
type UsernamesResult ¶
type UsernamesResult struct {
Items []AuctionItem
NextOffsetID string
}
func (*UsernamesResult) String ¶
func (r *UsernamesResult) String() string
type VerificationError ¶
type VerificationError struct{ FragmentAPIError }
func ErrKYCRequired ¶
func ErrKYCRequired() *VerificationError
type WalletError ¶
type WalletError struct{ OperationError }
func ErrAccountInfoFailed ¶
func ErrAccountInfoFailed(exc error) *WalletError
func ErrGramBalanceCheckFailed ¶
func ErrGramBalanceCheckFailed(exc error) *WalletError
func ErrLowGramBalance ¶
func ErrLowGramBalance(balance, required float64) *WalletError
func ErrLowUSDTBalance ¶
func ErrLowUSDTBalance(balance, required float64) *WalletError
func ErrUSDTBalanceCheckFailed ¶
func ErrUSDTBalanceCheckFailed(exc error) *WalletError
func ErrWalletInfoFailed ¶
func ErrWalletInfoFailed(exc error) *WalletError
type WalletInfo ¶
func (*WalletInfo) String ¶
func (w *WalletInfo) String() string
type WalletVersion ¶
type WalletVersion string
const ( WalletV4R2 WalletVersion = "V4R2" WalletV5R1 WalletVersion = "V5R1" WalletHighloadV2 WalletVersion = "HighloadV2" WalletHighloadV3R1 WalletVersion = "HighloadV3R1" )
func ValidWalletVersions ¶
func ValidWalletVersions() []WalletVersion
func (WalletVersion) Valid ¶
func (v WalletVersion) Valid() bool
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
get_cookies
command
|
|
|
get_login_code
command
|
|
|
giveaway_premium
command
|
|
|
giveaway_stars
command
|
|
|
purchase_premium
command
|
|
|
purchase_stars
command
|
|
|
raw_api_call
command
|
|
|
recharge_ads
command
|
|
|
search_gifts
command
|
|
|
search_numbers
command
|
|
|
search_usernames
command
|
|
|
terminate_sessions
command
|
|
|
toggle_login_codes
command
|
|
|
topup_gram
command
|
|
|
wallet_info
command
|
Click to show internal directories.
Click to hide internal directories.