@secondlayer/sdk 6.34.0 → 6.35.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 +40 -14
- package/dist/index.js +30 -2
- package/dist/index.js.map +3 -3
- package/dist/subgraphs/index.d.ts +39 -13
- package/dist/subgraphs/index.js +30 -2
- package/dist/subgraphs/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -1023,19 +1023,27 @@ type IndexPrint = IndexEventBase & {
|
|
|
1023
1023
|
/** Decoded chain event, discriminated by `event_type`. */
|
|
1024
1024
|
type IndexEvent = IndexFtTransfer | IndexNftTransfer | IndexStxTransfer | IndexStxMint | IndexStxBurn | IndexStxLock | IndexFtMint | IndexFtBurn | IndexNftMint | IndexNftBurn | IndexPrint;
|
|
1025
1025
|
type IndexEventType = IndexEvent["event_type"];
|
|
1026
|
-
type EventsEnvelope = {
|
|
1027
|
-
events:
|
|
1026
|
+
type EventsEnvelope<T extends IndexEventType = IndexEventType> = {
|
|
1027
|
+
events: IndexEventOf<T>[]
|
|
1028
1028
|
next_cursor: string | null
|
|
1029
1029
|
tip: IndexTip
|
|
1030
1030
|
reorgs: IndexReorg[]
|
|
1031
1031
|
};
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1032
|
+
/** The single decoded-event member matching one `event_type` literal.
|
|
1033
|
+
* `IndexEventOf<"ft_transfer">` is `IndexFtTransfer`. */
|
|
1034
|
+
type IndexEventOf<T extends IndexEventType> = Extract<IndexEvent, {
|
|
1035
|
+
event_type: T
|
|
1036
|
+
}>;
|
|
1037
|
+
type EventsListParams<T extends IndexEventType = IndexEventType> = {
|
|
1038
|
+
/** Required. One of the decoded event types. Passing a literal narrows the
|
|
1039
|
+
* rows every surface hands back to that event's own shape. */
|
|
1040
|
+
eventType: T
|
|
1035
1041
|
cursor?: string | null
|
|
1036
1042
|
fromCursor?: string | null
|
|
1037
1043
|
limit?: number
|
|
1038
|
-
|
|
1044
|
+
/** One id, or several to scope the sweep to a set of contracts (max 20).
|
|
1045
|
+
* Mutually exclusive with `trait`. */
|
|
1046
|
+
contractId?: string | readonly string[]
|
|
1039
1047
|
assetIdentifier?: string
|
|
1040
1048
|
sender?: string
|
|
1041
1049
|
recipient?: string
|
|
@@ -1050,11 +1058,11 @@ type EventsListParams = {
|
|
|
1050
1058
|
* the only source of the submitting sender. */
|
|
1051
1059
|
txContext?: boolean
|
|
1052
1060
|
};
|
|
1053
|
-
type EventsWalkParams = Omit<EventsListParams
|
|
1061
|
+
type EventsWalkParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "limit"> & {
|
|
1054
1062
|
batchSize?: number
|
|
1055
1063
|
signal?: AbortSignal
|
|
1056
1064
|
};
|
|
1057
|
-
type EventsConsumeParams = Omit<EventsListParams
|
|
1065
|
+
type EventsConsumeParams<T extends IndexEventType = IndexEventType> = Omit<EventsListParams<T>, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexEventOf<T>, EventsEnvelope<T>>;
|
|
1058
1066
|
type IndexContractCall = {
|
|
1059
1067
|
cursor: string
|
|
1060
1068
|
block_height: number
|
|
@@ -1079,7 +1087,9 @@ type ContractCallsListParams = {
|
|
|
1079
1087
|
cursor?: string | null
|
|
1080
1088
|
fromCursor?: string | null
|
|
1081
1089
|
limit?: number
|
|
1082
|
-
|
|
1090
|
+
/** One id, or several to scope the sweep to a set of contracts (max 20).
|
|
1091
|
+
* Mutually exclusive with `trait`. */
|
|
1092
|
+
contractId?: string | readonly string[]
|
|
1083
1093
|
functionName?: string
|
|
1084
1094
|
sender?: string
|
|
1085
1095
|
fromHeight?: number
|
|
@@ -1565,12 +1575,21 @@ type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & {
|
|
|
1565
1575
|
batchSize?: number
|
|
1566
1576
|
signal?: AbortSignal
|
|
1567
1577
|
};
|
|
1578
|
+
type SbtcEventsConsumeParams = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope>;
|
|
1579
|
+
type SbtcDepositsConsumeParams = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope>;
|
|
1568
1580
|
/** `index.sbtc` — the decoded sBTC peg surface (deposits, withdrawals, raw
|
|
1569
1581
|
* events, scoreboard). The only productized decoded sBTC peg feed on Stacks. */
|
|
1570
1582
|
interface SbtcResource {
|
|
1571
1583
|
deposits: {
|
|
1572
1584
|
list(params?: SbtcDepositsListParams): Promise<SbtcDepositsEnvelope>
|
|
1573
1585
|
walk(params?: SbtcDepositsWalkParams): AsyncIterable<IndexSbtcDeposit>
|
|
1586
|
+
/** Checkpointed sweep of completed deposits — append-only, so safe to
|
|
1587
|
+
* mirror. See {@link IndexConsumeOptions}. */
|
|
1588
|
+
consume(params: SbtcDepositsConsumeParams): Promise<{
|
|
1589
|
+
cursor: string | null
|
|
1590
|
+
pages: number
|
|
1591
|
+
emptyPolls: number
|
|
1592
|
+
}>
|
|
1574
1593
|
/** Fetch a completed deposit by Bitcoin txid; 404 → null. */
|
|
1575
1594
|
get(bitcoinTxid: string): Promise<SbtcDepositEnvelope | null>
|
|
1576
1595
|
};
|
|
@@ -1583,6 +1602,13 @@ interface SbtcResource {
|
|
|
1583
1602
|
events: {
|
|
1584
1603
|
list(params?: SbtcEventsListParams): Promise<SbtcEventsEnvelope>
|
|
1585
1604
|
walk(params?: SbtcEventsWalkParams): AsyncIterable<IndexSbtcEvent>
|
|
1605
|
+
/** Checkpointed sweep of the raw peg event log — append-only across all
|
|
1606
|
+
* six topics. See {@link IndexConsumeOptions}. */
|
|
1607
|
+
consume(params: SbtcEventsConsumeParams): Promise<{
|
|
1608
|
+
cursor: string | null
|
|
1609
|
+
pages: number
|
|
1610
|
+
emptyPolls: number
|
|
1611
|
+
}>
|
|
1586
1612
|
};
|
|
1587
1613
|
/** The peg scoreboard — a single all-time aggregate (no pagination). */
|
|
1588
1614
|
summary(): Promise<SbtcSummaryEnvelope>;
|
|
@@ -1725,10 +1751,10 @@ interface NftTransfersResource {
|
|
|
1725
1751
|
}
|
|
1726
1752
|
/** `index.events` — callable shorthand for `.list()`; `eventType` is required. */
|
|
1727
1753
|
interface IndexEventsResource {
|
|
1728
|
-
(params: EventsListParams): Promise<EventsEnvelope
|
|
1729
|
-
list(params: EventsListParams): Promise<EventsEnvelope
|
|
1730
|
-
walk(params: EventsWalkParams): AsyncIterable<
|
|
1731
|
-
consume(params: EventsConsumeParams): Promise<{
|
|
1754
|
+
<T extends IndexEventType>(params: EventsListParams<T>): Promise<EventsEnvelope<T>>;
|
|
1755
|
+
list<T extends IndexEventType>(params: EventsListParams<T>): Promise<EventsEnvelope<T>>;
|
|
1756
|
+
walk<T extends IndexEventType>(params: EventsWalkParams<T>): AsyncIterable<IndexEventOf<T>>;
|
|
1757
|
+
consume<T extends IndexEventType>(params: EventsConsumeParams<T>): Promise<{
|
|
1732
1758
|
cursor: string | null
|
|
1733
1759
|
pages: number
|
|
1734
1760
|
emptyPolls: number
|
package/dist/subgraphs/index.js
CHANGED
|
@@ -807,6 +807,19 @@ class Index extends BaseClient {
|
|
|
807
807
|
deposits: {
|
|
808
808
|
list: (params = {}) => this.listSbtcDeposits(params),
|
|
809
809
|
walk: (params = {}) => this.walkSbtcDeposits(params),
|
|
810
|
+
consume: (params) => consumeIndexFeed({
|
|
811
|
+
...params,
|
|
812
|
+
fetchPage: ({ cursor, fromHeight, limit }) => this.listSbtcDeposits({
|
|
813
|
+
confirmed: params.confirmed,
|
|
814
|
+
sender: params.sender,
|
|
815
|
+
bitcoinTxid: params.bitcoinTxid,
|
|
816
|
+
toHeight: params.toHeight,
|
|
817
|
+
cursor,
|
|
818
|
+
fromHeight,
|
|
819
|
+
limit
|
|
820
|
+
}),
|
|
821
|
+
itemsOf: (envelope) => envelope.deposits
|
|
822
|
+
}),
|
|
810
823
|
get: (bitcoinTxid) => this.getSbtcDeposit(bitcoinTxid)
|
|
811
824
|
},
|
|
812
825
|
withdrawals: {
|
|
@@ -816,7 +829,22 @@ class Index extends BaseClient {
|
|
|
816
829
|
},
|
|
817
830
|
events: {
|
|
818
831
|
list: (params = {}) => this.listSbtcEvents(params),
|
|
819
|
-
walk: (params = {}) => this.walkSbtcEvents(params)
|
|
832
|
+
walk: (params = {}) => this.walkSbtcEvents(params),
|
|
833
|
+
consume: (params) => consumeIndexFeed({
|
|
834
|
+
...params,
|
|
835
|
+
fetchPage: ({ cursor, fromHeight, limit }) => this.listSbtcEvents({
|
|
836
|
+
confirmed: params.confirmed,
|
|
837
|
+
topic: params.topic,
|
|
838
|
+
sender: params.sender,
|
|
839
|
+
requestId: params.requestId,
|
|
840
|
+
bitcoinTxid: params.bitcoinTxid,
|
|
841
|
+
toHeight: params.toHeight,
|
|
842
|
+
cursor,
|
|
843
|
+
fromHeight,
|
|
844
|
+
limit
|
|
845
|
+
}),
|
|
846
|
+
itemsOf: (envelope) => envelope.events
|
|
847
|
+
})
|
|
820
848
|
},
|
|
821
849
|
summary: () => this.getSbtcSummary()
|
|
822
850
|
};
|
|
@@ -1762,5 +1790,5 @@ export {
|
|
|
1762
1790
|
Subgraphs
|
|
1763
1791
|
};
|
|
1764
1792
|
|
|
1765
|
-
//# debugId=
|
|
1793
|
+
//# debugId=C01B0960A474ED8C64756E2164756E21
|
|
1766
1794
|
//# sourceMappingURL=index.js.map
|