@secondlayer/sdk 6.54.1 → 8.0.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.
@@ -1,356 +1,3 @@
1
- import { StreamsEventType } from "@secondlayer/shared";
2
- /** A Clarity value as Streams serves it: the canonical hex string, a typed
3
- * object carrying that hex (`{ hex }`), or a decoded Clarity-JSON object.
4
- * Decode helpers (`decodeNftTransfer`, etc.) resolve it to a concrete value. */
5
- type StreamsClarityValue = string | {
6
- hex: string;
7
- } | Record<string, unknown>;
8
- type StxTransferPayload = {
9
- sender: string;
10
- recipient: string;
11
- amount: string;
12
- memo?: string;
13
- };
14
- type StxMintPayload = {
15
- recipient: string;
16
- amount: string;
17
- };
18
- type StxBurnPayload = {
19
- sender: string;
20
- amount: string;
21
- };
22
- type StxLockPayload = {
23
- locked_address: string;
24
- locked_amount: string;
25
- unlock_height: string;
26
- };
27
- type FtTransferPayload = {
28
- asset_identifier: string;
29
- sender: string;
30
- recipient: string;
31
- amount: string;
32
- };
33
- type FtMintPayload = {
34
- asset_identifier: string;
35
- recipient: string;
36
- amount: string;
37
- };
38
- type FtBurnPayload = {
39
- asset_identifier: string;
40
- sender: string;
41
- amount: string;
42
- };
43
- type NftTransferPayload = {
44
- asset_identifier: string;
45
- sender: string;
46
- recipient: string;
47
- value: StreamsClarityValue;
48
- /** Canonical serialized hex of `value`, when the stream carries it. */
49
- raw_value?: string;
50
- };
51
- type NftMintPayload = {
52
- asset_identifier: string;
53
- recipient: string;
54
- value: StreamsClarityValue;
55
- raw_value?: string;
56
- };
57
- type NftBurnPayload = {
58
- asset_identifier: string;
59
- sender: string;
60
- value: StreamsClarityValue;
61
- raw_value?: string;
62
- };
63
- type PrintPayload = {
64
- contract_id?: string | null;
65
- topic?: string;
66
- value?: unknown;
67
- raw_value?: string;
68
- };
69
- type StreamsEventBase = {
70
- /**
71
- * Globally unique, monotonic position of this event (`<block>:<index>`). Use
72
- * it as the primary key of your projection rows — replaying a batch then
73
- * upserts cleanly. Don't synthesize your own id from `tx_id`/`event_index`.
74
- */
75
- cursor: string;
76
- block_height: number;
77
- block_hash: string;
78
- burn_block_height: number;
79
- tx_id: string;
80
- tx_index: number;
81
- event_index: number;
82
- contract_id: string | null;
83
- ts: string;
84
- /**
85
- * True when this event's block is past the finality boundary (immutable).
86
- * Optional for back-compat; the API always sets it on Streams responses.
87
- */
88
- finalized?: boolean;
89
- /**
90
- * Labels whose filter group this event satisfied, present only when the
91
- * request used a labelled `filters` map. The SDK dispatches on it for you
92
- * (`on.<label>`), so handlers rarely read it directly.
93
- */
94
- matched?: string[];
95
- };
96
- type StreamsEventOf<
97
- T extends StreamsEventType,
98
- P
99
- > = StreamsEventBase & {
100
- event_type: T;
101
- payload: P;
102
- };
103
- /** A raw Streams event. Discriminated on `event_type`, so `event.payload`
104
- * narrows to the matching payload shape once the type is checked. */
105
- type StreamsEvent = StreamsEventOf<"stx_transfer", StxTransferPayload> | StreamsEventOf<"stx_mint", StxMintPayload> | StreamsEventOf<"stx_burn", StxBurnPayload> | StreamsEventOf<"stx_lock", StxLockPayload> | StreamsEventOf<"ft_transfer", FtTransferPayload> | StreamsEventOf<"ft_mint", FtMintPayload> | StreamsEventOf<"ft_burn", FtBurnPayload> | StreamsEventOf<"nft_transfer", NftTransferPayload> | StreamsEventOf<"nft_mint", NftMintPayload> | StreamsEventOf<"nft_burn", NftBurnPayload> | StreamsEventOf<"print", PrintPayload>;
106
- type FtTransferEvent = Extract<StreamsEvent, {
107
- event_type: "ft_transfer";
108
- }>;
109
- type DecodedFtTransferPayload = {
110
- asset_identifier: string;
111
- contract_id: string;
112
- token_name: string | null;
113
- sender: string;
114
- recipient: string;
115
- amount: string;
116
- };
117
- type DecodedFtTransfer = {
118
- cursor: string;
119
- block_height: number;
120
- tx_id: string;
121
- tx_index: number;
122
- event_index: number;
123
- event_type: "ft_transfer";
124
- decoded_payload: DecodedFtTransferPayload;
125
- source_cursor: string;
126
- };
127
- declare function isFtTransfer(event: StreamsEvent): event is FtTransferEvent;
128
- declare function decodeFtTransfer(event: StreamsEvent): DecodedFtTransfer;
129
- type NftTransferEvent = Extract<StreamsEvent, {
130
- event_type: "nft_transfer";
131
- }>;
132
- type DecodedNftTransferPayload = {
133
- asset_identifier: string;
134
- contract_id: string;
135
- token_name: string | null;
136
- sender: string;
137
- recipient: string;
138
- value: string;
139
- };
140
- type DecodedNftTransfer = {
141
- cursor: string;
142
- block_height: number;
143
- tx_id: string;
144
- tx_index: number;
145
- event_index: number;
146
- event_type: "nft_transfer";
147
- decoded_payload: DecodedNftTransferPayload;
148
- source_cursor: string;
149
- };
150
- declare function isNftTransfer(event: StreamsEvent): event is NftTransferEvent;
151
- declare function decodeNftTransfer(event: StreamsEvent): DecodedNftTransfer;
152
- type DecodedStxTransferPayload = {
153
- sender: string;
154
- recipient: string;
155
- amount: string;
156
- memo: string | null;
157
- };
158
- type DecodedStxTransfer = {
159
- cursor: string;
160
- block_height: number;
161
- tx_id: string;
162
- tx_index: number;
163
- event_index: number;
164
- event_type: "stx_transfer";
165
- decoded_payload: DecodedStxTransferPayload;
166
- source_cursor: string;
167
- };
168
- type DecodedStxMintPayload = {
169
- recipient: string;
170
- amount: string;
171
- };
172
- type DecodedStxMint = {
173
- cursor: string;
174
- block_height: number;
175
- tx_id: string;
176
- tx_index: number;
177
- event_index: number;
178
- event_type: "stx_mint";
179
- decoded_payload: DecodedStxMintPayload;
180
- source_cursor: string;
181
- };
182
- type DecodedStxBurnPayload = {
183
- sender: string;
184
- amount: string;
185
- };
186
- type DecodedStxBurn = {
187
- cursor: string;
188
- block_height: number;
189
- tx_id: string;
190
- tx_index: number;
191
- event_index: number;
192
- event_type: "stx_burn";
193
- decoded_payload: DecodedStxBurnPayload;
194
- source_cursor: string;
195
- };
196
- declare function isStxTransfer(event: StreamsEvent): event is StreamsEvent & {
197
- event_type: "stx_transfer";
198
- };
199
- declare function decodeStxTransfer(event: StreamsEvent): DecodedStxTransfer;
200
- declare function isStxMint(event: StreamsEvent): event is StreamsEvent & {
201
- event_type: "stx_mint";
202
- };
203
- declare function decodeStxMint(event: StreamsEvent): DecodedStxMint;
204
- declare function isStxBurn(event: StreamsEvent): event is StreamsEvent & {
205
- event_type: "stx_burn";
206
- };
207
- declare function decodeStxBurn(event: StreamsEvent): DecodedStxBurn;
208
- type DecodedStxLockPayload = {
209
- sender: string;
210
- amount: string;
211
- payload: {
212
- unlock_height: string | null;
213
- };
214
- };
215
- type DecodedStxLock = {
216
- cursor: string;
217
- block_height: number;
218
- tx_id: string;
219
- tx_index: number;
220
- event_index: number;
221
- event_type: "stx_lock";
222
- decoded_payload: DecodedStxLockPayload;
223
- source_cursor: string;
224
- };
225
- declare function isStxLock(event: StreamsEvent): event is StreamsEvent & {
226
- event_type: "stx_lock";
227
- };
228
- declare function decodeStxLock(event: StreamsEvent): DecodedStxLock;
229
- type DecodedFtMintPayload = {
230
- asset_identifier: string;
231
- contract_id: string;
232
- token_name: string | null;
233
- recipient: string;
234
- amount: string;
235
- };
236
- type DecodedFtMint = {
237
- cursor: string;
238
- block_height: number;
239
- tx_id: string;
240
- tx_index: number;
241
- event_index: number;
242
- event_type: "ft_mint";
243
- decoded_payload: DecodedFtMintPayload;
244
- source_cursor: string;
245
- };
246
- type DecodedFtBurnPayload = {
247
- asset_identifier: string;
248
- contract_id: string;
249
- token_name: string | null;
250
- sender: string;
251
- amount: string;
252
- };
253
- type DecodedFtBurn = {
254
- cursor: string;
255
- block_height: number;
256
- tx_id: string;
257
- tx_index: number;
258
- event_index: number;
259
- event_type: "ft_burn";
260
- decoded_payload: DecodedFtBurnPayload;
261
- source_cursor: string;
262
- };
263
- type DecodedNftMintPayload = {
264
- asset_identifier: string;
265
- contract_id: string;
266
- token_name: string | null;
267
- recipient: string;
268
- value: string;
269
- };
270
- type DecodedNftMint = {
271
- cursor: string;
272
- block_height: number;
273
- tx_id: string;
274
- tx_index: number;
275
- event_index: number;
276
- event_type: "nft_mint";
277
- decoded_payload: DecodedNftMintPayload;
278
- source_cursor: string;
279
- };
280
- type DecodedNftBurnPayload = {
281
- asset_identifier: string;
282
- contract_id: string;
283
- token_name: string | null;
284
- sender: string;
285
- value: string;
286
- };
287
- type DecodedNftBurn = {
288
- cursor: string;
289
- block_height: number;
290
- tx_id: string;
291
- tx_index: number;
292
- event_index: number;
293
- event_type: "nft_burn";
294
- decoded_payload: DecodedNftBurnPayload;
295
- source_cursor: string;
296
- };
297
- declare function isFtMint(event: StreamsEvent): event is StreamsEvent & {
298
- event_type: "ft_mint";
299
- };
300
- declare function decodeFtMint(event: StreamsEvent): DecodedFtMint;
301
- declare function isFtBurn(event: StreamsEvent): event is StreamsEvent & {
302
- event_type: "ft_burn";
303
- };
304
- declare function decodeFtBurn(event: StreamsEvent): DecodedFtBurn;
305
- declare function isNftMint(event: StreamsEvent): event is StreamsEvent & {
306
- event_type: "nft_mint";
307
- };
308
- declare function decodeNftMint(event: StreamsEvent): DecodedNftMint;
309
- declare function isNftBurn(event: StreamsEvent): event is StreamsEvent & {
310
- event_type: "nft_burn";
311
- };
312
- declare function decodeNftBurn(event: StreamsEvent): DecodedNftBurn;
313
- /** Decoded form of a Clarity `print` event:
314
- * - `topic`: the print topic, when the contract emits a `{ topic, ... }` tuple
315
- * - `value`: the Clarity value decoded to JSON (uints as strings, buffers as
316
- * `0x…` hex, tuples as objects)
317
- * - `raw_value`: the canonical serialized hex, for byte-exact consumers */
318
- type DecodedPrintValue = {
319
- topic: string | null;
320
- value: unknown;
321
- raw_value: string | null;
322
- };
323
- type DecodedPrintPayload = {
324
- contract_id: string | null;
325
- payload: DecodedPrintValue;
326
- };
327
- type DecodedPrint = {
328
- cursor: string;
329
- block_height: number;
330
- tx_id: string;
331
- tx_index: number;
332
- event_index: number;
333
- event_type: "print";
334
- decoded_payload: DecodedPrintPayload;
335
- source_cursor: string;
336
- };
337
- declare function isPrint(event: StreamsEvent): event is StreamsEvent & {
338
- event_type: "print";
339
- };
340
- declare function decodePrint(event: StreamsEvent): DecodedPrint;
341
- /** Superset of the columns the decoded_events table holds. Every decoded
342
- * event's `decoded_payload` is assignable to this, so the indexer's writer
343
- * can map columns generically instead of per-event-type. */
344
- type DecodedEventColumns = {
345
- contract_id?: string | null;
346
- asset_identifier?: string | null;
347
- sender?: string | null;
348
- recipient?: string | null;
349
- amount?: string | null;
350
- value?: string | null;
351
- memo?: string | null;
352
- /** JSONB overflow for non-flat types (e.g. print's decoded value). */
353
- payload?: unknown;
354
- };
355
- type DecodedEventRow = DecodedFtTransfer | DecodedNftTransfer | DecodedStxTransfer | DecodedStxMint | DecodedStxBurn | DecodedStxLock | DecodedFtMint | DecodedFtBurn | DecodedNftMint | DecodedNftBurn | DecodedPrint;
1
+ import { decodeFtTransfer, isFtTransfer, decodeNftTransfer, isNftTransfer, decodePrint, isPrint, decodeStxBurn, decodeStxLock, decodeStxMint, decodeStxTransfer, isStxBurn, isStxLock, isStxMint, isStxTransfer, decodeFtBurn, decodeFtMint, decodeNftBurn, decodeNftMint, isFtBurn, isFtMint, isNftBurn, isNftMint } from "@secondlayer/shared/streams-rows";
2
+ import { DecodedEventColumns, DecodedEventRow, DecodedFtBurn, DecodedFtMint, DecodedFtTransfer, DecodedFtTransferPayload, DecodedNftBurn, DecodedNftMint, DecodedNftTransfer, DecodedNftTransferPayload, DecodedPrint, DecodedPrintPayload, DecodedStxBurn, DecodedStxLock, DecodedStxMint, DecodedStxTransfer } from "@secondlayer/shared/streams-rows";
356
3
  export { isStxTransfer, isStxMint, isStxLock, isStxBurn, isPrint, isNftTransfer, isNftMint, isNftBurn, isFtTransfer, isFtMint, isFtBurn, decodeStxTransfer, decodeStxMint, decodeStxLock, decodeStxBurn, decodePrint, decodeNftTransfer, decodeNftMint, decodeNftBurn, decodeFtTransfer, decodeFtMint, decodeFtBurn, DecodedStxTransfer, DecodedStxMint, DecodedStxLock, DecodedStxBurn, DecodedPrintPayload, DecodedPrint, DecodedNftTransferPayload, DecodedNftTransfer, DecodedNftMint, DecodedNftBurn, DecodedFtTransferPayload, DecodedFtTransfer, DecodedFtMint, DecodedFtBurn, DecodedEventRow, DecodedEventColumns };
