ton-provider-system 0.1.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +638 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +238 -19
- package/dist/index.d.ts +238 -19
- package/dist/index.js +629 -215
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1043,13 +1043,6 @@ declare class HealthChecker {
|
|
|
1043
1043
|
* Get endpoint URL for a provider (handles dynamic providers like Orbs)
|
|
1044
1044
|
*/
|
|
1045
1045
|
private getEndpoint;
|
|
1046
|
-
/**
|
|
1047
|
-
* Normalize endpoint for provider-specific requirements
|
|
1048
|
-
*
|
|
1049
|
-
* Note: normalizeV2Endpoint now handles all provider-specific cases correctly,
|
|
1050
|
-
* including Tatum (/jsonRPC), OnFinality (/public or /rpc), QuickNode, and GetBlock.
|
|
1051
|
-
*/
|
|
1052
|
-
private normalizeEndpointForProvider;
|
|
1053
1046
|
/**
|
|
1054
1047
|
* Call getMasterchainInfo API with provider-specific handling
|
|
1055
1048
|
*/
|
|
@@ -1630,20 +1623,16 @@ declare function createBrowserAdapterForNetwork(network: Network, configPath?: s
|
|
|
1630
1623
|
*
|
|
1631
1624
|
* URL normalization and manipulation for TON RPC endpoints.
|
|
1632
1625
|
*/
|
|
1626
|
+
|
|
1633
1627
|
/**
|
|
1634
|
-
* Normalize endpoint URL for TonClient v2 API.
|
|
1635
|
-
*
|
|
1628
|
+
* Normalize endpoint URL for TonClient v2 API using provider-specific implementation.
|
|
1629
|
+
* This is the preferred method when a ResolvedProvider is available.
|
|
1636
1630
|
*
|
|
1637
|
-
*
|
|
1638
|
-
* -
|
|
1639
|
-
*
|
|
1640
|
-
* - TON Access (orbs): Already returns correct JSON-RPC endpoint
|
|
1641
|
-
* - QuickNode: Needs /jsonRPC appended to base URL
|
|
1642
|
-
* - GetBlock: Needs /jsonRPC appended to base URL
|
|
1643
|
-
* - Tatum: Gateway URLs need /jsonRPC appended (gateway.tatum.io/jsonRPC)
|
|
1644
|
-
* - OnFinality: Uses /public or /rpc path with query params - preserve query params
|
|
1631
|
+
* @param endpoint - Endpoint URL to normalize
|
|
1632
|
+
* @param provider - Resolved provider configuration (optional)
|
|
1633
|
+
* @returns Normalized endpoint URL
|
|
1645
1634
|
*/
|
|
1646
|
-
declare function normalizeV2Endpoint(endpoint: string): string;
|
|
1635
|
+
declare function normalizeV2Endpoint(endpoint: string, provider?: ResolvedProvider): string;
|
|
1647
1636
|
/**
|
|
1648
1637
|
* Convert any endpoint to v2 base URL (without /jsonRPC suffix).
|
|
1649
1638
|
*/
|
|
@@ -1802,4 +1791,234 @@ declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
|
1802
1791
|
*/
|
|
1803
1792
|
declare function isRateLimitError(error: unknown): boolean;
|
|
1804
1793
|
|
|
1805
|
-
|
|
1794
|
+
/**
|
|
1795
|
+
* Unified Provider System - Base Provider
|
|
1796
|
+
*
|
|
1797
|
+
* Base class for provider-specific implementations.
|
|
1798
|
+
* All provider types extend this class to provide provider-specific behavior.
|
|
1799
|
+
*/
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Base provider class that all provider-specific implementations extend.
|
|
1803
|
+
* Provides common functionality and defines the interface for provider-specific behavior.
|
|
1804
|
+
*/
|
|
1805
|
+
declare abstract class BaseProvider {
|
|
1806
|
+
protected provider: ResolvedProvider;
|
|
1807
|
+
constructor(provider: ResolvedProvider);
|
|
1808
|
+
/**
|
|
1809
|
+
* Get the provider instance
|
|
1810
|
+
*/
|
|
1811
|
+
getProvider(): ResolvedProvider;
|
|
1812
|
+
/**
|
|
1813
|
+
* Normalize endpoint URL for this provider type.
|
|
1814
|
+
* Each provider may have different endpoint format requirements.
|
|
1815
|
+
*/
|
|
1816
|
+
abstract normalizeEndpoint(endpoint: string): string;
|
|
1817
|
+
/**
|
|
1818
|
+
* Build HTTP headers for requests to this provider.
|
|
1819
|
+
* Handles provider-specific authentication (API keys in headers, etc.)
|
|
1820
|
+
*/
|
|
1821
|
+
abstract buildHeaders(): Record<string, string>;
|
|
1822
|
+
/**
|
|
1823
|
+
* Build a JSON-RPC request body.
|
|
1824
|
+
* Most providers use standard JSON-RPC 2.0, but some may need modifications.
|
|
1825
|
+
*/
|
|
1826
|
+
buildRequest(method: string, params?: Record<string, unknown>): {
|
|
1827
|
+
id: string;
|
|
1828
|
+
jsonrpc: string;
|
|
1829
|
+
method: string;
|
|
1830
|
+
params: Record<string, unknown>;
|
|
1831
|
+
};
|
|
1832
|
+
/**
|
|
1833
|
+
* Parse response from provider.
|
|
1834
|
+
* Handles provider-specific response formats.
|
|
1835
|
+
*/
|
|
1836
|
+
parseResponse<T = unknown>(data: unknown): T;
|
|
1837
|
+
/**
|
|
1838
|
+
* Parse masterchain info from response.
|
|
1839
|
+
* Validates the response structure and extracts seqno.
|
|
1840
|
+
*/
|
|
1841
|
+
parseMasterchainInfo(data: unknown): MasterchainInfo;
|
|
1842
|
+
/**
|
|
1843
|
+
* Validate provider configuration.
|
|
1844
|
+
* Checks if required API keys are present, etc.
|
|
1845
|
+
*/
|
|
1846
|
+
validateConfig(): {
|
|
1847
|
+
valid: boolean;
|
|
1848
|
+
error?: string;
|
|
1849
|
+
};
|
|
1850
|
+
/**
|
|
1851
|
+
* Get the normalized endpoint for this provider.
|
|
1852
|
+
*/
|
|
1853
|
+
getNormalizedEndpoint(): string;
|
|
1854
|
+
/**
|
|
1855
|
+
* Check if this provider requires an API key.
|
|
1856
|
+
*/
|
|
1857
|
+
requiresApiKey(): boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* Check if API key is present (if required).
|
|
1860
|
+
*/
|
|
1861
|
+
hasApiKey(): boolean;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* Unified Provider System - Chainstack Provider
|
|
1866
|
+
*
|
|
1867
|
+
* Chainstack-specific implementation.
|
|
1868
|
+
* Documentation: https://docs.chainstack.com/reference/getting-started-ton
|
|
1869
|
+
*
|
|
1870
|
+
* Endpoint format: https://ton-{network}.core.chainstack.com/{key}/api/v2/jsonRPC
|
|
1871
|
+
* API key: In URL path (not header)
|
|
1872
|
+
*/
|
|
1873
|
+
|
|
1874
|
+
declare class ChainstackProvider extends BaseProvider {
|
|
1875
|
+
constructor(provider: ResolvedProvider);
|
|
1876
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1877
|
+
buildHeaders(): Record<string, string>;
|
|
1878
|
+
validateConfig(): {
|
|
1879
|
+
valid: boolean;
|
|
1880
|
+
error?: string;
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* Unified Provider System - Tatum Provider
|
|
1886
|
+
*
|
|
1887
|
+
* Tatum-specific implementation.
|
|
1888
|
+
* Documentation: https://docs.tatum.io/reference/rpc-ton
|
|
1889
|
+
*
|
|
1890
|
+
* Endpoint format: https://ton-{network}.gateway.tatum.io/jsonRPC
|
|
1891
|
+
* API key: Required in x-api-key header
|
|
1892
|
+
*/
|
|
1893
|
+
|
|
1894
|
+
declare class TatumProvider extends BaseProvider {
|
|
1895
|
+
constructor(provider: ResolvedProvider);
|
|
1896
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1897
|
+
buildHeaders(): Record<string, string>;
|
|
1898
|
+
requiresApiKey(): boolean;
|
|
1899
|
+
validateConfig(): {
|
|
1900
|
+
valid: boolean;
|
|
1901
|
+
error?: string;
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Unified Provider System - OnFinality Provider
|
|
1907
|
+
*
|
|
1908
|
+
* OnFinality-specific implementation.
|
|
1909
|
+
* Documentation: https://documentation.onfinality.io/support/ton
|
|
1910
|
+
*
|
|
1911
|
+
* Endpoint format: https://ton-{network}.api.onfinality.io/public or /rpc
|
|
1912
|
+
* API key: Optional, in apikey header (preferred) or query params
|
|
1913
|
+
*/
|
|
1914
|
+
|
|
1915
|
+
declare class OnFinalityProvider extends BaseProvider {
|
|
1916
|
+
constructor(provider: ResolvedProvider);
|
|
1917
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1918
|
+
buildHeaders(): Record<string, string>;
|
|
1919
|
+
parseResponse<T = unknown>(data: unknown): T;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Unified Provider System - QuickNode Provider
|
|
1924
|
+
*
|
|
1925
|
+
* QuickNode-specific implementation.
|
|
1926
|
+
* Documentation: https://quicknode.com/docs/ton
|
|
1927
|
+
*
|
|
1928
|
+
* Endpoint format: https://{key}.ton-{network}.quiknode.pro/jsonRPC
|
|
1929
|
+
* API key: In subdomain (not header)
|
|
1930
|
+
*/
|
|
1931
|
+
|
|
1932
|
+
declare class QuickNodeProvider extends BaseProvider {
|
|
1933
|
+
constructor(provider: ResolvedProvider);
|
|
1934
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1935
|
+
buildHeaders(): Record<string, string>;
|
|
1936
|
+
validateConfig(): {
|
|
1937
|
+
valid: boolean;
|
|
1938
|
+
error?: string;
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Unified Provider System - GetBlock Provider
|
|
1944
|
+
*
|
|
1945
|
+
* GetBlock-specific implementation.
|
|
1946
|
+
* Documentation: https://docs.getblock.io/api-reference/the-open-network-ton
|
|
1947
|
+
*
|
|
1948
|
+
* Endpoint format: https://go.getblock.io/{key}/jsonRPC
|
|
1949
|
+
* API key: Required in x-api-key header
|
|
1950
|
+
*/
|
|
1951
|
+
|
|
1952
|
+
declare class GetBlockProvider extends BaseProvider {
|
|
1953
|
+
constructor(provider: ResolvedProvider);
|
|
1954
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1955
|
+
buildHeaders(): Record<string, string>;
|
|
1956
|
+
requiresApiKey(): boolean;
|
|
1957
|
+
validateConfig(): {
|
|
1958
|
+
valid: boolean;
|
|
1959
|
+
error?: string;
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* Unified Provider System - TON Center Provider
|
|
1965
|
+
*
|
|
1966
|
+
* TON Center-specific implementation.
|
|
1967
|
+
* Documentation: https://toncenter.com/api/v2/
|
|
1968
|
+
*
|
|
1969
|
+
* Endpoint format: https://{testnet.}toncenter.com/api/v2/jsonRPC
|
|
1970
|
+
* API key: Optional, passed to TonClient (not in header for HTTP requests)
|
|
1971
|
+
*/
|
|
1972
|
+
|
|
1973
|
+
declare class TonCenterProvider extends BaseProvider {
|
|
1974
|
+
constructor(provider: ResolvedProvider);
|
|
1975
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1976
|
+
buildHeaders(): Record<string, string>;
|
|
1977
|
+
requiresApiKey(): boolean;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* Unified Provider System - Orbs Provider
|
|
1982
|
+
*
|
|
1983
|
+
* Orbs (TON Access) specific implementation.
|
|
1984
|
+
* Documentation: https://github.com/orbs-network/ton-access
|
|
1985
|
+
*
|
|
1986
|
+
* Endpoint format: Dynamic discovery via @orbs-network/ton-access
|
|
1987
|
+
* API key: Not required (decentralized gateway)
|
|
1988
|
+
*/
|
|
1989
|
+
|
|
1990
|
+
declare class OrbsProvider extends BaseProvider {
|
|
1991
|
+
constructor(provider: ResolvedProvider);
|
|
1992
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1993
|
+
buildHeaders(): Record<string, string>;
|
|
1994
|
+
/**
|
|
1995
|
+
* Get dynamic endpoint from Orbs TON Access.
|
|
1996
|
+
* This should be called before making requests.
|
|
1997
|
+
*/
|
|
1998
|
+
getDynamicEndpoint(): Promise<string>;
|
|
1999
|
+
requiresApiKey(): boolean;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Unified Provider System - Provider Factory
|
|
2004
|
+
*
|
|
2005
|
+
* Factory for creating provider-specific implementations.
|
|
2006
|
+
*/
|
|
2007
|
+
|
|
2008
|
+
/**
|
|
2009
|
+
* Generic provider for unknown/custom provider types.
|
|
2010
|
+
* Uses default behavior from BaseProvider.
|
|
2011
|
+
*/
|
|
2012
|
+
declare class GenericProvider extends BaseProvider {
|
|
2013
|
+
normalizeEndpoint(endpoint: string): string;
|
|
2014
|
+
buildHeaders(): Record<string, string>;
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Create a provider-specific implementation for the given provider.
|
|
2018
|
+
*
|
|
2019
|
+
* @param provider - Resolved provider configuration
|
|
2020
|
+
* @returns Provider-specific implementation instance
|
|
2021
|
+
*/
|
|
2022
|
+
declare function createProvider(provider: ResolvedProvider): BaseProvider;
|
|
2023
|
+
|
|
2024
|
+
export { type ApiVersion, ApiVersionSchema, BaseProvider, BrowserAdapter, CHAINSTACK_RATE_LIMIT, ChainstackProvider, ConfigError, DEFAULT_CONTRACT_TIMEOUT_MS, DEFAULT_HEALTH_CHECK_TIMEOUT_MS, DEFAULT_PROVIDERS, DEFAULT_PROVIDER_TIMEOUT_MS, DEFAULT_RATE_LIMIT, GenericProvider, GetBlockProvider, type HealthCheckConfig, HealthChecker, type Logger, type MasterchainInfo, type Network, type NetworkDefaults, NetworkSchema, NodeAdapter, ORBS_RATE_LIMIT, OnFinalityProvider, OrbsProvider, type ProviderConfig, ProviderConfigSchema, type ProviderEndpoints, ProviderError, type ProviderHealthResult, ProviderManager, type ProviderManagerOptions, type ProviderManagerState, ProviderRegistry, ProviderSelector, type ProviderState, type ProviderStatus, type ProviderType, ProviderTypeSchema, QUICKNODE_RATE_LIMIT, QuickNodeProvider, type RateLimitConfig, RateLimitError, type RateLimitState, RateLimiterManager, type ResolvedProvider, type RetryOptions, type RpcConfig, RpcConfigSchema, type SelectionConfig, type StateListener, TatumProvider, TimeoutError, TokenBucketRateLimiter, type TonApiResponse, TonCenterProvider, buildGetAddressBalanceUrl, buildGetAddressInfoUrl, buildGetAddressStateUrl, buildRestUrl, createBrowserAdapter, createBrowserAdapterForNetwork, createDefaultConfig, createDefaultRegistry, createEmptyConfig, createHealthChecker, createNodeAdapter, createProvider, createProviderManager, createRateLimiter, createRateLimiterManager, createRegistry, createRegistryFromData, createRegistryFromFile, createSelector, createTimeoutController, detectNetworkFromEndpoint, fetchWithTimeout, getBaseUrl, getDefaultProvidersForNetwork, getEnvVar, getProviderManager, getProvidersForNetwork, getRateLimitForType, getTonClient, getTonClientForNetwork, getTonClientWithRateLimit, isApiVersion, isChainstackUrl, isNetwork, isOrbsUrl, isProviderType, isQuickNodeUrl, isRateLimitError, isTimeoutError, isTonCenterUrl, isValidHttpUrl, isValidWsUrl, loadBuiltinConfig, loadConfig, loadConfigFromData, loadConfigFromUrl, mergeConfigs, mergeWithDefaults, normalizeV2Endpoint, parseProviderConfig, parseRpcConfig, resetNodeAdapter, resolveAllProviders, resolveEndpoints, resolveKeyPlaceholder, resolveProvider, sleep, toV2Base, toV3Base, withRetry, withTimeout, withTimeoutAndRetry, withTimeoutFn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1043,13 +1043,6 @@ declare class HealthChecker {
|
|
|
1043
1043
|
* Get endpoint URL for a provider (handles dynamic providers like Orbs)
|
|
1044
1044
|
*/
|
|
1045
1045
|
private getEndpoint;
|
|
1046
|
-
/**
|
|
1047
|
-
* Normalize endpoint for provider-specific requirements
|
|
1048
|
-
*
|
|
1049
|
-
* Note: normalizeV2Endpoint now handles all provider-specific cases correctly,
|
|
1050
|
-
* including Tatum (/jsonRPC), OnFinality (/public or /rpc), QuickNode, and GetBlock.
|
|
1051
|
-
*/
|
|
1052
|
-
private normalizeEndpointForProvider;
|
|
1053
1046
|
/**
|
|
1054
1047
|
* Call getMasterchainInfo API with provider-specific handling
|
|
1055
1048
|
*/
|
|
@@ -1630,20 +1623,16 @@ declare function createBrowserAdapterForNetwork(network: Network, configPath?: s
|
|
|
1630
1623
|
*
|
|
1631
1624
|
* URL normalization and manipulation for TON RPC endpoints.
|
|
1632
1625
|
*/
|
|
1626
|
+
|
|
1633
1627
|
/**
|
|
1634
|
-
* Normalize endpoint URL for TonClient v2 API.
|
|
1635
|
-
*
|
|
1628
|
+
* Normalize endpoint URL for TonClient v2 API using provider-specific implementation.
|
|
1629
|
+
* This is the preferred method when a ResolvedProvider is available.
|
|
1636
1630
|
*
|
|
1637
|
-
*
|
|
1638
|
-
* -
|
|
1639
|
-
*
|
|
1640
|
-
* - TON Access (orbs): Already returns correct JSON-RPC endpoint
|
|
1641
|
-
* - QuickNode: Needs /jsonRPC appended to base URL
|
|
1642
|
-
* - GetBlock: Needs /jsonRPC appended to base URL
|
|
1643
|
-
* - Tatum: Gateway URLs need /jsonRPC appended (gateway.tatum.io/jsonRPC)
|
|
1644
|
-
* - OnFinality: Uses /public or /rpc path with query params - preserve query params
|
|
1631
|
+
* @param endpoint - Endpoint URL to normalize
|
|
1632
|
+
* @param provider - Resolved provider configuration (optional)
|
|
1633
|
+
* @returns Normalized endpoint URL
|
|
1645
1634
|
*/
|
|
1646
|
-
declare function normalizeV2Endpoint(endpoint: string): string;
|
|
1635
|
+
declare function normalizeV2Endpoint(endpoint: string, provider?: ResolvedProvider): string;
|
|
1647
1636
|
/**
|
|
1648
1637
|
* Convert any endpoint to v2 base URL (without /jsonRPC suffix).
|
|
1649
1638
|
*/
|
|
@@ -1802,4 +1791,234 @@ declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
|
1802
1791
|
*/
|
|
1803
1792
|
declare function isRateLimitError(error: unknown): boolean;
|
|
1804
1793
|
|
|
1805
|
-
|
|
1794
|
+
/**
|
|
1795
|
+
* Unified Provider System - Base Provider
|
|
1796
|
+
*
|
|
1797
|
+
* Base class for provider-specific implementations.
|
|
1798
|
+
* All provider types extend this class to provide provider-specific behavior.
|
|
1799
|
+
*/
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Base provider class that all provider-specific implementations extend.
|
|
1803
|
+
* Provides common functionality and defines the interface for provider-specific behavior.
|
|
1804
|
+
*/
|
|
1805
|
+
declare abstract class BaseProvider {
|
|
1806
|
+
protected provider: ResolvedProvider;
|
|
1807
|
+
constructor(provider: ResolvedProvider);
|
|
1808
|
+
/**
|
|
1809
|
+
* Get the provider instance
|
|
1810
|
+
*/
|
|
1811
|
+
getProvider(): ResolvedProvider;
|
|
1812
|
+
/**
|
|
1813
|
+
* Normalize endpoint URL for this provider type.
|
|
1814
|
+
* Each provider may have different endpoint format requirements.
|
|
1815
|
+
*/
|
|
1816
|
+
abstract normalizeEndpoint(endpoint: string): string;
|
|
1817
|
+
/**
|
|
1818
|
+
* Build HTTP headers for requests to this provider.
|
|
1819
|
+
* Handles provider-specific authentication (API keys in headers, etc.)
|
|
1820
|
+
*/
|
|
1821
|
+
abstract buildHeaders(): Record<string, string>;
|
|
1822
|
+
/**
|
|
1823
|
+
* Build a JSON-RPC request body.
|
|
1824
|
+
* Most providers use standard JSON-RPC 2.0, but some may need modifications.
|
|
1825
|
+
*/
|
|
1826
|
+
buildRequest(method: string, params?: Record<string, unknown>): {
|
|
1827
|
+
id: string;
|
|
1828
|
+
jsonrpc: string;
|
|
1829
|
+
method: string;
|
|
1830
|
+
params: Record<string, unknown>;
|
|
1831
|
+
};
|
|
1832
|
+
/**
|
|
1833
|
+
* Parse response from provider.
|
|
1834
|
+
* Handles provider-specific response formats.
|
|
1835
|
+
*/
|
|
1836
|
+
parseResponse<T = unknown>(data: unknown): T;
|
|
1837
|
+
/**
|
|
1838
|
+
* Parse masterchain info from response.
|
|
1839
|
+
* Validates the response structure and extracts seqno.
|
|
1840
|
+
*/
|
|
1841
|
+
parseMasterchainInfo(data: unknown): MasterchainInfo;
|
|
1842
|
+
/**
|
|
1843
|
+
* Validate provider configuration.
|
|
1844
|
+
* Checks if required API keys are present, etc.
|
|
1845
|
+
*/
|
|
1846
|
+
validateConfig(): {
|
|
1847
|
+
valid: boolean;
|
|
1848
|
+
error?: string;
|
|
1849
|
+
};
|
|
1850
|
+
/**
|
|
1851
|
+
* Get the normalized endpoint for this provider.
|
|
1852
|
+
*/
|
|
1853
|
+
getNormalizedEndpoint(): string;
|
|
1854
|
+
/**
|
|
1855
|
+
* Check if this provider requires an API key.
|
|
1856
|
+
*/
|
|
1857
|
+
requiresApiKey(): boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* Check if API key is present (if required).
|
|
1860
|
+
*/
|
|
1861
|
+
hasApiKey(): boolean;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* Unified Provider System - Chainstack Provider
|
|
1866
|
+
*
|
|
1867
|
+
* Chainstack-specific implementation.
|
|
1868
|
+
* Documentation: https://docs.chainstack.com/reference/getting-started-ton
|
|
1869
|
+
*
|
|
1870
|
+
* Endpoint format: https://ton-{network}.core.chainstack.com/{key}/api/v2/jsonRPC
|
|
1871
|
+
* API key: In URL path (not header)
|
|
1872
|
+
*/
|
|
1873
|
+
|
|
1874
|
+
declare class ChainstackProvider extends BaseProvider {
|
|
1875
|
+
constructor(provider: ResolvedProvider);
|
|
1876
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1877
|
+
buildHeaders(): Record<string, string>;
|
|
1878
|
+
validateConfig(): {
|
|
1879
|
+
valid: boolean;
|
|
1880
|
+
error?: string;
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* Unified Provider System - Tatum Provider
|
|
1886
|
+
*
|
|
1887
|
+
* Tatum-specific implementation.
|
|
1888
|
+
* Documentation: https://docs.tatum.io/reference/rpc-ton
|
|
1889
|
+
*
|
|
1890
|
+
* Endpoint format: https://ton-{network}.gateway.tatum.io/jsonRPC
|
|
1891
|
+
* API key: Required in x-api-key header
|
|
1892
|
+
*/
|
|
1893
|
+
|
|
1894
|
+
declare class TatumProvider extends BaseProvider {
|
|
1895
|
+
constructor(provider: ResolvedProvider);
|
|
1896
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1897
|
+
buildHeaders(): Record<string, string>;
|
|
1898
|
+
requiresApiKey(): boolean;
|
|
1899
|
+
validateConfig(): {
|
|
1900
|
+
valid: boolean;
|
|
1901
|
+
error?: string;
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Unified Provider System - OnFinality Provider
|
|
1907
|
+
*
|
|
1908
|
+
* OnFinality-specific implementation.
|
|
1909
|
+
* Documentation: https://documentation.onfinality.io/support/ton
|
|
1910
|
+
*
|
|
1911
|
+
* Endpoint format: https://ton-{network}.api.onfinality.io/public or /rpc
|
|
1912
|
+
* API key: Optional, in apikey header (preferred) or query params
|
|
1913
|
+
*/
|
|
1914
|
+
|
|
1915
|
+
declare class OnFinalityProvider extends BaseProvider {
|
|
1916
|
+
constructor(provider: ResolvedProvider);
|
|
1917
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1918
|
+
buildHeaders(): Record<string, string>;
|
|
1919
|
+
parseResponse<T = unknown>(data: unknown): T;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Unified Provider System - QuickNode Provider
|
|
1924
|
+
*
|
|
1925
|
+
* QuickNode-specific implementation.
|
|
1926
|
+
* Documentation: https://quicknode.com/docs/ton
|
|
1927
|
+
*
|
|
1928
|
+
* Endpoint format: https://{key}.ton-{network}.quiknode.pro/jsonRPC
|
|
1929
|
+
* API key: In subdomain (not header)
|
|
1930
|
+
*/
|
|
1931
|
+
|
|
1932
|
+
declare class QuickNodeProvider extends BaseProvider {
|
|
1933
|
+
constructor(provider: ResolvedProvider);
|
|
1934
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1935
|
+
buildHeaders(): Record<string, string>;
|
|
1936
|
+
validateConfig(): {
|
|
1937
|
+
valid: boolean;
|
|
1938
|
+
error?: string;
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Unified Provider System - GetBlock Provider
|
|
1944
|
+
*
|
|
1945
|
+
* GetBlock-specific implementation.
|
|
1946
|
+
* Documentation: https://docs.getblock.io/api-reference/the-open-network-ton
|
|
1947
|
+
*
|
|
1948
|
+
* Endpoint format: https://go.getblock.io/{key}/jsonRPC
|
|
1949
|
+
* API key: Required in x-api-key header
|
|
1950
|
+
*/
|
|
1951
|
+
|
|
1952
|
+
declare class GetBlockProvider extends BaseProvider {
|
|
1953
|
+
constructor(provider: ResolvedProvider);
|
|
1954
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1955
|
+
buildHeaders(): Record<string, string>;
|
|
1956
|
+
requiresApiKey(): boolean;
|
|
1957
|
+
validateConfig(): {
|
|
1958
|
+
valid: boolean;
|
|
1959
|
+
error?: string;
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* Unified Provider System - TON Center Provider
|
|
1965
|
+
*
|
|
1966
|
+
* TON Center-specific implementation.
|
|
1967
|
+
* Documentation: https://toncenter.com/api/v2/
|
|
1968
|
+
*
|
|
1969
|
+
* Endpoint format: https://{testnet.}toncenter.com/api/v2/jsonRPC
|
|
1970
|
+
* API key: Optional, passed to TonClient (not in header for HTTP requests)
|
|
1971
|
+
*/
|
|
1972
|
+
|
|
1973
|
+
declare class TonCenterProvider extends BaseProvider {
|
|
1974
|
+
constructor(provider: ResolvedProvider);
|
|
1975
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1976
|
+
buildHeaders(): Record<string, string>;
|
|
1977
|
+
requiresApiKey(): boolean;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* Unified Provider System - Orbs Provider
|
|
1982
|
+
*
|
|
1983
|
+
* Orbs (TON Access) specific implementation.
|
|
1984
|
+
* Documentation: https://github.com/orbs-network/ton-access
|
|
1985
|
+
*
|
|
1986
|
+
* Endpoint format: Dynamic discovery via @orbs-network/ton-access
|
|
1987
|
+
* API key: Not required (decentralized gateway)
|
|
1988
|
+
*/
|
|
1989
|
+
|
|
1990
|
+
declare class OrbsProvider extends BaseProvider {
|
|
1991
|
+
constructor(provider: ResolvedProvider);
|
|
1992
|
+
normalizeEndpoint(endpoint: string): string;
|
|
1993
|
+
buildHeaders(): Record<string, string>;
|
|
1994
|
+
/**
|
|
1995
|
+
* Get dynamic endpoint from Orbs TON Access.
|
|
1996
|
+
* This should be called before making requests.
|
|
1997
|
+
*/
|
|
1998
|
+
getDynamicEndpoint(): Promise<string>;
|
|
1999
|
+
requiresApiKey(): boolean;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Unified Provider System - Provider Factory
|
|
2004
|
+
*
|
|
2005
|
+
* Factory for creating provider-specific implementations.
|
|
2006
|
+
*/
|
|
2007
|
+
|
|
2008
|
+
/**
|
|
2009
|
+
* Generic provider for unknown/custom provider types.
|
|
2010
|
+
* Uses default behavior from BaseProvider.
|
|
2011
|
+
*/
|
|
2012
|
+
declare class GenericProvider extends BaseProvider {
|
|
2013
|
+
normalizeEndpoint(endpoint: string): string;
|
|
2014
|
+
buildHeaders(): Record<string, string>;
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Create a provider-specific implementation for the given provider.
|
|
2018
|
+
*
|
|
2019
|
+
* @param provider - Resolved provider configuration
|
|
2020
|
+
* @returns Provider-specific implementation instance
|
|
2021
|
+
*/
|
|
2022
|
+
declare function createProvider(provider: ResolvedProvider): BaseProvider;
|
|
2023
|
+
|
|
2024
|
+
export { type ApiVersion, ApiVersionSchema, BaseProvider, BrowserAdapter, CHAINSTACK_RATE_LIMIT, ChainstackProvider, ConfigError, DEFAULT_CONTRACT_TIMEOUT_MS, DEFAULT_HEALTH_CHECK_TIMEOUT_MS, DEFAULT_PROVIDERS, DEFAULT_PROVIDER_TIMEOUT_MS, DEFAULT_RATE_LIMIT, GenericProvider, GetBlockProvider, type HealthCheckConfig, HealthChecker, type Logger, type MasterchainInfo, type Network, type NetworkDefaults, NetworkSchema, NodeAdapter, ORBS_RATE_LIMIT, OnFinalityProvider, OrbsProvider, type ProviderConfig, ProviderConfigSchema, type ProviderEndpoints, ProviderError, type ProviderHealthResult, ProviderManager, type ProviderManagerOptions, type ProviderManagerState, ProviderRegistry, ProviderSelector, type ProviderState, type ProviderStatus, type ProviderType, ProviderTypeSchema, QUICKNODE_RATE_LIMIT, QuickNodeProvider, type RateLimitConfig, RateLimitError, type RateLimitState, RateLimiterManager, type ResolvedProvider, type RetryOptions, type RpcConfig, RpcConfigSchema, type SelectionConfig, type StateListener, TatumProvider, TimeoutError, TokenBucketRateLimiter, type TonApiResponse, TonCenterProvider, buildGetAddressBalanceUrl, buildGetAddressInfoUrl, buildGetAddressStateUrl, buildRestUrl, createBrowserAdapter, createBrowserAdapterForNetwork, createDefaultConfig, createDefaultRegistry, createEmptyConfig, createHealthChecker, createNodeAdapter, createProvider, createProviderManager, createRateLimiter, createRateLimiterManager, createRegistry, createRegistryFromData, createRegistryFromFile, createSelector, createTimeoutController, detectNetworkFromEndpoint, fetchWithTimeout, getBaseUrl, getDefaultProvidersForNetwork, getEnvVar, getProviderManager, getProvidersForNetwork, getRateLimitForType, getTonClient, getTonClientForNetwork, getTonClientWithRateLimit, isApiVersion, isChainstackUrl, isNetwork, isOrbsUrl, isProviderType, isQuickNodeUrl, isRateLimitError, isTimeoutError, isTonCenterUrl, isValidHttpUrl, isValidWsUrl, loadBuiltinConfig, loadConfig, loadConfigFromData, loadConfigFromUrl, mergeConfigs, mergeWithDefaults, normalizeV2Endpoint, parseProviderConfig, parseRpcConfig, resetNodeAdapter, resolveAllProviders, resolveEndpoints, resolveKeyPlaceholder, resolveProvider, sleep, toV2Base, toV3Base, withRetry, withTimeout, withTimeoutAndRetry, withTimeoutFn };
|