UNPKG

wallets-wrapper

Version:

How to install

88 lines (87 loc) 3.36 kB
import AnchorLink, { LinkSession } from 'anchor-link'; import { BehaviorSubject } from 'rxjs'; import { AccountInfo, ChainInfo, IProviderRpcError, SubscriptionMessage, WalletsNames, WalletStateProps } from '../../../models'; import { EosTransferProps, GetEosAccountInfoProps, GetEosContractData, SendTransactionResponse } from '../../../networks'; import { SendEosSignedTransaction, SendEosTransaction } from '../models'; /** * The client describes how to work with Anchor. * @implements IAnchorWrapper * @class */ export declare class AnchorWrapper { static instance: AnchorWrapper; static type: WalletsNames; address$: BehaviorSubject<string[]>; chainId$: BehaviorSubject<ChainInfo | null>; subscriptionMessage$: BehaviorSubject<SubscriptionMessage | null>; isConnected$: BehaviorSubject<boolean>; errors$: BehaviorSubject<IProviderRpcError | null>; link: AnchorLink; session: LinkSession | null; constructor({ address$, chainId$, isConnected$, subscriptionMessage$, errors$, }: WalletStateProps); /** * init AnchorConnect library * @return {LinkSession | null} * @async */ init(): Promise<boolean>; isInstalled(): Promise<boolean>; /** * Get current anchor wallet addresses * @return {Promise<string[]>} - wallet address * @async */ getAddress: () => Promise<string[]>; /** * Get balance from current wallet in native coin * @param {GetEosAccountInfoProps} coins - * @return {Promise<number[]>} - balance value * @async */ getBalance({ coin, address }: GetEosAccountInfoProps): Promise<number[]>; /** * Get balance from current wallet in contracts * @param {GetEosAccountInfoProps} coins - * @return {Promise<number[]>} - balance value * @async */ getContractData({ network, code, scope, table, ...restObject }: GetEosContractData): Promise<import("eosjs/dist/eosjs-rpc-interfaces").GetTableRowsResult>; /** * Get account info from current wallets in native coin * @param {GetEosAccountInfoProps} args - * @return {Promise<number[]>} * @async */ getAccountInfo(args: GetEosAccountInfoProps[]): Promise<AccountInfo[]>; /** * Get data for sign in via anchor * @return {Promise<string[]>} - wallet address * @async */ connectWallet(): Promise<string[]>; /** * Send Transaction with user's anchor * @param {SendEosSignedTransaction} object * @return {Promise<TransactResult | undefined>} * @async */ sendSignedTransaction({ args, options }: SendEosSignedTransaction): Promise<import("anchor-link").TransactResult | undefined>; /** * Send Transaction * @param {SendEosTransaction} tx * @return {Promise<SendTransactionResponse>} * @async */ sendTransaction({ tx }: { tx?: SendEosTransaction; }): Promise<SendTransactionResponse>; /** * Transfer native coin * @param {EosTransferProps} args * @return {TransactResult | undefined} * @async */ transfer({ coin, addressTo, value, from, memo }: EosTransferProps): Promise<import("anchor-link").TransactResult | undefined>; sign(): Promise<void>; getProvider(): Promise<AnchorLink>; }