@secondlayer/sdk 6.44.0 → 6.45.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.
@@ -1078,6 +1078,7 @@ type IndexUsage = {
1078
1078
  type FtTransfer = {
1079
1079
  cursor: string
1080
1080
  block_height: number
1081
+ block_time?: string | null
1081
1082
  tx_id: string
1082
1083
  tx_index: number
1083
1084
  event_index: number
@@ -1088,13 +1089,25 @@ type FtTransfer = {
1088
1089
  recipient: string
1089
1090
  amount: string
1090
1091
  };
1091
- type FtTransfersEnvelope = {
1092
- events: FtTransfer[]
1092
+ type FtTransfersEnvelope<TRow = FtTransfer> = {
1093
+ events: TRow[]
1093
1094
  next_cursor: string | null
1094
1095
  tip: IndexTip
1095
1096
  reorgs: IndexReorg[]
1096
1097
  };
1098
+ /** Transfer columns that survive any projection — the consume contract
1099
+ * (`cursor`, `block_height`) plus the `event_type` discriminant. */
1100
+ type FtTransferAlwaysFields = "cursor" | "block_height" | "event_type";
1101
+ /** An ft-transfer row narrowed to the requested columns plus the always-present ones. */
1102
+ type FtTransferFields<F extends keyof FtTransfer & string> = Pick<FtTransfer, (F | FtTransferAlwaysFields) & keyof FtTransfer>;
1097
1103
  type FtTransfersListParams = {
1104
+ /**
1105
+ * Columns to return. The server projects the row, so an unrequested column
1106
+ * is physically absent — and the narrowing overload on `list` makes reading
1107
+ * one a compile error rather than `undefined` at runtime. Omitting
1108
+ * `block_time` also lets the server skip the blocks join.
1109
+ */
1110
+ fields?: readonly (keyof FtTransfer & string)[]
1098
1111
  cursor?: string | null
1099
1112
  fromCursor?: string | null
1100
1113
  limit?: number
@@ -1111,6 +1124,7 @@ type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & {
1111
1124
  type NftTransfer = {
1112
1125
  cursor: string
1113
1126
  block_height: number
1127
+ block_time?: string | null
1114
1128
  tx_id: string
1115
1129
  tx_index: number
1116
1130
  event_index: number
@@ -1121,13 +1135,19 @@ type NftTransfer = {
1121
1135
  recipient: string
1122
1136
  value: string
1123
1137
  };
1124
- type NftTransfersEnvelope = {
1125
- events: NftTransfer[]
1138
+ type NftTransfersEnvelope<TRow = NftTransfer> = {
1139
+ events: TRow[]
1126
1140
  next_cursor: string | null
1127
1141
  tip: IndexTip
1128
1142
  reorgs: IndexReorg[]
1129
1143
  };
1144
+ /** See {@link FtTransferAlwaysFields}. */
1145
+ type NftTransferAlwaysFields = "cursor" | "block_height" | "event_type";
1146
+ /** An nft-transfer row narrowed to the requested columns plus the always-present ones. */
1147
+ type NftTransferFields<F extends keyof NftTransfer & string> = Pick<NftTransfer, (F | NftTransferAlwaysFields) & keyof NftTransfer>;
1130
1148
  type NftTransfersListParams = {
1149
+ /** Columns to return (see {@link FtTransfersListParams.fields}). */
1150
+ fields?: readonly (keyof NftTransfer & string)[]
1131
1151
  cursor?: string | null
1132
1152
  fromCursor?: string | null
1133
1153
  limit?: number
@@ -2037,14 +2057,44 @@ interface Pox5Resource {
2037
2057
  * no amount filtering and no asset-slug resolution on /v1/index/ft-transfers.
2038
2058
  */
2039
2059
  interface FtTransfersResource {
2060
+ /** Narrowing overload for the callable shorthand — same wire path as
2061
+ * `list`, so it must narrow identically. */
2062
+ <const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
2063
+ fields: readonly F[]
2064
+ }): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
2040
2065
  (params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
2066
+ /** Narrowing overload: `fields` shrinks the row type to exactly the
2067
+ * requested columns plus {@link FtTransferAlwaysFields}. */
2068
+ list<const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
2069
+ fields: readonly F[]
2070
+ }): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
2041
2071
  list(params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
2072
+ /** Narrowing overload, matching `list`: `walk` forwards `fields` to the
2073
+ * wire, so without this the yielded rows are stripped while the type
2074
+ * still promises every column. */
2075
+ walk<const F extends keyof FtTransfer & string>(params: FtTransfersWalkParams & {
2076
+ fields: readonly F[]
2077
+ }): AsyncIterable<FtTransferFields<F>>;
2042
2078
  walk(params?: FtTransfersWalkParams): AsyncIterable<FtTransfer>;
2043
2079
  }
2044
2080
  /** `index.nftTransfers` — callable shorthand for `.list()` (see {@link FtTransfersResource}). */
2045
2081
  interface NftTransfersResource {
2082
+ /** Narrowing overload for the callable shorthand — same wire path as
2083
+ * `list`, so it must narrow identically. */
2084
+ <const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
2085
+ fields: readonly F[]
2086
+ }): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
2046
2087
  (params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
2088
+ /** Narrowing overload: `fields` shrinks the row type to exactly the
2089
+ * requested columns plus {@link NftTransferAlwaysFields}. */
2090
+ list<const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
2091
+ fields: readonly F[]
2092
+ }): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
2047
2093
  list(params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
2094
+ /** Narrowing overload, matching `list` (see {@link FtTransfersResource}). */
2095
+ walk<const F extends keyof NftTransfer & string>(params: NftTransfersWalkParams & {
2096
+ fields: readonly F[]
2097
+ }): AsyncIterable<NftTransferFields<F>>;
2048
2098
  walk(params?: NftTransfersWalkParams): AsyncIterable<NftTransfer>;
2049
2099
  }
2050
2100
  /** `index.events` — callable shorthand for `.list()`; `eventType` is required. */
@@ -1061,7 +1061,8 @@ class Index extends BaseClient {
1061
1061
  sender: params.sender,
1062
1062
  recipient: params.recipient,
1063
1063
  from_height: params.fromHeight,
1064
- to_height: params.toHeight
1064
+ to_height: params.toHeight,
1065
+ fields: params.fields?.join(",")
1065
1066
  })}`);
1066
1067
  }
1067
1068
  async listNftTransfers(params = {}) {
@@ -1074,7 +1075,8 @@ class Index extends BaseClient {
1074
1075
  sender: params.sender,
1075
1076
  recipient: params.recipient,
1076
1077
  from_height: params.fromHeight,
1077
- to_height: params.toHeight
1078
+ to_height: params.toHeight,
1079
+ fields: params.fields?.join(",")
1078
1080
  })}`);
1079
1081
  }
1080
1082
  async* keysetWalk(params, list, itemsOf) {
@@ -2188,5 +2190,5 @@ export {
2188
2190
  Subgraphs
2189
2191
  };
2190
2192
 
2191
- //# debugId=228E6E1BCAEED70464756E2164756E21
2193
+ //# debugId=2CB03593632F542B64756E2164756E21
2192
2194
  //# sourceMappingURL=index.js.map