@tristeroresearch/mach-sdk
Version:
A TypeScript SDK for integrating with Mach's API.
92 lines • 3.37 kB
TypeScript
/**
* A configuration file for the SDK
* Loads the config from the Mach API
* The config contains the available tokens, networks, and swap contracts for the Mach Platform
* Uses a singleton pattern to ensure that the config is only loaded once
* Provides getters to access the config variables
* Provides a setter to update the config object and the wallet clients
* @module config
*/
import { ConfigLoadingStatus } from './enums';
import { type Hex } from 'viem';
import { type Token } from './@types/token';
import { type Network } from './@types/network';
interface InitialStateProps {
resolverPaused: boolean;
loading: ConfigLoadingStatus;
availableTokens: Token[];
availableNetworks: Record<string, Network>;
swapContracts: Record<string, any>;
publicClient: any;
account: any;
userId?: string;
apiKey?: string;
machGasRecommendationOverride: boolean;
isTestnet: boolean;
}
interface Config extends InitialStateProps {
integrator: string;
apiUrl: string;
origin: string;
chains: any[];
preloadChains: boolean;
debug: boolean;
publicClient: any;
account: any;
key: Hex;
priorityFeePerGas: bigint;
feePerGas: bigint;
gasLimitMultiplier: bigint;
gasLimit: bigint;
gasFeeMultiplier: bigint;
}
export declare const setConfig: (newConfig: Partial<Config>) => void;
/**
* Loads the config from the Mach API
* The config contains the available tokens, networks, and swap contracts for the Mach Platform
* Uses a singleton pattern to ensure that the config is only loaded once
* Provides getters to access the config variables
* Provides a setter to update the config object and the wallet clients
* @returns {Object} An object with methods to get and set the config and wallet clients
*/
export declare const config: Promise<{
loading: Promise<void>;
get(): Config;
getWalletKey(): any;
getWalletAddress(): any;
getPublicClient(): any;
getTokens(): Token[];
getNetworks(): Record<string, Network>;
getSwapContracts(): Record<string, any>;
setWalletClients(privateKey: Hex, srcChain: string): Promise<void>;
updateConfigWithClients(key: Hex, publicClient: any, account: any): void;
getConfig(): Config;
getIntegrator(): string;
setIntegrator(integrator: string): void;
getApiUrl(): string;
setApiUrl(apiUrl: string): Promise<void>;
getPriorityFeePerGas(): bigint;
setPriorityFeePerGas(priorityFeePerGas: bigint): void;
getPriorityFee(): bigint;
setPriorityFee(priorityFee: bigint): void;
getFeePerGas(): bigint;
setFeePerGas(feePerGas: bigint): void;
getGasFee(): bigint;
getGasLimit(): bigint;
setGasLimit(gasLimit: bigint): void;
setGasFee(gasFee: bigint): void;
getGasLimitMultiplier(): bigint;
setGasLimitMultiplier(gasLimitMultiplier: bigint): void;
getGasRecommendationOverride(): boolean;
setGasRecommendationOverride(gasRecommendationOverride: boolean): void;
getTestnetMode(): boolean;
getMainnetMode(): boolean;
setTestnetMode(isTestnet: boolean): Promise<void>;
setMainnetMode(isMainnet: boolean): Promise<void>;
getGasFeeMultiplier(): bigint;
setGasFeeMultiplier(gasFeeMultiplier: bigint): void;
getOrigin(): string;
setOrigin(origin: string): void;
}>;
export {};
//# sourceMappingURL=config.d.ts.map