@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.
@@ -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,17 +1089,30 @@ 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
1101
1114
  contractId?: string
1115
+ assetIdentifier?: string
1102
1116
  sender?: string
1103
1117
  recipient?: string
1104
1118
  fromHeight?: number
@@ -1111,6 +1125,7 @@ type FtTransfersWalkParams = Omit<FtTransfersListParams, "limit"> & {
1111
1125
  type NftTransfer = {
1112
1126
  cursor: string
1113
1127
  block_height: number
1128
+ block_time?: string | null
1114
1129
  tx_id: string
1115
1130
  tx_index: number
1116
1131
  event_index: number
@@ -1121,13 +1136,19 @@ type NftTransfer = {
1121
1136
  recipient: string
1122
1137
  value: string
1123
1138
  };
1124
- type NftTransfersEnvelope = {
1125
- events: NftTransfer[]
1139
+ type NftTransfersEnvelope<TRow = NftTransfer> = {
1140
+ events: TRow[]
1126
1141
  next_cursor: string | null
1127
1142
  tip: IndexTip
1128
1143
  reorgs: IndexReorg[]
1129
1144
  };
1145
+ /** See {@link FtTransferAlwaysFields}. */
1146
+ type NftTransferAlwaysFields = "cursor" | "block_height" | "event_type";
1147
+ /** An nft-transfer row narrowed to the requested columns plus the always-present ones. */
1148
+ type NftTransferFields<F extends keyof NftTransfer & string> = Pick<NftTransfer, (F | NftTransferAlwaysFields) & keyof NftTransfer>;
1130
1149
  type NftTransfersListParams = {
1150
+ /** Columns to return (see {@link FtTransfersListParams.fields}). */
1151
+ fields?: readonly (keyof NftTransfer & string)[]
1131
1152
  cursor?: string | null
1132
1153
  fromCursor?: string | null
1133
1154
  limit?: number
@@ -2037,14 +2058,44 @@ interface Pox5Resource {
2037
2058
  * no amount filtering and no asset-slug resolution on /v1/index/ft-transfers.
2038
2059
  */
2039
2060
  interface FtTransfersResource {
2061
+ /** Narrowing overload for the callable shorthand — same wire path as
2062
+ * `list`, so it must narrow identically. */
2063
+ <const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
2064
+ fields: readonly F[]
2065
+ }): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
2040
2066
  (params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
2067
+ /** Narrowing overload: `fields` shrinks the row type to exactly the
2068
+ * requested columns plus {@link FtTransferAlwaysFields}. */
2069
+ list<const F extends keyof FtTransfer & string>(params: FtTransfersListParams & {
2070
+ fields: readonly F[]
2071
+ }): Promise<FtTransfersEnvelope<FtTransferFields<F>>>;
2041
2072
  list(params?: FtTransfersListParams): Promise<FtTransfersEnvelope>;
2073
+ /** Narrowing overload, matching `list`: `walk` forwards `fields` to the
2074
+ * wire, so without this the yielded rows are stripped while the type
2075
+ * still promises every column. */
2076
+ walk<const F extends keyof FtTransfer & string>(params: FtTransfersWalkParams & {
2077
+ fields: readonly F[]
2078
+ }): AsyncIterable<FtTransferFields<F>>;
2042
2079
  walk(params?: FtTransfersWalkParams): AsyncIterable<FtTransfer>;
2043
2080
  }
2044
2081
  /** `index.nftTransfers` — callable shorthand for `.list()` (see {@link FtTransfersResource}). */
2045
2082
  interface NftTransfersResource {
2083
+ /** Narrowing overload for the callable shorthand — same wire path as
2084
+ * `list`, so it must narrow identically. */
2085
+ <const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
2086
+ fields: readonly F[]
2087
+ }): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
2046
2088
  (params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
2089
+ /** Narrowing overload: `fields` shrinks the row type to exactly the
2090
+ * requested columns plus {@link NftTransferAlwaysFields}. */
2091
+ list<const F extends keyof NftTransfer & string>(params: NftTransfersListParams & {
2092
+ fields: readonly F[]
2093
+ }): Promise<NftTransfersEnvelope<NftTransferFields<F>>>;
2047
2094
  list(params?: NftTransfersListParams): Promise<NftTransfersEnvelope>;
2095
+ /** Narrowing overload, matching `list` (see {@link FtTransfersResource}). */
2096
+ walk<const F extends keyof NftTransfer & string>(params: NftTransfersWalkParams & {
2097
+ fields: readonly F[]
2098
+ }): AsyncIterable<NftTransferFields<F>>;
2048
2099
  walk(params?: NftTransfersWalkParams): AsyncIterable<NftTransfer>;
2049
2100
  }
2050
2101
  /** `index.events` — callable shorthand for `.list()`; `eventType` is required. */
@@ -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) {
@@ -2188,5 +2191,5 @@ export {
2188
2191
  Subgraphs
2189
2192
  };
2190
2193
 
2191
- //# debugId=228E6E1BCAEED70464756E2164756E21
2194
+ //# debugId=D9B14FC081B552ED64756E2164756E21
2192
2195
  //# sourceMappingURL=index.js.map