@secondlayer/sdk 13.2.0 → 14.0.1
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 +59 -22
- package/dist/index.js +4 -2
- package/dist/index.js.map +4 -4
- package/dist/streams/index.js +4 -2
- package/dist/streams/index.js.map +3 -3
- package/dist/subgraphs/index.d.ts +58 -21
- package/dist/subgraphs/index.js +4 -2
- package/dist/subgraphs/index.js.map +4 -4
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -2315,38 +2315,74 @@ interface SbtcResource {
|
|
|
2315
2315
|
/** The peg scoreboard — a single all-time aggregate (no pagination). */
|
|
2316
2316
|
summary(): Promise<SbtcSummaryEnvelope>;
|
|
2317
2317
|
}
|
|
2318
|
-
/**
|
|
2319
|
-
type IndexPoxFunctionCount = {
|
|
2320
|
-
function_name: string;
|
|
2321
|
-
count: number;
|
|
2322
|
-
};
|
|
2323
|
-
/** Aggregate stats for one PoX reward cycle — distinct from `index.stacking`
|
|
2324
|
-
* (decoded per-call PoX-4 actions); this is the reward-cycle rollup. */
|
|
2318
|
+
/** One pox-5 reward cycle, exact to the node. */
|
|
2325
2319
|
type IndexPoxCycle = {
|
|
2326
2320
|
reward_cycle: number;
|
|
2327
|
-
/**
|
|
2321
|
+
/** Bitcoin block at which this cycle starts. */
|
|
2322
|
+
start_burn_height: number;
|
|
2323
|
+
/** Bitcoin block at which this cycle's totals froze (the prior cycle's prepare phase). */
|
|
2324
|
+
prepare_start_burn_height: number;
|
|
2325
|
+
/** Bitcoin block at which this cycle ends. */
|
|
2326
|
+
end_burn_height: number;
|
|
2327
|
+
/** STX + bond ustx delegated to signers this cycle (bigint-safe string). */
|
|
2328
2328
|
total_stacked_ustx: string;
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2329
|
+
/** STX actually counted toward rewards — signers below the 50k STX threshold don't count. */
|
|
2330
|
+
reward_eligible_ustx: string;
|
|
2331
|
+
/** Distinct stakers (STX and bond) with a position this cycle. */
|
|
2332
|
+
stakers: number;
|
|
2333
|
+
/** Signers that met the 50,000 STX delegation threshold this cycle. */
|
|
2334
|
+
signers_in_set: number;
|
|
2335
|
+
/** Bond index (as a string key) -> sats staked for this cycle. */
|
|
2336
|
+
bond_sats: Record<string, string>;
|
|
2337
|
+
bond_total_sats: string;
|
|
2338
|
+
/** sBTC currently custodied by pox-5 (non-L1 bonds only) — a running total,
|
|
2339
|
+
* not scoped to this cycle. Not in this endpoint: unclaimed/pending rewards. */
|
|
2340
|
+
sbtc_custodied_sats: string;
|
|
2341
|
+
rewards_allocated_stx: string;
|
|
2342
|
+
rewards_allocated_bond: string;
|
|
2343
|
+
reserve_deposit: string;
|
|
2344
|
+
/** Cumulative STX rewards per micro-STX for this cycle; `null` before the first distribution. */
|
|
2345
|
+
rewards_per_token_stx: string | null;
|
|
2346
|
+
/** Bond index (as a string key) -> cumulative rewards-per-sat for this cycle. */
|
|
2347
|
+
rewards_per_token_bond: Record<string, string>;
|
|
2348
|
+
/** Distributions run for this cycle so far (0, 1, or 2). */
|
|
2349
|
+
distributions: number;
|
|
2350
|
+
rewards_claimed: string;
|
|
2351
|
+
/** Stacks block height this rollup was last computed through. */
|
|
2352
|
+
computed_through_height: number;
|
|
2353
|
+
/** True for the cycle containing the tip's burn height. */
|
|
2335
2354
|
is_current: boolean;
|
|
2336
|
-
|
|
2355
|
+
/** True once totals can no longer change (the tip has reached
|
|
2356
|
+
* `prepare_start_burn_height`). Closed and current cycles are always
|
|
2357
|
+
* frozen; only a not-yet-started future cycle is open. */
|
|
2358
|
+
is_frozen: boolean;
|
|
2359
|
+
};
|
|
2360
|
+
/** One signer's share of a pox-5 reward cycle. */
|
|
2361
|
+
type IndexPoxCycleSigner = {
|
|
2362
|
+
signer: string;
|
|
2363
|
+
/** Total ustx delegated to this signer this cycle (STX + bond). */
|
|
2364
|
+
delegated_ustx: string;
|
|
2365
|
+
/** STX-only (non-bond) ustx delegated to this signer this cycle. */
|
|
2366
|
+
stx_only_ustx: string;
|
|
2367
|
+
/** STX shares counted toward rewards — 0 unless the signer met the 50k threshold. */
|
|
2368
|
+
reward_shares_ustx: string;
|
|
2369
|
+
in_set: boolean;
|
|
2370
|
+
rewards_claimed: string;
|
|
2337
2371
|
};
|
|
2338
2372
|
type PoxCyclesEnvelope = {
|
|
2373
|
+
/** The PoX version this response reports. Currently 5. */
|
|
2374
|
+
pox_version: 5;
|
|
2339
2375
|
cycles: IndexPoxCycle[];
|
|
2340
2376
|
/** The next `reward_cycle` to page from (cycles descend), or null at the end. */
|
|
2341
2377
|
next_cursor: number | null;
|
|
2342
2378
|
tip: IndexTip;
|
|
2343
|
-
/** Present only when the PoX-4 decoder is disabled, explaining an empty feed. */
|
|
2344
|
-
notes?: string;
|
|
2345
2379
|
};
|
|
2346
2380
|
type PoxCycleEnvelope = {
|
|
2347
|
-
|
|
2381
|
+
pox_version: 5;
|
|
2382
|
+
cycle: IndexPoxCycle & {
|
|
2383
|
+
signers: IndexPoxCycleSigner[];
|
|
2384
|
+
};
|
|
2348
2385
|
tip: IndexTip;
|
|
2349
|
-
notes?: string;
|
|
2350
2386
|
};
|
|
2351
2387
|
type PoxCyclesListParams = {
|
|
2352
2388
|
/** A `reward_cycle` to page from; the page returns cycles below it (descending). */
|
|
@@ -2354,12 +2390,13 @@ type PoxCyclesListParams = {
|
|
|
2354
2390
|
limit?: number;
|
|
2355
2391
|
};
|
|
2356
2392
|
type PoxCyclesWalkParams = Omit<PoxCyclesListParams, "limit"> & WalkOptions;
|
|
2357
|
-
/** `index.pox` — PoX
|
|
2393
|
+
/** `index.pox` — reward cycles of the current PoX (PoX-5). */
|
|
2358
2394
|
interface PoxResource {
|
|
2359
2395
|
cycles: {
|
|
2360
2396
|
list(params?: PoxCyclesListParams): Promise<PoxCyclesEnvelope>;
|
|
2361
2397
|
walk(params?: PoxCyclesWalkParams): AsyncIterable<IndexPoxCycle>;
|
|
2362
|
-
/** Fetch one reward cycle
|
|
2398
|
+
/** Fetch one reward cycle by number; 404 (unknown cycle, or below pox-5's
|
|
2399
|
+
* first reward cycle 141 — final PoX-4 history, not served here) → null. */
|
|
2363
2400
|
get(rewardCycle: number): Promise<PoxCycleEnvelope | null>;
|
|
2364
2401
|
};
|
|
2365
2402
|
}
|
|
@@ -3686,4 +3723,4 @@ declare const Cursor: {
|
|
|
3686
3723
|
};
|
|
3687
3724
|
};
|
|
3688
3725
|
import { decodeClarityValue, toJsonSafe } from "@secondlayer/shared/streams-rows";
|
|
3689
|
-
export { ACCOUNT_KEY_ENV, ActiveSubgraphOperation, ApiError, ArchiveAuthError, ArchiveClient, ArchiveCreditsBalance, ArchiveDataset, ArchiveFetchItem, ArchiveFetchResult, ArchiveFlow, ArchiveGateNotConfiguredError, ArchiveLoadOptions, ArchiveManifest, ArchivePartition, ArchiveQuote, ArchiveSignatureError, ArchiveStatus, ArchiveVerifyInput, ArchiveVerifyRangeStatus, ArchiveVerifyResult, AuthError, BlockEnvelope, BlocksEnvelope, BlocksListParams, BlocksWalkParams, CanonicalEnvelope, CanonicalListParams, CanonicalWalkParams, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTrigger, ChainTriggerType, ChainTxLevelEvent, ChainWebhookDelivery2 as ChainWebhookDelivery, ChainWebhookEnvelope, ConsumerBatchContext, ConsumerHealth, ConsumerSink, ContextAccount, ContextField, ContextFieldError, ContextSnapshot, ContractCallsConsumeParams, ContractCallsEnvelope, ContractCallsListParams, ContractCallsWalkParams, ContractConformance, ContractSummary, Contracts, ContractsEnvelope, ContractsListParams, CreateArchiveClientOptions, CreateWebhookRequest2 as CreateWebhookRequest, CreateWebhookResponse2 as CreateWebhookResponse, Cursor, DEFAULT_REQUEST_TIMEOUT_MS, DOWN_MIN_CONSECUTIVE, DeadRow2 as DeadRow, DecodedEventColumns, DecodedEventRow, DecodedFtBurn, DecodedFtBurnPayload, DecodedFtMint, DecodedFtMintPayload, DecodedFtTransfer, DecodedFtTransferPayload, DecodedNftBurn, DecodedNftBurnPayload, DecodedNftMint, DecodedNftMintPayload, DecodedNftTransfer, DecodedNftTransferPayload, DecodedPrint, DecodedPrintPayload, DecodedPrintValue, DecodedStxBurn, DecodedStxBurnPayload, DecodedStxLock, DecodedStxLockPayload, DecodedStxMint, DecodedStxMintPayload, DecodedStxTransfer, DecodedStxTransferPayload, DeliveryRow2 as DeliveryRow, DoctorEvidence, DoctorFix, DoctorIssue, DoctorIssueCode, DoctorReport, DoctorSeverity, EtagCache, EtagEntry, EventsConsumeParams, EventsEnvelope, EventsListParams, EventsWalkParams, FetchLike2 as FetchLike, FtTransfer, FtTransferEvent, FtTransferPayload2 as FtTransferPayload, FtTransfersEnvelope, FtTransfersListParams, FtTransfersResource, FtTransfersWalkParams, INDEX_MAX_PAGE_SIZE, INSTANCE_TOKEN_ENV, Index, IndexAlwaysFields, IndexBitcoinTip, IndexBlock, IndexBtcReorg, IndexCanonicalBlock, IndexConsumeOptions, IndexContractCall, IndexDiscovery, IndexEvent, IndexEventFields, IndexEventOf, IndexEventType, IndexEventTypeFilters, IndexEventsResource, IndexFeedEnvelope, IndexFeedFetcher, IndexFeedItem, IndexFtBurn, IndexFtMint, IndexFtTransfer, IndexMapDelete, IndexMapInsert, IndexMapSet, IndexMempoolTransaction, IndexNestedContractCall, IndexNftBurn, IndexNftMint, IndexNftTransfer, IndexPostCondition, IndexPox5Event, IndexPox5EventTopic, IndexPoxCycle,
|
|
3726
|
+
export { ACCOUNT_KEY_ENV, ActiveSubgraphOperation, ApiError, ArchiveAuthError, ArchiveClient, ArchiveCreditsBalance, ArchiveDataset, ArchiveFetchItem, ArchiveFetchResult, ArchiveFlow, ArchiveGateNotConfiguredError, ArchiveLoadOptions, ArchiveManifest, ArchivePartition, ArchiveQuote, ArchiveSignatureError, ArchiveStatus, ArchiveVerifyInput, ArchiveVerifyRangeStatus, ArchiveVerifyResult, AuthError, BlockEnvelope, BlocksEnvelope, BlocksListParams, BlocksWalkParams, CanonicalEnvelope, CanonicalListParams, CanonicalWalkParams, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTrigger, ChainTriggerType, ChainTxLevelEvent, ChainWebhookDelivery2 as ChainWebhookDelivery, ChainWebhookEnvelope, ConsumerBatchContext, ConsumerHealth, ConsumerSink, ContextAccount, ContextField, ContextFieldError, ContextSnapshot, ContractCallsConsumeParams, ContractCallsEnvelope, ContractCallsListParams, ContractCallsWalkParams, ContractConformance, ContractSummary, Contracts, ContractsEnvelope, ContractsListParams, CreateArchiveClientOptions, CreateWebhookRequest2 as CreateWebhookRequest, CreateWebhookResponse2 as CreateWebhookResponse, Cursor, DEFAULT_REQUEST_TIMEOUT_MS, DOWN_MIN_CONSECUTIVE, DeadRow2 as DeadRow, DecodedEventColumns, DecodedEventRow, DecodedFtBurn, DecodedFtBurnPayload, DecodedFtMint, DecodedFtMintPayload, DecodedFtTransfer, DecodedFtTransferPayload, DecodedNftBurn, DecodedNftBurnPayload, DecodedNftMint, DecodedNftMintPayload, DecodedNftTransfer, DecodedNftTransferPayload, DecodedPrint, DecodedPrintPayload, DecodedPrintValue, DecodedStxBurn, DecodedStxBurnPayload, DecodedStxLock, DecodedStxLockPayload, DecodedStxMint, DecodedStxMintPayload, DecodedStxTransfer, DecodedStxTransferPayload, DeliveryRow2 as DeliveryRow, DoctorEvidence, DoctorFix, DoctorIssue, DoctorIssueCode, DoctorReport, DoctorSeverity, EtagCache, EtagEntry, EventsConsumeParams, EventsEnvelope, EventsListParams, EventsWalkParams, FetchLike2 as FetchLike, FtTransfer, FtTransferEvent, FtTransferPayload2 as FtTransferPayload, FtTransfersEnvelope, FtTransfersListParams, FtTransfersResource, FtTransfersWalkParams, INDEX_MAX_PAGE_SIZE, INSTANCE_TOKEN_ENV, Index, IndexAlwaysFields, IndexBitcoinTip, IndexBlock, IndexBtcReorg, IndexCanonicalBlock, IndexConsumeOptions, IndexContractCall, IndexDiscovery, IndexEvent, IndexEventFields, IndexEventOf, IndexEventType, IndexEventTypeFilters, IndexEventsResource, IndexFeedEnvelope, IndexFeedFetcher, IndexFeedItem, IndexFtBurn, IndexFtMint, IndexFtTransfer, IndexMapDelete, IndexMapInsert, IndexMapSet, IndexMempoolTransaction, IndexNestedContractCall, IndexNftBurn, IndexNftMint, IndexNftTransfer, IndexPostCondition, IndexPox5Event, IndexPox5EventTopic, IndexPoxCycle, IndexPoxCycleSigner, IndexPrint, IndexReorg, IndexRuneBalance, IndexRuneEntry, IndexRuneEvent, IndexRuneEventKind, IndexRuneRefSummary, IndexRuneTerms, IndexSbtcDeposit, IndexSbtcDepositDetail, IndexSbtcEvent, IndexSbtcSummary, IndexSbtcWithdrawal, IndexSbtcWithdrawalDetail, IndexSbtcWithdrawalPhase, IndexStackingAction, IndexStxBurn, IndexStxLock, IndexStxMint, IndexStxTransfer, IndexTip, IndexTransaction, IndexVarSet, InstanceClient, InstanceDiagnosis3 as InstanceDiagnosis, InstanceIssue, InstanceState, InstanceStatus, InsufficientArchiveCreditsError, LOCAL_API_URL, LoadedArchive, MemoryEtagCache, MempoolEnvelope, MempoolListParams, MempoolTransactionEnvelope, MempoolWalkParams, NftTransfer, NftTransferEvent, NftTransferPayload2 as NftTransferPayload, NftTransfersEnvelope, NftTransfersListParams, NftTransfersResource, NftTransfersWalkParams, Pox5EventsConsumeParams, Pox5EventsEnvelope, Pox5EventsListParams, Pox5EventsWalkParams, Pox5Resource, PoxCycleEnvelope, PoxCyclesEnvelope, PoxCyclesListParams, PoxCyclesWalkParams, PoxResource, PrintSchemaResponse, PublicStatus2 as PublicStatus, RateLimitError, ReplayResult2 as ReplayResult, RequestOptions, RewardSet2 as RewardSet, RotateSecretResponse2 as RotateSecretResponse, RuneActivityEnvelope, RuneActivityListParams, RuneActivityWalkParams, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneBalancesEnvelope, RuneBalancesListParams, RuneEnvelope, RuneEtchEntry, RuneEventPayload, RuneEventType, RuneId, RuneRef, RuneStreamsEvent, RunesEnvelope, RunesListParams, RunesResource, SbtcDepositEnvelope, SbtcDepositEvent, SbtcDepositsConsumeParams, SbtcDepositsEnvelope, SbtcDepositsListParams, SbtcDepositsWalkParams, SbtcEventTopic2 as SbtcEventTopic, SbtcEventsConsumeParams, SbtcEventsEnvelope, SbtcEventsListParams, SbtcEventsWalkParams, SbtcResource, SbtcSummaryEnvelope, SbtcWithdrawalEnvelope, SbtcWithdrawalEvent, SbtcWithdrawalStatus, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalsEnvelope, SbtcWithdrawalsListParams, SbtcWithdrawalsWalkParams, SecondLayer, SecondLayerArchive, SecondLayerError, SecondLayerErrorOptions, SecondLayerOptions, SinkTx, StackingEnvelope, StackingListParams, StackingWalkParams, StandardWebhooksHeaders2 as StandardWebhooksHeaders, StreamsBatch, StreamsBatchContext, StreamsBitcoinCanonicalBlock, StreamsBitcoinTip, StreamsCanonicalBlock, StreamsClient, StreamsConsumeBitcoinParams, StreamsConsumeParams, StreamsConsumeStacksParams, StreamsDumpFile, StreamsDumps, StreamsDumpsManifest, StreamsEvent, StreamsEventPayload, StreamsEventType, StreamsEventsBitcoinListParams, StreamsEventsConsumeBitcoinParams, StreamsEventsConsumeParams, StreamsEventsConsumeResult, StreamsEventsEnvelope, StreamsEventsListEnvelope, StreamsEventsListParams, StreamsEventsStacksListParams, StreamsEventsStreamBitcoinParams, StreamsEventsStreamParams, StreamsEventsStreamStacksParams, StreamsEventsSubscribeBitcoinParams, StreamsEventsSubscribeParams, StreamsEventsSubscribeStacksParams, StreamsReorg, StreamsReorgContext, StreamsReorgsListEnvelope, StreamsReorgsListParams, StreamsServerError, StreamsSignatureError, StreamsSubscription, StreamsTip, StreamsWireEvent2 as StreamsWireEvent, SubgraphAgentSchema3 as SubgraphAgentSchema, SubgraphOperationStatus, SubgraphSpecFormat2 as SubgraphSpecFormat, SubgraphSpecOptions3 as SubgraphSpecOptions, Subgraphs, TransactionEnvelope, TransactionProof, TransactionProofVerifyResult, TransactionsEnvelope, TransactionsListParams, TransactionsWalkParams, UpdateWebhookRequest2 as UpdateWebhookRequest, ValidationError, VmStreamsEvent, WalkOptions, WebhookActivity2 as WebhookActivity, WebhookActivityHour, WebhookAuth, WebhookDeliveryDetail2 as WebhookDeliveryDetail, WebhookDetail2 as WebhookDetail, WebhookFormat, WebhookHeaderInput, WebhookKind, WebhookRuntime, WebhookStatus, WebhookSummary2 as WebhookSummary, WebhookTestResult2 as WebhookTestResult, Webhooks, WithSinkTx, buildDoctorReport, buildListIssue, consumeIndexFeed, consumerHealth, contextField, createArchiveClient, createStreamsClient, decode, decodeChainWebhook, decodeClarityValue, decodeFtBurn, decodeFtMint, decodeFtTransfer, decodeNftBurn, decodeNftMint, decodeNftTransfer, decodePrint, decodeStxBurn, decodeStxLock, decodeStxMint, decodeStxTransfer, fetchRewardSet, getSubgraph, isFtBurn, isFtMint, isFtTransfer, isNftBurn, isNftMint, isNftTransfer, isPrint, isStxBurn, isStxLock, isStxMint, isStxTransfer, isSuccessDelivery, parseRetryAfter, resolveAccountKey, resolveApiKey, resolveBaseUrl, shutdownSignal, toJsonSafe, trigger, verifySecondlayerSignature, verify as verifyStandardWebhooksHeaders, verifyTransactionProof, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -255,7 +255,9 @@ function parseErrorEnvelope(text) {
|
|
|
255
255
|
let code;
|
|
256
256
|
if (json && typeof json === "object") {
|
|
257
257
|
const err = json.error ?? json.message;
|
|
258
|
-
if (typeof err === "string" &&
|
|
258
|
+
if (typeof err === "string" && typeof json.message === "string" && json.message.length > 0) {
|
|
259
|
+
message = json.message;
|
|
260
|
+
} else if (typeof err === "string" && err.length > 0)
|
|
259
261
|
message = err;
|
|
260
262
|
else if (err && typeof err === "object")
|
|
261
263
|
message = JSON.stringify(err);
|
|
@@ -3437,5 +3439,5 @@ export {
|
|
|
3437
3439
|
verifyWebhookSignature
|
|
3438
3440
|
};
|
|
3439
3441
|
|
|
3440
|
-
//# debugId=
|
|
3442
|
+
//# debugId=5CEBD3F2D96129FA64756E2164756E21
|
|
3441
3443
|
//# sourceMappingURL=index.js.map
|