@secondlayer/sdk 15.4.2 → 15.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1747,6 +1747,13 @@ type FtTransfersEnvelope<TRow = FtTransfer> = {
1747
1747
  type FtTransferAlwaysFields = "cursor" | "block_height" | "event_type";
1748
1748
  /** An ft-transfer row narrowed to the requested columns plus the always-present ones. */
1749
1749
  type FtTransferFields<F extends keyof FtTransfer & string> = Pick<FtTransfer, (F | FtTransferAlwaysFields) & keyof FtTransfer>;
1750
+ /**
1751
+ * Read direction for decoded-event lists. `"asc"` (default) reads oldest
1752
+ * first. `"desc"` reads newest first: with no height range, page one is the
1753
+ * newest rows of the last day, and `next_cursor` pages older. A cursor only
1754
+ * resumes under the order that issued it; the API refuses the other order.
1755
+ */
1756
+ type IndexOrder = "asc" | "desc";
1750
1757
  /** Column selection, paging, and filters for listing token transfers. */
1751
1758
  type FtTransfersListParams = {
1752
1759
  /**
@@ -1765,6 +1772,8 @@ type FtTransfersListParams = {
1765
1772
  recipient?: string;
1766
1773
  fromHeight?: number;
1767
1774
  toHeight?: number;
1775
+ /** `"desc"` reads newest first. See {@link IndexOrder}. */
1776
+ order?: IndexOrder;
1768
1777
  };
1769
1778
  /** Options every `walk*` feed shares on top of its list filters. Page fetches
1770
1779
  * retry with the same `retryCount`/`retryDelay`/`onError` vocabulary as
@@ -1820,6 +1829,8 @@ type NftTransfersListParams = {
1820
1829
  recipient?: string;
1821
1830
  fromHeight?: number;
1822
1831
  toHeight?: number;
1832
+ /** `"desc"` reads newest first. See {@link IndexOrder}. */
1833
+ order?: IndexOrder;
1823
1834
  };
1824
1835
  /** `NftTransfersListParams` without `limit`, plus walk options. */
1825
1836
  type NftTransfersWalkParams = Omit<NftTransfersListParams, "limit"> & WalkOptions;
