@ledgerhq/coin-stellar
Version:
Ledger Stellar Coin integration
40 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.listOperations = void 0;
const network_1 = require("../network");
async function listOperations(address, { limit, cursor, order, minHeight }) {
// Fake accountId
const accountId = "";
const [operations, nextCursor] = await (0, network_1.fetchOperations)({
accountId,
addr: address,
minHeight,
order: order,
limit,
cursor: cursor,
});
return [operations.map(op => convertToCoreOperation(op)), nextCursor];
}
exports.listOperations = listOperations;
const convertToCoreOperation = (operation) => {
return {
id: `${operation.hash}-${operation.extra.index}`,
asset: { type: "native" },
tx: {
hash: operation.hash,
block: {
hash: operation.blockHash,
time: operation.extra.blockTime,
height: operation.blockHeight,
},
fees: BigInt(operation.fee.toString()),
date: operation.date,
},
type: operation.type,
value: BigInt(operation.value.toString()),
senders: operation.senders,
recipients: operation.recipients,
details: operation.extra.memo === undefined ? {} : { memo: operation.extra.memo },
};
};
//# sourceMappingURL=listOperations.js.map