UNPKG

fiosdk-offline

Version:

The Foundation for Interwallet Operability (FIO) is a consortium of leading blockchain wallets, exchanges and payments providers that seeks to accelerate blockchain adoption by reducing the risk, complexity, and inconvenience of sending and receiving cryp

33 lines (25 loc) 747 B
import { Transactions } from '../Transactions' export abstract class Query<T> extends Transactions { abstract ENDPOINT: string abstract getData(): any decrypt(result: any): any { } isEncrypted = false async execute(publicKey: string, privateKey: string = ''): Promise<any> { this.publicKey = publicKey this.privateKey = privateKey if (!this.isEncrypted) { return this.executeCall(this.getEndPoint(), JSON.stringify(this.getData())) } else { try { const result = await this.executeCall(this.getEndPoint(), JSON.stringify(this.getData())) return this.decrypt(result) } catch (error) { throw error } } } getEndPoint(): string { return this.ENDPOINT } }