UNPKG

@mcchadwick/fiosdk

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

42 lines (41 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PendingFioRequests = void 0; const Query_1 = require("./Query"); class PendingFioRequests extends Query_1.Query { constructor(fioPublicKey, limit = null, offset = null) { super(); this.ENDPOINT = 'chain/get_pending_fio_requests'; this.isEncrypted = true; this.fioPublicKey = fioPublicKey; this.limit = limit; this.offset = offset; } getData() { const data = { fio_public_key: this.fioPublicKey, limit: this.limit || null, offset: this.offset || null }; return data; } decrypt(result) { if (result.requests.length > 0) { const requests = []; result.requests.forEach((value) => { try { let content; if (value.payer_fio_public_key === this.publicKey) { content = this.getUnCipherContent('new_funds_content', value.content, this.privateKey, value.payee_fio_public_key); } else { content = this.getUnCipherContent('new_funds_content', value.content, this.privateKey, value.payer_fio_public_key); } value.content = content; requests.push(value); } catch (e) { // } }); return { requests, more: result.more }; } } } exports.PendingFioRequests = PendingFioRequests;