Skip to content

Commit

Permalink
stellar#135: remove un-necessary promise usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Oct 10, 2023
1 parent 75dc600 commit e6e944a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,11 @@ export class Server {
public async _getLedgerEntries(
...keys: xdr.LedgerKey[]
): Promise<SorobanRpc.RawGetLedgerEntriesResponse> {
return mergeResponseExpirationLedgers(
jsonrpc.post<SorobanRpc.RawGetLedgerEntriesResponse>(
return jsonrpc.post<SorobanRpc.RawGetLedgerEntriesResponse>(
this.serverURL.toString(),
"getLedgerEntries",
expandRequestIncludeExpirationLedgers(keys).map((k) => k.toXDR("base64")),
), keys);
).then(response => mergeResponseExpirationLedgers(response, keys));
}

/**
Expand Down Expand Up @@ -758,10 +757,9 @@ function findCreatedAccountSequenceInTransactionMeta(
// TODO - remove once rpc updated to
// append expiration entry per data LK requested onto server-side response
// https://github.com/stellar/soroban-tools/issues/1010
async function mergeResponseExpirationLedgers(response: Promise<SorobanRpc.RawGetLedgerEntriesResponse>,
function mergeResponseExpirationLedgers(ledgerEntriesResponse: SorobanRpc.RawGetLedgerEntriesResponse,
requestedKeys: xdr.LedgerKey[]
): Promise<SorobanRpc.RawGetLedgerEntriesResponse> {
let ledgerEntriesResponse = await response;
): SorobanRpc.RawGetLedgerEntriesResponse {
const expirationKeyToRawEntryResult:Map<String, SorobanRpc.RawLedgerEntryResult> = new Map();
const requestedKeyXdrs = new Set<String>(requestedKeys.map(requestedKey =>
requestedKey.toXDR('base64')));
Expand Down

0 comments on commit e6e944a

Please sign in to comment.