Skip to content

Commit 462f431

Browse files
authored
Merge pull request #412 from MJigah/feature/field-selection
Add field selection (projection) to SDK read methods
2 parents 86540d8 + 213a801 commit 462f431

2 files changed

Lines changed: 25 additions & 20 deletions

File tree

src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { compilePaymentReceipt } from "./receipt.js";
6060
import type { PaymentReceipt } from "./receipt.js";
6161
import type {
6262
ArchivedInvoice,
63+
6364
ArbiterVote,
6465
AuctionInfo,
6566
DisputeStatus,
@@ -1483,7 +1484,9 @@ export class StellarSplitClient {
14831484
invoiceId: string,
14841485
opts?: { retry?: PerMethodRetryOptions; dedupe?: boolean; traceId?: string; timeout?: number }
14851486
): Promise<Invoice> {
1487+
14861488
return this._withCache("getInvoice", [invoiceId], async () => {
1489+
14871490
const fetcher = this._batcher
14881491
? () => this._batcher!.getInvoice(invoiceId)
14891492
: () => this._fetchInvoice(invoiceId, opts?.traceId);

src/types.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,27 @@ export interface Invoice {
183183
*/
184184
export type SplitRule =
185185
| {
186-
/** Recipient receives a fixed amount in stroops (capped at remaining funds). */
187-
kind: "Fixed";
188-
recipient: string;
189-
amount: bigint;
190-
}
186+
/** Recipient receives a fixed amount in stroops (capped at remaining funds). */
187+
kind: "Fixed";
188+
recipient: string;
189+
amount: bigint;
190+
}
191191
| {
192-
/** Recipient receives `bps` basis points of the funded amount. */
193-
kind: "Percentage";
194-
recipient: string;
195-
bps: number;
196-
}
192+
/** Recipient receives `bps` basis points of the funded amount. */
193+
kind: "Percentage";
194+
recipient: string;
195+
bps: number;
196+
}
197197
| {
198-
/**
199-
* Recipient receives a marginal-band share: for each tier, `bps` is
200-
* applied to the portion of funds falling between the previous tier's
201-
* `upTo` and this tier's `upTo`.
202-
*/
203-
kind: "Tiered";
204-
recipient: string;
205-
tiers: { upTo: bigint; bps: number }[];
206-
};
198+
/**
199+
* Recipient receives a marginal-band share: for each tier, `bps` is
200+
* applied to the portion of funds falling between the previous tier's
201+
* `upTo` and this tier's `upTo`.
202+
*/
203+
kind: "Tiered";
204+
recipient: string;
205+
tiers: { upTo: bigint; bps: number }[];
206+
};
207207

208208
/** A single recipient's previewed payout under the configured split rules. */
209209
export interface SplitPreviewEntry {
@@ -533,6 +533,9 @@ export interface CloneOverrides {
533533
newOverflowBehavior?: OverflowBehavior;
534534
}
535535

536+
/** Field names supported by read methods that can return partial objects. */
537+
export type InvoiceField = keyof Invoice;
538+
536539
/** Extended invoice data from get_invoice_ext. */
537540
export interface InvoiceExt {
538541
parentInvoiceId: string | null;
@@ -790,4 +793,3 @@ export interface SetCrossChainRefParams {
790793
/** Cross-chain reference data. */
791794
ref: CrossChainRef;
792795
}
793-

0 commit comments

Comments
 (0)