@@ -1,282 +1,28 @@
1
- // src/streams/_payload.ts
2
- function requireString(payload, field, eventType) {
3
- const value = payload[field];
4
- if (typeof value !== "string" || value.length === 0) {
5
- throw new Error(`${eventType} payload missing ${field}`);
6
- }
7
- return value;
8
- }
9
- function optionalString(value) {
10
- return typeof value === "string" && value.length > 0 ? value : null;
11
- }
12
- function requireAmountField(payload, field, eventType) {
13
- const amount = requireString(payload, field, eventType);
14
- if (!/^(0|[1-9]\d*)$/.test(amount)) {
15
- throw new Error(`${eventType} payload has malformed ${field}`);
16
- }
17
- return amount;
18
- }
19
- function requireAmount(payload, eventType) {
20
- return requireAmountField(payload, "amount", eventType);
21
- }
22
- function parseAssetIdentifier(assetIdentifier, eventType) {
23
- const [contractId, tokenName] = assetIdentifier.split("::");
24
- if (!contractId) {
25
- throw new Error(`${eventType} payload has malformed asset_identifier`);
26
- }
27
- return {
28
- contract_id: contractId,
29
- token_name: tokenName && tokenName.length > 0 ? tokenName : null
30
- };
31
- }
32
- function requireHexValue(payload, eventType) {
33
- const rawValue = payload.raw_value;
34
- if (typeof rawValue === "string") {
35
- if (!/^0x[0-9a-fA-F]*$/.test(rawValue)) {
36
- throw new Error(`${eventType} payload has malformed value`);
37
- }
38
- return rawValue;
39
- }
40
- const value = payload.value;
41
- const hex = typeof value === "string" ? value : value && typeof value === "object" && typeof value.hex === "string" ? value.hex : null;
42
- if (!hex) {
43
- throw new Error(`${eventType} payload missing value`);
44
- }
45
- if (!/^0x[0-9a-fA-F]*$/.test(hex)) {
46
- throw new Error(`${eventType} payload has malformed value`);
47
- }
48
- return hex;
49
- }
50
- function decodedRow(event, eventType, decoded_payload) {
51
- return {
52
- cursor: event.cursor,
53
- block_height: event.block_height,
54
- tx_id: event.tx_id,
55
- tx_index: event.tx_index,
56
- event_index: event.event_index,
57
- event_type: eventType,
58
- decoded_payload,
59
- source_cursor: event.cursor
60
- };
61
- }
62
-
63
- // src/streams/ft-transfer.ts
64
- function isFtTransfer(event) {
65
- return event.event_type === "ft_transfer";
66
- }
67
- function decodeFtTransfer(event) {
68
- if (!isFtTransfer(event)) {
69
- throw new Error(`Expected ft_transfer event, got ${event.event_type}`);
70
- }
71
- const payload = event.payload;
72
- const assetIdentifier = requireString(payload, "asset_identifier", "ft_transfer");
73
- const sender = requireString(payload, "sender", "ft_transfer");
74
- const recipient = requireString(payload, "recipient", "ft_transfer");
75
- const amount = requireAmount(payload, "ft_transfer");
76
- const { contract_id, token_name } = parseAssetIdentifier(assetIdentifier, "ft_transfer");
77
- return decodedRow(event, "ft_transfer", {
78
- asset_identifier: assetIdentifier,
79
- contract_id: event.contract_id ?? contract_id,
80
- token_name,
81
- sender,
82
- recipient,
83
- amount
84
- });
85
- }
86
- // src/streams/nft-transfer.ts
87
- function isNftTransfer(event) {
88
- return event.event_type === "nft_transfer";
89
- }
90
- function decodeNftTransfer(event) {
91
- if (!isNftTransfer(event)) {
92
- throw new Error(`Expected nft_transfer event, got ${event.event_type}`);
93
- }
94
- const payload = event.payload;
95
- const assetIdentifier = requireString(payload, "asset_identifier", "nft_transfer");
96
- const sender = requireString(payload, "sender", "nft_transfer");
97
- const recipient = requireString(payload, "recipient", "nft_transfer");
98
- const value = requireHexValue(payload, "nft_transfer");
99
- const { contract_id, token_name } = parseAssetIdentifier(assetIdentifier, "nft_transfer");
100
- return decodedRow(event, "nft_transfer", {
101
- asset_identifier: assetIdentifier,
102
- contract_id: event.contract_id ?? contract_id,
103
- token_name,
104
- sender,
105
- recipient,
106
- value
107
- });
108
- }
109
- // src/clarity.ts
110
- import { cvToValue, deserializeCV } from "@secondlayer/stacks/clarity";
111
- function toJsonSafe(value) {
112
- if (typeof value === "bigint")
113
- return value.toString();
114
- if (Array.isArray(value))
115
- return value.map(toJsonSafe);
116
- if (value && typeof value === "object") {
117
- const out = {};
118
- for (const [key, val] of Object.entries(value)) {
119
- out[key] = toJsonSafe(val);
120
- }
121
- return out;
122
- }
123
- return value;
124
- }
125
- function decodeClarityValue(hex) {
126
- try {
127
- const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
128
- return toJsonSafe(cvToValue(deserializeCV(clean)));
129
- } catch {
130
- return hex;
131
- }
132
- }
133
-
134
- // src/streams/print.ts
135
- function printValueHex(payload) {
136
- if (typeof payload.raw_value === "string")
137
- return payload.raw_value;
138
- const value = payload.value;
139
- if (typeof value === "string" && value.startsWith("0x"))
140
- return value;
141
- if (value && typeof value === "object" && typeof value.hex === "string") {
142
- return value.hex;
143
- }
144
- return null;
145
- }
146
- function isPrint(event) {
147
- return event.event_type === "print";
148
- }
149
- function decodePrint(event) {
150
- if (!isPrint(event)) {
151
- throw new Error(`Expected print event, got ${event.event_type}`);
152
- }
153
- const payload = event.payload;
154
- const topic = optionalString(payload.topic);
155
- const rawValue = printValueHex(payload);
156
- const value = rawValue ? decodeClarityValue(rawValue) : toJsonSafe(payload.value ?? null);
157
- return decodedRow(event, "print", {
158
- contract_id: event.contract_id ?? optionalString(payload.contract_id),
159
- payload: { topic, value, raw_value: rawValue }
160
- });
161
- }
162
- // src/streams/stx-events.ts
163
- function isStxTransfer(event) {
164
- return event.event_type === "stx_transfer";
165
- }
166
- function decodeStxTransfer(event) {
167
- if (!isStxTransfer(event)) {
168
- throw new Error(`Expected stx_transfer event, got ${event.event_type}`);
169
- }
170
- const payload = event.payload;
171
- return decodedRow(event, "stx_transfer", {
172
- sender: requireString(payload, "sender", "stx_transfer"),
173
- recipient: requireString(payload, "recipient", "stx_transfer"),
174
- amount: requireAmount(payload, "stx_transfer"),
175
- memo: optionalString(payload.memo)
176
- });
177
- }
178
- function isStxMint(event) {
179
- return event.event_type === "stx_mint";
180
- }
181
- function decodeStxMint(event) {
182
- if (!isStxMint(event)) {
183
- throw new Error(`Expected stx_mint event, got ${event.event_type}`);
184
- }
185
- const payload = event.payload;
186
- return decodedRow(event, "stx_mint", {
187
- recipient: requireString(payload, "recipient", "stx_mint"),
188
- amount: requireAmount(payload, "stx_mint")
189
- });
190
- }
191
- function isStxBurn(event) {
192
- return event.event_type === "stx_burn";
193
- }
194
- function decodeStxBurn(event) {
195
- if (!isStxBurn(event)) {
196
- throw new Error(`Expected stx_burn event, got ${event.event_type}`);
197
- }
198
- const payload = event.payload;
199
- return decodedRow(event, "stx_burn", {
200
- sender: requireString(payload, "sender", "stx_burn"),
201
- amount: requireAmount(payload, "stx_burn")
202
- });
203
- }
204
- function isStxLock(event) {
205
- return event.event_type === "stx_lock";
206
- }
207
- function decodeStxLock(event) {
208
- if (!isStxLock(event)) {
209
- throw new Error(`Expected stx_lock event, got ${event.event_type}`);
210
- }
211
- const payload = event.payload;
212
- return decodedRow(event, "stx_lock", {
213
- sender: requireString(payload, "locked_address", "stx_lock"),
214
- amount: requireAmountField(payload, "locked_amount", "stx_lock"),
215
- payload: { unlock_height: optionalString(payload.unlock_height) }
216
- });
217
- }
218
- // src/streams/token-mint-burn.ts
219
- function assetFields(event, eventType) {
220
- const assetIdentifier = requireString(event.payload, "asset_identifier", eventType);
221
- const { contract_id, token_name } = parseAssetIdentifier(assetIdentifier, eventType);
222
- return {
223
- asset_identifier: assetIdentifier,
224
- contract_id: event.contract_id ?? contract_id,
225
- token_name
226
- };
227
- }
228
- function isFtMint(event) {
229
- return event.event_type === "ft_mint";
230
- }
231
- function decodeFtMint(event) {
232
- if (!isFtMint(event)) {
233
- throw new Error(`Expected ft_mint event, got ${event.event_type}`);
234
- }
235
- return decodedRow(event, "ft_mint", {
236
- ...assetFields(event, "ft_mint"),
237
- recipient: requireString(event.payload, "recipient", "ft_mint"),
238
- amount: requireAmount(event.payload, "ft_mint")
239
- });
240
- }
241
- function isFtBurn(event) {
242
- return event.event_type === "ft_burn";
243
- }
244
- function decodeFtBurn(event) {
245
- if (!isFtBurn(event)) {
246
- throw new Error(`Expected ft_burn event, got ${event.event_type}`);
247
- }
248
- return decodedRow(event, "ft_burn", {
249
- ...assetFields(event, "ft_burn"),
250
- sender: requireString(event.payload, "sender", "ft_burn"),
251
- amount: requireAmount(event.payload, "ft_burn")
252
- });
253
- }
254
- function isNftMint(event) {
255
- return event.event_type === "nft_mint";
256
- }
257
- function decodeNftMint(event) {
258
- if (!isNftMint(event)) {
259
- throw new Error(`Expected nft_mint event, got ${event.event_type}`);
260
- }
261
- return decodedRow(event, "nft_mint", {
262
- ...assetFields(event, "nft_mint"),
263
- recipient: requireString(event.payload, "recipient", "nft_mint"),
264
- value: requireHexValue(event.payload, "nft_mint")
265
- });
266
- }
267
- function isNftBurn(event) {
268
- return event.event_type === "nft_burn";
269
- }
270
- function decodeNftBurn(event) {
271
- if (!isNftBurn(event)) {
272
- throw new Error(`Expected nft_burn event, got ${event.event_type}`);
273
- }
274
- return decodedRow(event, "nft_burn", {
275
- ...assetFields(event, "nft_burn"),
276
- sender: requireString(event.payload, "sender", "nft_burn"),
277
- value: requireHexValue(event.payload, "nft_burn")
278
- });
279
- }
1
+ // src/streams/rows.ts
2
+ import {
3
+ decodeFtTransfer,
4
+ isFtTransfer,
5
+ decodeNftTransfer,
6
+ isNftTransfer,
7
+ decodePrint,
8
+ isPrint,
9
+ decodeStxBurn,
10
+ decodeStxLock,
11
+ decodeStxMint,
12
+ decodeStxTransfer,
13
+ isStxBurn,
14
+ isStxLock,
15
+ isStxMint,
16
+ isStxTransfer,
17
+ decodeFtBurn,
18
+ decodeFtMint,
19
+ decodeNftBurn,
20
+ decodeNftMint,
21
+ isFtBurn,
22
+ isFtMint,
23
+ isNftBurn,
24
+ isNftMint
25
+ } from "@secondlayer/shared/streams-rows";
280
26
  export {
281
27
  isStxTransfer,
282
28
  isStxMint,
@@ -302,5 +48,5 @@ export {
302
48
  decodeFtBurn
303
49
  };
304
50
 
305
- //# debugId=1297EE104E5B35B464756E2164756E21
51
+ //# debugId=06C07B68A4D02ABE64756E2164756E21
306
52
  //# sourceMappingURL=rows.js.map