@@ -2006,6 +2017,8 @@ type EventsListParams<T extends IndexEventType = IndexEventType> = {
2006
2017
  txId?: string;
2007
2018
  fromHeight?: number;
2008
2019
  toHeight?: number;
2020
+ /** `"desc"` reads newest first. See {@link IndexOrder}. */
2021
+ order?: IndexOrder;
2009
2022
  /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
2010
2023
  * Mutually exclusive with contractId; contract-keyed event types only. */
2011
2024
  trait?: string;
@@ -2035,7 +2048,7 @@ type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsLi
2035
2048
  type EventsConsumeParams<
2036
2049
  T extends IndexEventType = IndexEventType,
2037
2050
  TTx = never
2038
- > = Omit<EventsListParams<T>, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexEventOf<T>, EventsEnvelope<T>, TTx>;
2051
+ > = Omit<EventsListParams<T>, "cursor" | "fromCursor" | "limit" | "fields" | "order"> & IndexConsumeOptions<IndexEventOf<T>, EventsEnvelope<T>, TTx>;
2039
2052
  /** A decoded contract call: contract, function, sender, arguments, result. */
2040
2053
  type IndexContractCall = {
2041
2054
  cursor: string;
@@ -3215,7 +3228,7 @@ interface FtTransfersResource {
3215
3228
  /**
3216
3229
  * Read one page of fungible-token transfers, plus the cursor for the next.
3217
3230
  *
3218
- * Filter by `contractId`, `assetIdentifier`, `sender`, `recipient`, and a height range. Filters are equality only: there is no amount filter. Pass `next_cursor` back as `cursor` to continue. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `event_type` always come back. `reorgs` on the envelope lists forks that overlap the page.
3231
+ * Filter by `contractId`, `assetIdentifier`, `sender`, `recipient`, and a height range. Filters are equality only: there is no amount filter. `order: "desc"` reads newest first. Pass `next_cursor` back as `cursor` to continue. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `event_type` always come back. `reorgs` on the envelope lists forks that overlap the page.
3219
3232
  */
3220
3233
  list<const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
3221
3234
  fields: readonly F[];
@@ -3224,7 +3237,7 @@ interface FtTransfersResource {
3224
3237
  /**
3225
3238
  * Iterate every fungible-token transfer, paging for you.
3226
3239
  *
3227
- * Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
3240
+ * Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip, or with `order: "desc"` when it reaches `fromHeight` (genesis by default). `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
3228
3241
  */
3229
3242
  walk<const F extends keyof FtTransfer & string>(params: FtTransfersWalkParams & {
3230
3243
  fields: readonly F[];
@@ -3242,7 +3255,7 @@ interface NftTransfersResource {
3242
3255
  /**
3243
3256
  * Read one page of NFT transfers, plus the cursor for the next.
3244
3257
  *
3245
- * Filter by `contractId`, `assetIdentifier`, `sender`, `recipient`, and a height range. Pass `next_cursor` back as `cursor` to continue. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `event_type` always come back.
3258
+ * Filter by `contractId`, `assetIdentifier`, `sender`, `recipient`, and a height range. `order: "desc"` reads newest first. Pass `next_cursor` back as `cursor` to continue. `fields` returns only those columns and narrows the row type; `cursor`, `block_height`, and `event_type` always come back.
3246
3259
  */
3247
3260
  list<const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
3248
3261
  fields: readonly F[];
@@ -3251,7 +3264,7 @@ interface NftTransfersResource {
3251
3264
  /**
3252
3265
  * Iterate every NFT transfer, paging for you.
3253
3266
  *
3254
- * Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
3267
+ * Takes the same filters as `list`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip, or with `order: "desc"` when it reaches `fromHeight` (genesis by default). `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
3255
3268
  */
3256
3269
  walk<const F extends keyof NftTransfer & string>(params: NftTransfersWalkParams & {
3257
3270
  fields: readonly F[];
@@ -3272,7 +3285,7 @@ interface IndexEventsResource {
3272
3285
  /**
3273
3286
  * Read one page of decoded events of one type.
3274
3287
  *
3275
- * `eventType` is required: a decoded type (`ft_transfer`, `print`, ...) or a VM type (`nested_contract_call`, `map_set`, ...), and a literal narrows the row type. Scope with `contractId` (one id or up to 20) or `trait`, never both, plus `assetIdentifier`, `sender`, `recipient`, `functionName`, `caller`, `map`, `varName`, `txId`, and a height range. `txContext: true` joins the submitting transaction onto each event. `fields` returns only those columns and narrows the row type; it saves wire bytes but does not change what you are billed, since rows are metered, not columns.
3288
+ * `eventType` is required: a decoded type (`ft_transfer`, `print`, ...) or a VM type (`nested_contract_call`, `map_set`, ...), and a literal narrows the row type. Scope with `contractId` (one id or up to 20) or `trait`, never both, plus `assetIdentifier`, `sender`, `recipient`, `functionName`, `caller`, `map`, `varName`, `txId`, and a height range. `order: "desc"` reads newest first. `txContext: true` joins the submitting transaction onto each event. `fields` returns only those columns and narrows the row type; it saves wire bytes but does not change what you are billed, since rows are metered, not columns.
3276
3289
  */
3277
3290
  list<
3278
3291
  T extends IndexEventType,
@@ -3284,7 +3297,7 @@ interface IndexEventsResource {
3284
3297
  /**
3285
3298
  * Iterate every decoded event of one type, paging for you.
3286
3299
  *
3287
- * Takes the same filters as `list`, including `eventType`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip. `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
3300
+ * Takes the same filters as `list`, including `eventType`. Not a live index: it does not checkpoint, ignores reorgs, and ends when it catches the tip, or with `order: "desc"` when it reaches `fromHeight` (genesis by default). `batchSize` defaults to 200 (max 1000); page fetches retry on 429 and 5xx; aborting `signal` rejects the iterator.
3288
3301
  */
3289
3302
  walk<
3290
3303
  T extends IndexEventType,
@@ -1666,7 +1666,8 @@ function indexPageQuery(params) {
1666
1666
  limit: params.limit,
1667
1667
  from_height: params.fromHeight,
1668
1668
  to_height: params.toHeight,
1669
- fields: params.fields
1669
+ fields: params.fields,
1670
+ order: params.order
1670
1671
  };
1671
1672
  }
1672
1673
 
@@ -2842,5 +2843,5 @@ export {
2842
2843
  getSubgraph
2843
2844
  };
2844
2845
 
2845
- //# debugId=B52CC2088456848264756E2164756E21
2846
+ //# debugId=9138C23A8DEF74B764756E2164756E21
2846
2847
  //# sourceMappingURL=index.js.map