@secondlayer/sdk 6.17.0 → 6.19.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
  }
@@ -228,6 +232,13 @@ declare class Contracts extends BaseClient {
228
232
  constructor(options?: Partial<SecondLayerOptions>);
229
233
  /** Find contracts conforming to `trait`. `trait` is required (server 400s without it). */
230
234
  list(params: ContractsListParams): Promise<ContractsEnvelope>;
235
+ /**
236
+ * Fetch a single contract from the registry by id (the prod-safe ABI source).
237
+ * Pass `{ includeAbi: true }` for the full ABI blob. Resolves null on 404.
238
+ */
239
+ get(contractId: string, opts?: {
240
+ includeAbi?: boolean
241
+ }): Promise<ContractSummary | null>;
231
242
  }
232
243
  /**
233
244
  * Typed client for the Foundation Datasets REST API (`/v1/datasets/*`).
@@ -378,6 +389,85 @@ declare class Datasets extends BaseClient {
378
389
  private paramsToQuery;
379
390
  private cursorDataset;
380
391
  }
392
+ import { RewardSet } from "@secondlayer/shared/node/consensus";
393
+ import { MerkleProofStep } from "@secondlayer/shared/node/nakamoto";
394
+ /**
395
+ * Trustless transaction-inclusion proof verification.
396
+ *
397
+ * Given a proof from `GET /v1/index/transactions/:txid/proof`, the consumer
398
+ * re-derives everything itself — it does NOT trust any value Secondlayer
399
+ * computed. Anchored level: (1) recompute the txid from the raw tx bytes, (2)
400
+ * fold it up the merkle path to the header's `tx_merkle_root`, (3) recompute the
401
+ * header's `block_hash` and `index_block_hash` from the raw header — "this tx is
402
+ * included in a header any node can corroborate". Consensus level (when the proof
403
+ * carries a `consensus` field, or a `rewardSet` is passed): additionally recover
404
+ * the header's signer signatures and confirm ≥70% of reward-set signer weight
405
+ * signed the block.
406
+ *
407
+ * Note: uses Node's crypto via `@secondlayer/shared` (same as the Streams
408
+ * signature verify); intended for Node/server verification.
409
+ */
410
+ interface TransactionProof {
411
+ txid: string;
412
+ index_block_hash: string;
413
+ block_height: number;
414
+ tx_index: number;
415
+ /** Raw consensus-serialized transaction bytes (hex). */
416
+ raw_tx: string;
417
+ /** Raw Nakamoto block-header bytes (hex) — parsed + re-hashed by the verifier. */
418
+ raw_header: string;
419
+ /** Authentication path from the tx leaf to `tx_merkle_root`. */
420
+ tx_merkle_path: MerkleProofStep[];
421
+ /** Present when consensus-level verification is available: the reward cycle and
422
+ * its signer set, against which the header's signer signatures are checked. */
423
+ consensus?: {
424
+ reward_cycle: number
425
+ reward_set: RewardSet
426
+ };
427
+ }
428
+ interface TransactionProofVerifyResult {
429
+ /** Highest level actually verified. "consensus" requires the proof's
430
+ * `consensus` field and a met signer-weight threshold. */
431
+ level: "anchored" | "consensus";
432
+ /** Recomputed txid === proof.txid. */
433
+ txidMatches: boolean;
434
+ /** Merkle path folds the txid to the header's tx_merkle_root. */
435
+ includedInHeader: boolean;
436
+ /** Recomputed block_hash + index_block_hash match the header / proof. */
437
+ headerSelfConsistent: boolean;
438
+ /** Basis points (0–10000) of reward-set signer weight that signed the block.
439
+ * Only set when the proof carries a `consensus` field. */
440
+ signerWeightBps?: number;
441
+ /** ≥70% of signer weight signed. Only set with a `consensus` field. */
442
+ thresholdMet?: boolean;
443
+ /** Which reward set the signer check used: "provided" (caller-resolved →
444
+ * fully trustless) or "embedded" (the one Secondlayer put in the proof). */
445
+ rewardSetSource?: "provided" | "embedded";
446
+ /** All applicable checks passed (incl. the threshold when consensus is present). */
447
+ ok: boolean;
448
+ errors: string[];
449
+ }
450
+ /**
451
+ * Resolve a reward set directly from a stacks-node (`/v3/stacker_set/{cycle}`),
452
+ * so a caller can verify the consensus layer against a node IT trusts rather than
453
+ * the reward set Secondlayer embedded in the proof. Pass the result as
454
+ * `verifyTransactionProof(proof, { rewardSet })`.
455
+ */
456
+ declare function fetchRewardSet(opts: {
457
+ nodeUrl: string
458
+ cycle: number
459
+ fetchImpl?: typeof fetch
460
+ }): Promise<RewardSet | null>;
461
+ /**
462
+ * Verify a transaction-inclusion proof. Every check is recomputed client-side,
463
+ * so a `true` result does not rely on trusting Secondlayer. Pass
464
+ * `{ rewardSet }` (resolved via {@link fetchRewardSet} from your own node) to
465
+ * verify the consensus layer against a reward set you trust rather than the one
466
+ * embedded in the proof.
467
+ */
468
+ declare function verifyTransactionProof(proof: TransactionProof, opts?: {
469
+ rewardSet?: RewardSet
470
+ }): TransactionProofVerifyResult;
381
471
  type IndexTip = {
382
472
  block_height: number
383
473
  lag_seconds: number
@@ -582,6 +672,9 @@ type EventsListParams = {
582
672
  recipient?: string
583
673
  fromHeight?: number
584
674
  toHeight?: number
675
+ /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
676
+ * Mutually exclusive with contractId; contract-keyed event types only. */
677
+ trait?: string
585
678
  };
586
679
  type EventsWalkParams = Omit<EventsListParams, "limit"> & {
587
680
  batchSize?: number
@@ -616,6 +709,9 @@ type ContractCallsListParams = {
616
709
  sender?: string
617
710
  fromHeight?: number
618
711
  toHeight?: number
712
+ /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
713
+ * Mutually exclusive with contractId. */
714
+ trait?: string
619
715
  };
620
716
  type ContractCallsWalkParams = Omit<ContractCallsListParams, "limit"> & {
621
717
  batchSize?: number
@@ -872,10 +968,30 @@ type MempoolWalkParams = Omit<MempoolListParams, "limit"> & {
872
968
  batchSize?: number
873
969
  signal?: AbortSignal
874
970
  };
971
+ /** Per-event-type filter vocabulary in the {@link IndexDiscovery} doc. */
972
+ type IndexEventTypeFilters = {
973
+ columns?: string[]
974
+ allowed_filters?: string[]
975
+ equality_filters?: string[]
976
+ required_non_null?: string[]
977
+ };
978
+ /** The `GET /v1/index` discovery doc — live endpoint + filter vocabulary.
979
+ * Shape is intentionally open (the server may add fields); the agent-relevant
980
+ * parts are the per-type filter rules. */
981
+ type IndexDiscovery = {
982
+ event_type_filters?: Record<string, IndexEventTypeFilters>
983
+ [key: string]: unknown
984
+ };
875
985
  declare class Index extends BaseClient {
876
986
  constructor(options?: Partial<SecondLayerOptions>);
877
987
  /** Your own Index consumption (decoded events today + this month) and tier limits. */
878
988
  usage(): Promise<IndexUsage>;
989
+ /**
990
+ * Index discovery doc — the live vocabulary: every endpoint, each event type's
991
+ * columns, allowed/equality filters, and required-non-null fields. Read this to
992
+ * learn what's queryable (and which types accept `trait`) instead of hardcoding.
993
+ */
994
+ discover(): Promise<IndexDiscovery>;
879
995
  readonly ftTransfers: {
880
996
  list: (params?: FtTransfersListParams) => Promise<FtTransfersEnvelope>
881
997
  walk: (params?: FtTransfersWalkParams) => AsyncIterable<FtTransfer>
@@ -911,6 +1027,7 @@ declare class Index extends BaseClient {
911
1027
  list: (params?: TransactionsListParams) => Promise<TransactionsEnvelope>
912
1028
  walk: (params?: TransactionsWalkParams) => AsyncIterable<IndexTransaction>
913
1029
  get: (txId: string) => Promise<TransactionEnvelope | null>
1030
+ getProof: (txId: string) => Promise<TransactionProof | null>
914
1031
  };
915
1032
  /** Decoded PoX-4 stacking actions. Empty (with a `notes` hint) when the
916
1033
  * platform's PoX-4 decoder is disabled. */
@@ -940,6 +1057,11 @@ declare class Index extends BaseClient {
940
1057
  private walkBlocks;
941
1058
  private listTransactions;
942
1059
  private getTransaction;
1060
+ /** Fetch the inclusion proof for a tx (raw tx + Nakamoto header + merkle path)
1061
+ * to verify client-side with `verifyTransactionProof`. 404 → null. A 503
1062
+ * (`PROOF_TX_SET_INCOMPLETE` / `PROOF_NODE_UNAVAILABLE`) surfaces as an
1063
+ * ApiError — the proof can't be assembled on this deployment right now. */
1064
+ private getTransactionProof;
943
1065
  private walkTransactions;
944
1066
  private listStacking;
945
1067
  private walkStacking;
@@ -1422,6 +1544,7 @@ declare class Subscriptions extends BaseClient {
1422
1544
  replay(id: string, range: {
1423
1545
  fromBlock: number
1424
1546
  toBlock: number
1547
+ force?: string
1425
1548
  }): Promise<ReplayResult>;
1426
1549
  dead(id: string): Promise<{
1427
1550
  data: DeadRow[]
@@ -1995,85 +2118,6 @@ declare function verifyWebhookSignature(rawBody: string, headers: WebhookHeaderI
1995
2118
  * ```
1996
2119
  */
1997
2120
  declare function verifySecondlayerSignature(rawBody: string, headers: WebhookHeaderInput, publicKeyPem: string): boolean;
1998
- import { RewardSet } from "@secondlayer/shared/node/consensus";
1999
- import { MerkleProofStep } from "@secondlayer/shared/node/nakamoto";
2000
- /**
2001
- * Trustless transaction-inclusion proof verification.
2002
- *
2003
- * Given a proof from `GET /v1/index/transactions/:txid/proof`, the consumer
2004
- * re-derives everything itself — it does NOT trust any value Secondlayer
2005
- * computed. Anchored level: (1) recompute the txid from the raw tx bytes, (2)
2006
- * fold it up the merkle path to the header's `tx_merkle_root`, (3) recompute the
2007
- * header's `block_hash` and `index_block_hash` from the raw header — "this tx is
2008
- * included in a header any node can corroborate". Consensus level (when the proof
2009
- * carries a `consensus` field, or a `rewardSet` is passed): additionally recover
2010
- * the header's signer signatures and confirm ≥70% of reward-set signer weight
2011
- * signed the block.
2012
- *
2013
- * Note: uses Node's crypto via `@secondlayer/shared` (same as the Streams
2014
- * signature verify); intended for Node/server verification.
2015
- */
2016
- interface TransactionProof {
2017
- txid: string;
2018
- index_block_hash: string;
2019
- block_height: number;
2020
- tx_index: number;
2021
- /** Raw consensus-serialized transaction bytes (hex). */
2022
- raw_tx: string;
2023
- /** Raw Nakamoto block-header bytes (hex) — parsed + re-hashed by the verifier. */
2024
- raw_header: string;
2025
- /** Authentication path from the tx leaf to `tx_merkle_root`. */
2026
- tx_merkle_path: MerkleProofStep[];
2027
- /** Present when consensus-level verification is available: the reward cycle and
2028
- * its signer set, against which the header's signer signatures are checked. */
2029
- consensus?: {
2030
- reward_cycle: number
2031
- reward_set: RewardSet
2032
- };
2033
- }
2034
- interface TransactionProofVerifyResult {
2035
- /** Highest level actually verified. "consensus" requires the proof's
2036
- * `consensus` field and a met signer-weight threshold. */
2037
- level: "anchored" | "consensus";
2038
- /** Recomputed txid === proof.txid. */
2039
- txidMatches: boolean;
2040
- /** Merkle path folds the txid to the header's tx_merkle_root. */
2041
- includedInHeader: boolean;
2042
- /** Recomputed block_hash + index_block_hash match the header / proof. */
2043
- headerSelfConsistent: boolean;
2044
- /** Basis points (0–10000) of reward-set signer weight that signed the block.
2045
- * Only set when the proof carries a `consensus` field. */
2046
- signerWeightBps?: number;
2047
- /** ≥70% of signer weight signed. Only set with a `consensus` field. */
2048
- thresholdMet?: boolean;
2049
- /** Which reward set the signer check used: "provided" (caller-resolved →
2050
- * fully trustless) or "embedded" (the one Secondlayer put in the proof). */
2051
- rewardSetSource?: "provided" | "embedded";
2052
- /** All applicable checks passed (incl. the threshold when consensus is present). */
2053
- ok: boolean;
2054
- errors: string[];
2055
- }
2056
- /**
2057
- * Resolve a reward set directly from a stacks-node (`/v3/stacker_set/{cycle}`),
2058
- * so a caller can verify the consensus layer against a node IT trusts rather than
2059
- * the reward set Secondlayer embedded in the proof. Pass the result as
2060
- * `verifyTransactionProof(proof, { rewardSet })`.
2061
- */
2062
- declare function fetchRewardSet(opts: {
2063
- nodeUrl: string
2064
- cycle: number
2065
- fetchImpl?: typeof fetch
2066
- }): Promise<RewardSet | null>;
2067
- /**
2068
- * Verify a transaction-inclusion proof. Every check is recomputed client-side,
2069
- * so a `true` result does not rely on trusting Secondlayer. Pass
2070
- * `{ rewardSet }` (resolved via {@link fetchRewardSet} from your own node) to
2071
- * verify the consensus layer against a reward set you trust rather than the one
2072
- * embedded in the proof.
2073
- */
2074
- declare function verifyTransactionProof(proof: TransactionProof, opts?: {
2075
- rewardSet?: RewardSet
2076
- }): TransactionProofVerifyResult;
2077
2121
  import { RewardSet as RewardSet2 } from "@secondlayer/shared/node/consensus";
2078
2122
  /** Make a cvToValue result JSON-serializable: Clarity (u)ints decode to bigint,
2079
2123
  * which JSON.stringify can't handle — convert recursively to strings. */
@@ -2081,4 +2125,4 @@ declare function toJsonSafe(value: unknown): unknown;
2081
2125
  /** Decode a hex-encoded Clarity value to JSON-safe JS (uints as strings,
2082
2126
  * buffers as `0x…` hex, tuples as objects). Returns the input hex on failure. */
2083
2127
  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 };
2128
+ 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
@@ -417,6 +417,16 @@ class Contracts extends BaseClient {
417
417
  cursor: params.cursor
418
418
  })}`);
419
419
  }
420
+ async get(contractId, opts = {}) {
421
+ try {
422
+ const { contract } = await this.request("GET", `/v1/contracts/${encodeURIComponent(contractId)}${opts.includeAbi ? "?include=abi" : ""}`);
423
+ return contract;
424
+ } catch (err) {
425
+ if (err instanceof ApiError && err.status === 404)
426
+ return null;
427
+ throw err;
428
+ }
429
+ }
420
430
  }
421
431
 
422
432
  // src/datasets/client.ts
@@ -593,6 +603,9 @@ class Index extends BaseClient {
593
603
  usage() {
594
604
  return this.request("GET", "/v1/index/usage");
595
605
  }
606
+ discover() {
607
+ return this.request("GET", "/v1/index");
608
+ }
596
609
  ftTransfers = {
597
610
  list: (params = {}) => this.listFtTransfers(params),
598
611
  walk: (params = {}) => this.walkFtTransfers(params)
@@ -621,7 +634,8 @@ class Index extends BaseClient {
621
634
  transactions = {
622
635
  list: (params = {}) => this.listTransactions(params),
623
636
  walk: (params = {}) => this.walkTransactions(params),
624
- get: (txId) => this.getTransaction(txId)
637
+ get: (txId) => this.getTransaction(txId),
638
+ getProof: (txId) => this.getTransactionProof(txId)
625
639
  };
626
640
  stacking = {
627
641
  list: (params = {}) => this.listStacking(params),
@@ -718,7 +732,8 @@ class Index extends BaseClient {
718
732
  sender: params.sender,
719
733
  recipient: params.recipient,
720
734
  from_height: params.fromHeight,
721
- to_height: params.toHeight
735
+ to_height: params.toHeight,
736
+ trait: params.trait
722
737
  })}`);
723
738
  }
724
739
  async* walkEvents(params) {
@@ -755,7 +770,8 @@ class Index extends BaseClient {
755
770
  function_name: params.functionName,
756
771
  sender: params.sender,
757
772
  from_height: params.fromHeight,
758
- to_height: params.toHeight
773
+ to_height: params.toHeight,
774
+ trait: params.trait
759
775
  })}`);
760
776
  }
761
777
  async* walkContractCalls(params = {}) {
@@ -881,6 +897,15 @@ class Index extends BaseClient {
881
897
  throw err;
882
898
  }
883
899
  }
900
+ async getTransactionProof(txId) {
901
+ try {
902
+ return await this.request("GET", `/v1/index/transactions/${encodeURIComponent(txId)}/proof`);
903
+ } catch (err) {
904
+ if (err instanceof ApiError && err.status === 404)
905
+ return null;
906
+ throw err;
907
+ }
908
+ }
884
909
  async* walkTransactions(params = {}) {
885
910
  const batchSize = params.batchSize ?? 200;
886
911
  let cursor = params.cursor ?? params.fromCursor ?? null;
@@ -1697,7 +1722,8 @@ class SecondLayer extends BaseClient {
1697
1722
  this.streams = createStreamsClient({
1698
1723
  apiKey: options.apiKey ?? "",
1699
1724
  baseUrl: options.baseUrl,
1700
- fetchImpl: options.fetchImpl
1725
+ fetchImpl: options.fetchImpl,
1726
+ dumpsBaseUrl: options.dumpsBaseUrl
1701
1727
  });
1702
1728
  this.index = new Index(options);
1703
1729
  this.datasets = new Datasets(options);
@@ -2243,5 +2269,5 @@ export {
2243
2269
  ApiError
2244
2270
  };
2245
2271
 
2246
- //# debugId=8B8F4DFD96F5A43C64756E2164756E21
2272
+ //# debugId=AD881ECDD1B046B864756E2164756E21
2247
2273
  //# sourceMappingURL=index.js.map