@secondlayer/sdk 6.44.0 → 6.46.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.
package/dist/index.d.ts CHANGED
@@ -1166,6 +1166,7 @@ type IndexUsage = {
1166
1166
  type FtTransfer = {
1167
1167
  cursor: string
1168
1168
  block_height: number
1169
+ block_time?: string | null
1169
1170
  tx_id: string
1170
1171
  tx_index: number
1171
1172
  event_index: number
@@ -1176,17 +1177,30 @@ type FtTransfer = {
1176
1177
  recipient: string
1177
1178
  amount: string
1178
1179
  };
1179
- type FtTransfersEnvelope = {
1180
- events: FtTransfer[]
1180
+ type FtTransfersEnvelope<TRow = FtTransfer> = {
1181
+ events: TRow[]
1181
1182
  next_cursor: string | null
1182
1183
  tip: IndexTip
1183
1184
  reorgs: IndexReorg[]
1184
1185
  };
1186
+ /** Transfer columns that survive any projection — the consume contract
1187
+ * (`cursor`, `block_height`) plus the `event_type` discriminant. */
1188
+ type FtTransferAlwaysFields = "cursor" | "block_height" | "event_type";
1189
+ /** An ft-transfer row narrowed to the requested columns plus the always-present ones. */
1190
+ type FtTransferFields<F extends keyof FtTransfer & string> = Pick<FtTransfer, (F | FtTransferAlwaysFields) & keyof FtTransfer>;
1185
1191
  type FtTransfersListParams = {
1192
+ /**
1193
+ * Columns to return. The server projects the row, so an unrequested column
1194
+ * is physically absent — and the narrowing overload on `list` makes reading
1195
+ * one a compile error rather than `undefined` at runtime. Omitting
1196
+ * `block_time` also lets the server skip the blocks join.
1197
+ */
1198
+ fields?: readonly (keyof FtTransfer & string)[]
1186
1199
  cursor?: string | null
1187
1200
  fromCursor?: string | null
1188
1201
  limit?: number
1189
1202
  contractId?: string
1203
+ assetIdentifier?: string
1190
1204
  sender?: string
1191
1205
  recipient?: string
1192
1206
  fromHeight?: number
@@ -1199,6 +1213,7 @@ type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & {
1199
1213
  type NftTransfer = {
1200
1214
  cursor: string
1201
1215
  block_height: number
1216
+ block_time?: string | null
1202
1217
  tx_id: string
1203
1218
  tx_index: number
1204
1219
  event_index: number
@@ -1209,13 +1224,19 @@ type NftTransfer = {
1209
1224
  recipient: string
1210
1225
  value: string
1211
1226
  };
1212
- type NftTransfersEnvelope = {
1213
- events: NftTransfer[]
1227
+ type NftTransfersEnvelope<TRow = NftTransfer> = {
1228
+ events: TRow[]
1214
1229
  next_cursor: string | null
1215
1230
  tip: IndexTip
1216
1231
  reorgs: IndexReorg[]
1217
1232
  };
1233
+ /** See {@link FtTransferAlwaysFields}. */
1234
+ type NftTransferAlwaysFields = "cursor" | "block_height" | "event_type";
1235
+ /** An nft-transfer row narrowed to the requested columns plus the always-present ones. */
1236
+ type NftTransferFields<F extends keyof NftTransfer & string> = Pick<NftTransfer, (F | NftTransferAlwaysFields) & keyof NftTransfer>;
1218
1237
  type NftTransfersListParams = {
1238
+ /** Columns to return (see {@link FtTransfersListParams.fields}). */
1239
+ fields?: readonly (keyof NftTransfer & string)[]
1219
1240
  cursor?: string | null
1220
1241
  fromCursor?: string | null
1221
1242
  limit?: number
@@ -2125,14 +2146,44 @@ interface Pox5Resource {
2125
2146
  * no amount filtering and no asset-slug resolution on /v1/index/ft-transfers.
2126
2147
  */
2127
2148
  interface FtTransfersResource {
2149
+ /** Narrowing overload for the callable shorthand — same wire path as
2150
+ * `list`, so it must narrow identically. */
2151
+ <const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
2152
+ fields: readonly F[]
2153
+ }): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
2128
2154
  (params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
2155
+ /** Narrowing overload: `fields` shrinks the row type to exactly the
2156
+ * requested columns plus {@link FtTransferAlwaysFields}. */
2157
+ list<const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
2158
+ fields: readonly F[]
2159
+ }): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
2129
2160
  list(params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
2161
+ /** Narrowing overload, matching `list`: `walk` forwards `fields` to the
2162
+ * wire, so without this the yielded rows are stripped while the type
2163
+ * still promises every column. */
2164
+ walk<const F extends keyof FtTransfer & string>(params: FtTransfersWalkParams & {
2165
+ fields: readonly F[]
2166
+ }): AsyncIterable<FtTransferFields<F>>;
2130
2167
  walk(params?: FtTransfersWalkParams): AsyncIterable<FtTransfer>;
2131
2168
  }
2132
2169
  /** `index.nftTransfers` — callable shorthand for `.list()` (see {@link FtTransfersResource}). */
2133
2170
  interface NftTransfersResource {
2171
+ /** Narrowing overload for the callable shorthand — same wire path as
2172
+ * `list`, so it must narrow identically. */
2173
+ <const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
2174
+ fields: readonly F[]
2175
+ }): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
2134
2176
  (params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
2177
+ /** Narrowing overload: `fields` shrinks the row type to exactly the
2178
+ * requested columns plus {@link NftTransferAlwaysFields}. */
2179
+ list<const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
2180
+ fields: readonly F[]
2181
+ }): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
2135
2182
  list(params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
2183
+ /** Narrowing overload, matching `list` (see {@link FtTransfersResource}). */
2184
+ walk<const F extends keyof NftTransfer & string>(params: NftTransfersWalkParams & {
2185
+ fields: readonly F[]
2186
+ }): AsyncIterable<NftTransferFields<F>>;
2136
2187
  walk(params?: NftTransfersWalkParams): AsyncIterable<NftTransfer>;
2137
2188
  }
2138
2189
  /** `index.events` — callable shorthand for `.list()`; `eventType` is required. */
package/dist/index.js CHANGED
@@ -1058,10 +1058,12 @@ class Index extends BaseClient {
1058
1058
  from_cursor: params.fromCursor,
1059
1059
  limit: params.limit,
1060
1060
  contract_id: params.contractId,
1061
+ asset_identifier: params.assetIdentifier,
1061
1062
  sender: params.sender,
1062
1063
  recipient: params.recipient,
1063
1064
  from_height: params.fromHeight,
1064
- to_height: params.toHeight
1065
+ to_height: params.toHeight,
1066
+ fields: params.fields?.join(",")
1065
1067
  })}`);
1066
1068
  }
1067
1069
  async listNftTransfers(params = {}) {
@@ -1074,7 +1076,8 @@ class Index extends BaseClient {
1074
1076
  sender: params.sender,
1075
1077
  recipient: params.recipient,
1076
1078
  from_height: params.fromHeight,
1077
- to_height: params.toHeight
1079
+ to_height: params.toHeight,
1080
+ fields: params.fields?.join(",")
1078
1081
  })}`);
1079
1082
  }
1080
1083
  async* keysetWalk(params, list, itemsOf) {
@@ -2884,5 +2887,5 @@ export {
2884
2887
  ApiError
2885
2888
  };
2886
2889
 
2887
- //# debugId=2212082A9E39DB7664756E2164756E21
2890
+ //# debugId=558D930AE661BCE364756E2164756E21
2888
2891
  //# sourceMappingURL=index.js.map