@unilogin/sdk
Version:
SDK is a JS library, that communicates with relayer. SDK allows managing contract, by creating basic contract-calling messages.
80 lines • 4.74 kB
TypeScript
import { BalanceChecker, DeepPartial, PublicRelayerConfig, TokenDetailsService, TokensValueConverter, SufficientBalanceValidator, Nullable, GasMode, MessageStatus, GasPriceOracle, TokenPricesService } from '@unilogin/commons';
import { BlockchainService } from '@unilogin/contracts';
import { providers } from 'ethers';
import { SdkConfig } from '../config/SdkConfig';
import { AggregateBalanceObserver, OnAggregatedBalanceChange } from '../core/observers/AggregateBalanceObserver';
import AuthorisationsObserver from '../core/observers/AuthorisationsObserver';
import { BalanceObserver, OnBalanceChange } from '../core/observers/BalanceObserver';
import { OnTokenPricesChange, PriceObserver } from '../core/observers/PriceObserver';
import { ExecutionFactory } from '../core/services/ExecutionFactory';
import { FeatureFlagsService } from '../core/services/FeatureFlagsService';
import { GasModeService } from '../core/services/GasModeService';
import { MessageConverter } from '../core/services/MessageConverter';
import { TokensDetailsStore } from '../core/services/TokensDetailsStore';
import { RelayerApi } from '../integration/http/RelayerApi';
import { FutureWalletFactory } from './FutureWalletFactory';
import { FutureWallet } from './wallet/FutureWallet';
import { WalletEventType, WalletEventFilter, WalletEventCallback } from '../core/models/events';
import WalletEventsObserverFactory from '../core/observers/WalletEventsObserverFactory';
import { WalletContractService } from '../integration/ethereum/WalletContractService';
import { INotifySdk } from '../integration/notifySdk/interfaces';
declare class UniLoginSdk {
readonly provider: providers.Provider;
readonly relayerApi: RelayerApi;
readonly authorisationsObserver: AuthorisationsObserver;
readonly executionFactory: ExecutionFactory;
readonly balanceChecker: BalanceChecker;
readonly tokensValueConverter: TokensValueConverter;
readonly priceObserver: PriceObserver;
readonly tokenDetailsService: TokenDetailsService;
readonly tokensDetailsStore: TokensDetailsStore;
readonly tokenPricesService: TokenPricesService;
readonly blockchainService: BlockchainService;
readonly gasPriceOracle: GasPriceOracle;
readonly gasModeService: GasModeService;
readonly config: SdkConfig;
readonly sufficientBalanceValidator: SufficientBalanceValidator;
readonly factoryAddress?: string;
readonly featureFlagsService: FeatureFlagsService;
readonly messageConverter: MessageConverter;
readonly walletEventsObserverFactory: WalletEventsObserverFactory;
readonly walletContractService: WalletContractService;
private readonly relayerConfig;
balanceObserver?: BalanceObserver;
aggregateBalanceObserver?: AggregateBalanceObserver;
futureWalletFactory?: FutureWalletFactory;
notifySdk?: INotifySdk;
constructor(relayerUrl: string, providerOrUrl: string | providers.Provider, config?: DeepPartial<SdkConfig>);
private loadRelayerConfigFromApi;
getNotice(): string;
isRefundPaid(): boolean;
getFutureWalletFactory(): FutureWalletFactory;
createFutureWallet(ensName: string, gasPrice: string, gasToken: string): Promise<FutureWallet>;
getMessageStatus(messageHash: string): Promise<MessageStatus>;
getRelayerConfig(): PublicRelayerConfig;
fetchRelayerConfig(): Promise<PublicRelayerConfig>;
fetchBalanceObserver(contractAddress: string): Promise<void>;
fetchAggregateBalanceObserver(contractAddress: string): Promise<void>;
private fetchFutureWalletFactory;
getWalletContractAddress(ensName: string): Promise<string>;
walletContractExist(ensName: string): Promise<boolean>;
resolveName(ensName: string): Promise<Nullable<string>>;
connect(walletContractAddress: string): Promise<{
privateKey: string;
securityCode: number[];
}>;
subscribe(eventType: WalletEventType, filter: WalletEventFilter, callback: WalletEventCallback): () => void;
subscribeToBalances(contractAddress: string, callback: OnBalanceChange): Promise<() => void>;
subscribeToAggregatedBalance(contractAddress: string, callback: OnAggregatedBalanceChange): Promise<() => void>;
subscribeToPrices(callback: OnTokenPricesChange): () => void;
subscribeAuthorisations(contractAddress: string, privateKey: string, callback: Function): Promise<() => void>;
getConnectedDevices(contractAddress: string, privateKey: string): Promise<import("@unilogin/commons").Device[]>;
getGasModes(): Promise<GasMode[]>;
getNotifySdk(): INotifySdk;
start(): Promise<void>;
private startBlockchainServices;
stop(): void;
finalizeAndStop(): Promise<void>;
}
export default UniLoginSdk;
//# sourceMappingURL=sdk.d.ts.map