@ledgerhq/coin-stellar
Version:
Ledger Stellar Coin integration
36 lines • 1.22 kB
JavaScript
import { fetchOperations } from "../network";
export async function listOperations(address, { limit, cursor, order, minHeight }) {
// Fake accountId
const accountId = "";
const [operations, nextCursor] = await fetchOperations({
accountId,
addr: address,
minHeight,
order: order,
limit,
cursor: cursor,
});
return [operations.map(op => convertToCoreOperation(op)), nextCursor];
}
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