UNPKG

stellar-plus

Version:

beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain

32 lines (31 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.simpleTxInvocationToFeebump = exports.simpleTxInvocation = exports.loadWasmFile = void 0; const tslib_1 = require("tslib"); const promises_1 = require("fs/promises"); const loadWasmFile = (wasmFilePath) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { try { const buffer = yield (0, promises_1.readFile)(wasmFilePath); return buffer; } catch (error) { console.error(`Error reading the WASM file: ${error}`); throw error; } }); exports.loadWasmFile = loadWasmFile; const simpleTxInvocation = (account) => { return { header: { source: account.getPublicKey(), fee: '10000000', timeout: 0, }, signers: [account], }; }; exports.simpleTxInvocation = simpleTxInvocation; const simpleTxInvocationToFeebump = (txInvocation) => { return Object.assign(Object.assign({}, txInvocation), { header: Object.assign(Object.assign({}, txInvocation.header), { fee: (Number(txInvocation.header.fee) * 10).toString() }) }); }; exports.simpleTxInvocationToFeebump = simpleTxInvocationToFeebump;