wallets-wrapper
Version:
How to install
144 lines (143 loc) • 5.66 kB
TypeScript
import { TransactResult } from 'anchor-link';
import { ethers, Transaction } from 'ethers';
import { Observable } from 'rxjs';
import { BinanceCoins, BitcoinCoins, EosCoins, EosTransferProps, EthereumCoins, GetEosAccountInfoProps, RippleCoins } from '../networks';
import { SendEosSignedTransaction } from '../wallets/anchor/models';
import { GetBalanceProps } from '../wallets/metamask';
import { AllCoins, AllResponses, CardanoCoins, GetTrezorAccountInfo, NemCoins, SendSignedTransactionProps, StellarCoins, TezosCoins, TransferProps } from '../wallets/trezor/models';
import { Networks } from './enums';
import { AccountInfo, ApproveToken, GetContractBalance, SetApprovalForAll, TransferContractToken, TransferEvent, TransferToken } from './types';
export declare type SendSignedTransaction = {
(args: SendSignedTransactionProps): Promise<AllResponses>;
(args: {
tx?: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
}): Promise<ethers.providers.TransactionResponse>;
(args: SendEosSignedTransaction): Promise<TransactResult>;
};
export declare type SendSignedTransactionArgs = SendSignedTransactionProps & {
tx?: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
} & SendEosSignedTransaction;
export declare type SendTransaction = {
(tx: string): Promise<AllResponses>;
(tx: string): Promise<ethers.providers.TransactionResponse>;
};
export declare type GetAddress = {
(): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Bitcoin;
coins?: BitcoinCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Ethereum;
coins?: EthereumCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Ripple;
coins?: RippleCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Stellar;
coins?: StellarCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.NEM;
coins?: NemCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Cardano;
coins?: CardanoCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Tezos;
coins?: TezosCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Eos;
coins?: EosCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks.Binance;
coins?: BinanceCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
(args: {
network?: Networks;
coins?: AllCoins[];
showOnTrezor?: boolean;
}): Promise<(string | undefined)[]>;
};
export declare type GetBalance = {
(args: GetBalanceProps | GetEosAccountInfoProps): Promise<number[]>;
};
export declare type Transfer = {
(args: TransferProps & {
network?: Networks.Bitcoin;
coin?: BitcoinCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Ethereum;
coin?: EthereumCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Ripple;
coin?: RippleCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Stellar;
coin?: StellarCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.NEM;
coin?: NemCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Cardano;
coin?: CardanoCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Tezos;
coin?: TezosCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Eos;
coin?: EosCoins;
}): Promise<AllResponses>;
(args: TransferProps & {
network?: Networks.Binance;
coin?: BinanceCoins;
}): Promise<AllResponses>;
(args: TransferToken): Promise<ethers.providers.TransactionResponse | null>;
({ coin, addressTo, value, from }: EosTransferProps): Promise<TransactResult | undefined>;
};
export declare type GetAccountInfo = {
(args: GetTrezorAccountInfo[]): Promise<AccountInfo[]>;
(accounts: GetBalanceProps[]): Promise<AccountInfo[]>;
(args: GetEosAccountInfoProps[]): Promise<AccountInfo[]>;
};
export interface WalletWrapper {
connectWallet(): Promise<string[]>;
getAddress: GetAddress;
getBalance: GetBalance;
getAccountInfo: GetAccountInfo;
sendSignedTransaction: SendSignedTransaction;
sendTransaction: SendTransaction;
transfer: Transfer;
addEventListener(event: ethers.providers.EventType, listener: ethers.providers.Listener): Promise<void>;
}
export interface IStandardContract {
getContract(): ethers.Contract;
getBalance(arg?: GetContractBalance): Promise<AccountInfo[]>;
transfer(args: TransferContractToken): Promise<Transaction>;
getTokenUri(tokenId: string): Promise<string>;
approve(args: ApproveToken): Promise<ethers.providers.TransactionResponse>;
setApprovalForAll(args: SetApprovalForAll): Promise<ethers.providers.TransactionResponse>;
transferEvents(): Observable<TransferEvent | null>;
}