Skip to content

Type for rpc.Api.GetTransactionsRequest is wrong #1160

@fnando

Description

@fnando

Describe the bug

Type for rpc.Api.GetTransactionsRequest is wrong

export interface GetTransactionsRequest {
  startLedger: number;
  cursor?: string;
  limit?: number;
}

The documentation states that startLedger can be omitted if cursor is present.

Ledger sequence number to start fetching responses from (inclusive). This method will return an error if startLedger is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request, startLedger must be omitted.

What version are you on?

13.0.0

To Reproduce

Doing something like

const params: StellarRpc.Api.GetTransactionsRequest = { cursor: "asdf" };

will fail with this:

error TS2741: Property 'startLedger' is missing in type '{ cursor: string; }' but required in type 'GetTransactionsRequest'.

23       const params: StellarRpc.Api.GetTransactionsRequest = { cursor: "asdf" };
               ~~~~~~

  node_modules/@stellar/stellar-sdk/lib/rpc/api.d.ts:104:9
    104         startLedger: number;
                ~~~~~~~~~~~
    'startLedger' is declared here.

Expected behavior

startLedger should be optional when cursor is present.

Metadata

Metadata

Assignees

Type

Projects

Status

In Progress

Status

Backlog (Not Ready)

Relationships

None yet

Development

No branches or pull requests

Issue actions