@ledgerhq/coin-stellar
Version:
Ledger Stellar Coin integration
39 lines • 1.38 kB
JavaScript
;
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.listOperations = listOperations;
const network_1 = require("../network");
async function listOperations(address, { limit, cursor, order, minHeight }) {
// Fake accountId
const accountId = '';
const { items: operations, next: nextCursor } = await (0, network_1.fetchOperations)({
accountId,
addr: address,
minHeight,
order: order || 'desc',
limit,
cursor: cursor,
});
const mappedOperations = operations.map((op) => convertToLegacyOperation(op));
return { items: mappedOperations, next: nextCursor };
}
function convertToLegacyOperation(operation) {
const details = operation.details;
return {
id: `${operation.tx.hash}-${details?.index ?? ''}`,
asset: operation.asset,
tx: operation.tx,
details: {
sequence: details?.sequence,
ledgerOpType: details?.ledgerOpType,
assetAmount: details?.assetAmount ?? operation.value.toString(),
memo: details?.memo,
},
type: operation.type,
value: operation.value,
senders: operation.senders,
recipients: operation.recipients,
};
}
//# sourceMappingURL=listOperations.js.map