@secondlayer/sdk 6.17.0 → 6.18.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
@@ -10,6 +10,10 @@ interface SecondLayerOptions {
10
10
  apiKey?: string;
11
11
  /** Fetch implementation. Tests and edge runtimes can provide their own. */
12
12
  fetchImpl?: FetchLike;
13
+ /** Public base URL for Streams bulk parquet dumps (the cold backfill plane).
14
+ * Required for `streams.dumps.*`; without it the dumps client falls back to
15
+ * its built-in default. */
16
+ dumpsBaseUrl?: string;
13
17
  /** Deploy origin label sent as `x-sl-origin` (telemetry). Defaults to `cli`. */
14
18
  origin?: "cli" | "mcp" | "session";
15
19
  }
@@ -582,6 +586,9 @@ type EventsListParams = {
582
586
  recipient?: string
583
587
  fromHeight?: number
584
588
  toHeight?: number
589
+ /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
590
+ * Mutually exclusive with contractId; contract-keyed event types only. */
591
+ trait?: string
585
592
  };
586
593
  type EventsWalkParams = Omit<EventsListParams, "limit"> & {
587
594
  batchSize?: number
@@ -616,6 +623,9 @@ type ContractCallsListParams = {
616
623
  sender?: string
617
624
  fromHeight?: number
618
625
  toHeight?: number
626
+ /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
627
+ * Mutually exclusive with contractId. */
628
+ trait?: string
619
629
  };
620
630
  type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & {
621
631
  batchSize?: number
@@ -872,10 +882,30 @@ type MempoolWalkParams = Omit<MempoolListParams, "limit"> & {
872
882
  batchSize?: number
873
883
  signal?: AbortSignal
874
884
  };
885
+ /** Per-event-type filter vocabulary in the {@link IndexDiscovery} doc. */
886
+ type IndexEventTypeFilters = {
887
+ columns?: string[]
888
+ allowed_filters?: string[]
889
+ equality_filters?: string[]
890
+ required_non_null?: string[]
891
+ };
892
+ /** The `GET /v1/index` discovery doc — live endpoint + filter vocabulary.
893
+ * Shape is intentionally open (the server may add fields); the agent-relevant
894
+ * parts are the per-type filter rules. */
895
+ type IndexDiscovery = {
896
+ event_type_filters?: Record<string, IndexEventTypeFilters>
897
+ [key: string]: unknown
898
+ };
875
899
  declare class Index extends BaseClient {
876
900
  constructor(options?: Partial<SecondLayerOptions>);
877
901
  /** Your own Index consumption (decoded events today + this month) and tier limits. */
878
902
  usage(): Promise<IndexUsage>;
903
+ /**
904
+ * Index discovery doc — the live vocabulary: every endpoint, each event type's
905
+ * columns, allowed/equality filters, and required-non-null fields. Read this to
906
+ * learn what's queryable (and which types accept `trait`) instead of hardcoding.
907
+ */
908
+ discover(): Promise<IndexDiscovery>;
879
909
  readonly ftTransfers: {
880
910
  list: (params?: FtTransfersListParams) => Promise<FtTransfersEnvelope>
881
911
  walk: (params?: FtTransfersWalkParams) => AsyncIterable<FtTransfer>
@@ -1422,6 +1452,7 @@ declare class Subscriptions extends BaseClient {
1422
1452
  replay(id: string, range: {
1423
1453
  fromBlock: number
1424
1454
  toBlock: number
1455
+ force?: string
1425
1456
  }): Promise<ReplayResult>;
1426
1457
  dead(id: string): Promise<{
1427
1458
  data: DeadRow[]
@@ -2081,4 +2112,4 @@ declare function toJsonSafe(value: unknown): unknown;
2081
2112
  /** Decode a hex-encoded Clarity value to JSON-safe JS (uints as strings,
2082
2113
  * buffers as `0x…` hex, tuples as objects). Returns the input hex on failure. */
2083
2114
  declare function decodeClarityValue(hex: string): unknown;
2084
- export { verifyWebhookSignature, verifyTransactionProof, verifySecondlayerSignature, trigger, toJsonSafe, isStxTransfer, isStxMint, isStxLock, isStxBurn, isPrint, isNftTransfer, isNftMint, isNftBurn, isFtTransfer, isFtMint, isFtBurn, getSubgraph, fetchRewardSet, decodeStxTransfer, decodeStxMint, decodeStxLock, decodeStxBurn, decodePrint, decodeNftTransfer, decodeNftMint, decodeNftBurn, decodeFtTransfer, decodeFtMint, decodeFtBurn, decodeClarityValue, createStreamsClient, VersionConflictError, ValidationError, UpdateSubscriptionRequest2 as UpdateSubscriptionRequest, UpdateProjectParams, TransactionsWalkParams, TransactionsListParams, TransactionsEnvelope, TransactionProofVerifyResult, TransactionProof, TransactionEnvelope, Subscriptions, SubscriptionSummary2 as SubscriptionSummary, SubscriptionStatus, SubscriptionRuntime, SubscriptionKind, SubscriptionFormat, SubscriptionDetail2 as SubscriptionDetail, Subgraphs, SubgraphSpecOptions3 as SubgraphSpecOptions, SubgraphSpecFormat2 as SubgraphSpecFormat, SubgraphOperationStatus, SubgraphAgentSchema3 as SubgraphAgentSchema, StreamsUsage, StreamsTip, StreamsSignatureError, StreamsServerError, StreamsReorgsListParams, StreamsReorgsListEnvelope, StreamsReorgContext, StreamsReorg, StreamsEventsSubscribeParams, StreamsEventsStreamParams, StreamsEventsListParams, StreamsEventsListEnvelope, StreamsEventsEnvelope, StreamsEventsConsumeResult, StreamsEventsConsumeParams, StreamsEventType, StreamsEventPayload, StreamsEvent, StreamsDumpsManifest, StreamsDumps, StreamsDumpFile, StreamsClient, StreamsCanonicalBlock, StreamsBatchContext, StackingWalkParams, StackingListParams, StackingEnvelope, SecondLayerOptions, SecondLayer, ScopedKeyProduct, RotateSecretResponse2 as RotateSecretResponse, RewardSet2 as RewardSet, ReplayResult2 as ReplayResult, RateLimitError, Projects, ProjectTeamMember, ProjectTeam, ProjectInvitation, Project, Pox4CallsParams, NftTransfersWalkParams, NftTransfersListParams, NftTransfersEnvelope, NftTransferPayload, NftTransferEvent, NftTransfer, MempoolWalkParams, MempoolTransactionEnvelope, MempoolListParams, MempoolEnvelope, IndexUsage, IndexTransaction, IndexTip, IndexStackingAction, IndexReorg, IndexPostCondition, IndexMempoolTransaction, IndexEventType, IndexEvent, IndexContractCall, IndexCanonicalBlock, IndexBlock, Index, FtTransfersWalkParams, FtTransfersListParams, FtTransfersEnvelope, FtTransferPayload, FtTransferEvent, FtTransfer, FetchLike2 as FetchLike, EventsWalkParams, EventsListParams, EventsEnvelope, DeliveryRow2 as DeliveryRow, DecodedStxTransferPayload, DecodedStxTransfer, DecodedStxMintPayload, DecodedStxMint, DecodedStxLockPayload, DecodedStxLock, DecodedStxBurnPayload, DecodedStxBurn, DecodedPrintValue, DecodedPrintPayload, DecodedPrint, DecodedNftTransferPayload, DecodedNftTransfer, DecodedNftMintPayload, DecodedNftMint, DecodedNftBurnPayload, DecodedNftBurn, DecodedFtTransferPayload, DecodedFtTransfer, DecodedFtMintPayload, DecodedFtMint, DecodedFtBurnPayload, DecodedFtBurn, DecodedEventRow, DecodedEventColumns, DeadRow2 as DeadRow, Datasets, DatasetRow, CursorListParams, CursorEnvelope, Cursor, CreateSubscriptionResponse2 as CreateSubscriptionResponse, CreateSubscriptionRequest2 as CreateSubscriptionRequest, CreateProjectParams, CreateApiKeyResponse, CreateApiKeyParams, ContractsListParams, ContractsEnvelope, Contracts, ContractSummary, ContractConformance, ContractCallsWalkParams, ContractCallsListParams, ContractCallsEnvelope, ContextSnapshot, ContextProject, ContextApiKey, ContextAccount, ChainTriggerType, ChainTrigger, CanonicalWalkParams, CanonicalListParams, CanonicalEnvelope, CURSOR_SLUGS, ByoBreakingChangeError, ByoBreakingChangeDetails, BlocksWalkParams, BlocksListParams, BlocksEnvelope, BlockEnvelope, AuthError, ApiKeys, ApiKeySummary, ApiError, ActiveSubgraphOperation };
2115
+ export { verifyWebhookSignature, verifyTransactionProof, verifySecondlayerSignature, trigger, toJsonSafe, isStxTransfer, isStxMint, isStxLock, isStxBurn, isPrint, isNftTransfer, isNftMint, isNftBurn, isFtTransfer, isFtMint, isFtBurn, getSubgraph, fetchRewardSet, decodeStxTransfer, decodeStxMint, decodeStxLock, decodeStxBurn, decodePrint, decodeNftTransfer, decodeNftMint, decodeNftBurn, decodeFtTransfer, decodeFtMint, decodeFtBurn, decodeClarityValue, createStreamsClient, VersionConflictError, ValidationError, UpdateSubscriptionRequest2 as UpdateSubscriptionRequest, UpdateProjectParams, TransactionsWalkParams, TransactionsListParams, TransactionsEnvelope, TransactionProofVerifyResult, TransactionProof, TransactionEnvelope, Subscriptions, SubscriptionSummary2 as SubscriptionSummary, SubscriptionStatus, SubscriptionRuntime, SubscriptionKind, SubscriptionFormat, SubscriptionDetail2 as SubscriptionDetail, Subgraphs, SubgraphSpecOptions3 as SubgraphSpecOptions, SubgraphSpecFormat2 as SubgraphSpecFormat, SubgraphOperationStatus, SubgraphAgentSchema3 as SubgraphAgentSchema, StreamsUsage, StreamsTip, StreamsSignatureError, StreamsServerError, StreamsReorgsListParams, StreamsReorgsListEnvelope, StreamsReorgContext, StreamsReorg, StreamsEventsSubscribeParams, StreamsEventsStreamParams, StreamsEventsListParams, StreamsEventsListEnvelope, StreamsEventsEnvelope, StreamsEventsConsumeResult, StreamsEventsConsumeParams, StreamsEventType, StreamsEventPayload, StreamsEvent, StreamsDumpsManifest, StreamsDumps, StreamsDumpFile, StreamsClient, StreamsCanonicalBlock, StreamsBatchContext, StackingWalkParams, StackingListParams, StackingEnvelope, SecondLayerOptions, SecondLayer, ScopedKeyProduct, RotateSecretResponse2 as RotateSecretResponse, RewardSet2 as RewardSet, ReplayResult2 as ReplayResult, RateLimitError, Projects, ProjectTeamMember, ProjectTeam, ProjectInvitation, Project, Pox4CallsParams, NftTransfersWalkParams, NftTransfersListParams, NftTransfersEnvelope, NftTransferPayload, NftTransferEvent, NftTransfer, MempoolWalkParams, MempoolTransactionEnvelope, MempoolListParams, MempoolEnvelope, IndexUsage, IndexTransaction, IndexTip, IndexStackingAction, IndexReorg, IndexPostCondition, IndexMempoolTransaction, IndexEventTypeFilters, IndexEventType, IndexEvent, IndexDiscovery, IndexContractCall, IndexCanonicalBlock, IndexBlock, Index, FtTransfersWalkParams, FtTransfersListParams, FtTransfersEnvelope, FtTransferPayload, FtTransferEvent, FtTransfer, FetchLike2 as FetchLike, EventsWalkParams, EventsListParams, EventsEnvelope, DeliveryRow2 as DeliveryRow, DecodedStxTransferPayload, DecodedStxTransfer, DecodedStxMintPayload, DecodedStxMint, DecodedStxLockPayload, DecodedStxLock, DecodedStxBurnPayload, DecodedStxBurn, DecodedPrintValue, DecodedPrintPayload, DecodedPrint, DecodedNftTransferPayload, DecodedNftTransfer, DecodedNftMintPayload, DecodedNftMint, DecodedNftBurnPayload, DecodedNftBurn, DecodedFtTransferPayload, DecodedFtTransfer, DecodedFtMintPayload, DecodedFtMint, DecodedFtBurnPayload, DecodedFtBurn, DecodedEventRow, DecodedEventColumns, DeadRow2 as DeadRow, Datasets, DatasetRow, CursorListParams, CursorEnvelope, Cursor, CreateSubscriptionResponse2 as CreateSubscriptionResponse, CreateSubscriptionRequest2 as CreateSubscriptionRequest, CreateProjectParams, CreateApiKeyResponse, CreateApiKeyParams, ContractsListParams, ContractsEnvelope, Contracts, ContractSummary, ContractConformance, ContractCallsWalkParams, ContractCallsListParams, ContractCallsEnvelope, ContextSnapshot, ContextProject, ContextApiKey, ContextAccount, ChainTriggerType, ChainTrigger, CanonicalWalkParams, CanonicalListParams, CanonicalEnvelope, CURSOR_SLUGS, ByoBreakingChangeError, ByoBreakingChangeDetails, BlocksWalkParams, BlocksListParams, BlocksEnvelope, BlockEnvelope, AuthError, ApiKeys, ApiKeySummary, ApiError, ActiveSubgraphOperation };
package/dist/index.js CHANGED
@@ -593,6 +593,9 @@ class Index extends BaseClient {
593
593
  usage() {
594
594
  return this.request("GET", "/v1/index/usage");
595
595
  }
596
+ discover() {
597
+ return this.request("GET", "/v1/index");
598
+ }
596
599
  ftTransfers = {
597
600
  list: (params = {}) => this.listFtTransfers(params),
598
601
  walk: (params = {}) => this.walkFtTransfers(params)
@@ -718,7 +721,8 @@ class Index extends BaseClient {
718
721
  sender: params.sender,
719
722
  recipient: params.recipient,
720
723
  from_height: params.fromHeight,
721
- to_height: params.toHeight
724
+ to_height: params.toHeight,
725
+ trait: params.trait
722
726
  })}`);
723
727
  }
724
728
  async* walkEvents(params) {
@@ -755,7 +759,8 @@ class Index extends BaseClient {
755
759
  function_name: params.functionName,
756
760
  sender: params.sender,
757
761
  from_height: params.fromHeight,
758
- to_height: params.toHeight
762
+ to_height: params.toHeight,
763
+ trait: params.trait
759
764
  })}`);
760
765
  }
761
766
  async* walkContractCalls(params = {}) {
@@ -1697,7 +1702,8 @@ class SecondLayer extends BaseClient {
1697
1702
  this.streams = createStreamsClient({
1698
1703
  apiKey: options.apiKey ?? "",
1699
1704
  baseUrl: options.baseUrl,
1700
- fetchImpl: options.fetchImpl
1705
+ fetchImpl: options.fetchImpl,
1706
+ dumpsBaseUrl: options.dumpsBaseUrl
1701
1707
  });
1702
1708
  this.index = new Index(options);
1703
1709
  this.datasets = new Datasets(options);
@@ -2243,5 +2249,5 @@ export {
2243
2249
  ApiError
2244
2250
  };
2245
2251
 
2246
- //# debugId=8B8F4DFD96F5A43C64756E2164756E21
2252
+ //# debugId=DBAA238399806ED364756E2164756E21
2247
2253
  //# sourceMappingURL=index.js.map