@secondlayer/sdk 6.52.1 → 6.54.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 +5 -2
- package/dist/index.js +39 -72
- package/dist/index.js.map +5 -5
- package/dist/streams/index.js +29 -49
- package/dist/streams/index.js.map +4 -4
- package/dist/subgraphs/index.d.ts +1 -1
- package/dist/subgraphs/index.js +37 -72
- package/dist/subgraphs/index.js.map +5 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ interface SecondLayerOptions {
|
|
|
17
17
|
/** Deploy origin label sent as `x-sl-origin` (telemetry). Defaults to `cli`. */
|
|
18
18
|
origin?: "cli" | "mcp" | "session";
|
|
19
19
|
}
|
|
20
|
+
/** Product default: the local one-box API. Override with `baseUrl` or `SL_API_URL`. */
|
|
21
|
+
declare const LOCAL_API_URL = "http://127.0.0.1:3800";
|
|
22
|
+
declare function resolveBaseUrl(explicit?: string): string;
|
|
20
23
|
/** Resolve the credential a client should use. An explicit `apiKey` option
|
|
21
24
|
* always wins — including an explicit `""`, which is how you opt a client
|
|
22
25
|
* back into keyless reads on a machine that has a key exported. Otherwise
|
|
@@ -2082,7 +2085,7 @@ type SbtcEventsWalkParams = Omit<SbtcEventsListParams, "limit"> & {
|
|
|
2082
2085
|
signal?: AbortSignal;
|
|
2083
2086
|
};
|
|
2084
2087
|
type SbtcEventsConsumeParams<TTx = never> = Omit<SbtcEventsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcEvent, SbtcEventsEnvelope, TTx>;
|
|
2085
|
-
type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
|
|
2088
|
+
type SbtcDepositsConsumeParams<TTx = never> = Omit<SbtcDepositsListParams, "cursor" | "fromCursor" | "limit" | "fields"> & IndexConsumeOptions<IndexSbtcDeposit, SbtcDepositsEnvelope, TTx>;
|
|
2086
2089
|
/** `index.sbtc` — the decoded sBTC peg surface (deposits, withdrawals, raw
|
|
2087
2090
|
* events, scoreboard). The only productized decoded sBTC peg feed on Stacks. */
|
|
2088
2091
|
interface SbtcResource {
|
|
@@ -3532,4 +3535,4 @@ declare function toJsonSafe(value: unknown): unknown;
|
|
|
3532
3535
|
/** Decode a hex-encoded Clarity value to JSON-safe JS (uints as strings,
|
|
3533
3536
|
* buffers as `0x…` hex, tuples as objects). Returns the input hex on failure. */
|
|
3534
3537
|
declare function decodeClarityValue(hex: string): unknown;
|
|
3535
|
-
export { withX402, verifyWebhookSignature, verifyTransactionProof, verify as verifyStandardWebhooksHeaders, verifySecondlayerSignature, trigger, toJsonSafe, shutdownSignal, selectOffer, resolveApiKey, resolveAccountNonce, readX402Receipt, readX402Challenge, payAndRetry, parseRetryAfter, 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, decodeChainWebhook, decode, createX402Client, createStreamsClient, consumerHealth, consumeIndexFeed, buildSignedX402Payment, X402SpendGuardError, X402Result, X402Receipt, X402Fetch, X402ClientOptions, X402Client, X402Challenge, X402Accept, WithX402Options, WithSinkTx, WebhookHeaderInput, 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, StreamsConsumeParams, StreamsClient, StreamsCanonicalBlock, StreamsBatchContext, StreamsBatch, StandardWebhooksHeaders2 as StandardWebhooksHeaders, StackingWalkParams, StackingListParams, StackingEnvelope, SinkTx, SelectOfferOptions, SecondLayerOptions, SecondLayerErrorOptions, SecondLayerError, SecondLayer, ScopedKeyProduct, SbtcWithdrawalsWalkParams, SbtcWithdrawalsListParams, SbtcWithdrawalsEnvelope, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalStatus, SbtcWithdrawalEvent, SbtcWithdrawalEnvelope, SbtcSummaryEnvelope, SbtcResource, SbtcEventsWalkParams, SbtcEventsListParams, SbtcEventsEnvelope, SbtcEventsConsumeParams, SbtcEventTopic2 as SbtcEventTopic, SbtcDepositsWalkParams, SbtcDepositsListParams, SbtcDepositsEnvelope, SbtcDepositsConsumeParams, SbtcDepositEvent, SbtcDepositEnvelope, RotateSecretResponse2 as RotateSecretResponse, RewardSet2 as RewardSet, ReplayResult2 as ReplayResult, RateLimitError, Projects, ProjectTeamMember, ProjectTeam, ProjectInvitation, Project, PrintSchemaResponse, PoxResource, PoxCyclesWalkParams, PoxCyclesListParams, PoxCyclesEnvelope, PoxCycleEnvelope, Pox5Resource, Pox5EventsWalkParams, Pox5EventsListParams, Pox5EventsEnvelope, PayAndRetryOptions, NftTransfersWalkParams, NftTransfersResource, NftTransfersListParams, NftTransfersEnvelope, NftTransferPayload, NftTransferEvent, NftTransfer, MempoolWalkParams, MempoolTransactionEnvelope, MempoolListParams, MempoolEnvelope, IndexUsage, IndexTransaction, IndexTip, IndexStxTransfer, IndexStxMint, IndexStxLock, IndexStxBurn, IndexStackingAction, IndexSbtcWithdrawalPhase, IndexSbtcWithdrawalDetail, IndexSbtcWithdrawal, IndexSbtcSummary, IndexSbtcEvent, IndexSbtcDepositDetail, IndexSbtcDeposit, IndexReorg, IndexPrint, IndexPoxFunctionCount, IndexPoxCycle, IndexPox5EventTopic, IndexPox5Event, IndexPostCondition, IndexNftTransfer, IndexNftMint, IndexNftBurn, IndexMempoolTransaction, IndexFtTransfer, IndexFtMint, IndexFtBurn, IndexFeedItem, IndexFeedFetcher, IndexFeedEnvelope, IndexEventsResource, IndexEventTypeFilters, IndexEventType, IndexEventOf, IndexEventFields, IndexEvent, IndexDiscovery, IndexContractCall, IndexConsumeOptions, IndexCanonicalBlock, IndexBlock, IndexAlwaysFields, Index, FtTransfersWalkParams, FtTransfersResource, FtTransfersListParams, FtTransfersEnvelope, FtTransferPayload, FtTransferEvent, FtTransfer, FetchLike2 as FetchLike, EventsWalkParams, EventsListParams, EventsEnvelope, EventsConsumeParams, 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, DEFAULT_PREFER_ASSETS, Cursor, CreateSubscriptionResponse2 as CreateSubscriptionResponse, CreateSubscriptionRequest2 as CreateSubscriptionRequest, CreateProjectParams, CreateApiKeyResponse, CreateApiKeyParams, ContractsListParams, ContractsEnvelope, Contracts, ContractSummary, ContractConformance, ContractCallsWalkParams, ContractCallsListParams, ContractCallsEnvelope, ContractCallsConsumeParams, ContextSnapshot, ContextProject, ContextApiKey, ContextAccount, ConsumerSink, ConsumerHealth, ConsumerBatchContext, ChainWebhookEnvelope, ChainWebhookDelivery2 as ChainWebhookDelivery, ChainTxLevelEvent, ChainTriggerType, ChainTrigger, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CanonicalWalkParams, CanonicalListParams, CanonicalEnvelope, ByoBreakingChangeError, ByoBreakingChangeDetails, BuildSignedX402PaymentOptions, BlocksWalkParams, BlocksListParams, BlocksEnvelope, BlockEnvelope, AuthError, ApiKeys, ApiKeySummary, ApiError, ActiveSubgraphOperation };
|
|
3538
|
+
export { withX402, verifyWebhookSignature, verifyTransactionProof, verify as verifyStandardWebhooksHeaders, verifySecondlayerSignature, trigger, toJsonSafe, shutdownSignal, selectOffer, resolveBaseUrl, resolveApiKey, resolveAccountNonce, readX402Receipt, readX402Challenge, payAndRetry, parseRetryAfter, 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, decodeChainWebhook, decode, createX402Client, createStreamsClient, consumerHealth, consumeIndexFeed, buildSignedX402Payment, X402SpendGuardError, X402Result, X402Receipt, X402Fetch, X402ClientOptions, X402Client, X402Challenge, X402Accept, WithX402Options, WithSinkTx, WebhookHeaderInput, 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, StreamsConsumeParams, StreamsClient, StreamsCanonicalBlock, StreamsBatchContext, StreamsBatch, StandardWebhooksHeaders2 as StandardWebhooksHeaders, StackingWalkParams, StackingListParams, StackingEnvelope, SinkTx, SelectOfferOptions, SecondLayerOptions, SecondLayerErrorOptions, SecondLayerError, SecondLayer, ScopedKeyProduct, SbtcWithdrawalsWalkParams, SbtcWithdrawalsListParams, SbtcWithdrawalsEnvelope, SbtcWithdrawalSweptConfirmedEvent, SbtcWithdrawalStatus, SbtcWithdrawalEvent, SbtcWithdrawalEnvelope, SbtcSummaryEnvelope, SbtcResource, SbtcEventsWalkParams, SbtcEventsListParams, SbtcEventsEnvelope, SbtcEventsConsumeParams, SbtcEventTopic2 as SbtcEventTopic, SbtcDepositsWalkParams, SbtcDepositsListParams, SbtcDepositsEnvelope, SbtcDepositsConsumeParams, SbtcDepositEvent, SbtcDepositEnvelope, RotateSecretResponse2 as RotateSecretResponse, RewardSet2 as RewardSet, ReplayResult2 as ReplayResult, RateLimitError, Projects, ProjectTeamMember, ProjectTeam, ProjectInvitation, Project, PrintSchemaResponse, PoxResource, PoxCyclesWalkParams, PoxCyclesListParams, PoxCyclesEnvelope, PoxCycleEnvelope, Pox5Resource, Pox5EventsWalkParams, Pox5EventsListParams, Pox5EventsEnvelope, PayAndRetryOptions, NftTransfersWalkParams, NftTransfersResource, NftTransfersListParams, NftTransfersEnvelope, NftTransferPayload, NftTransferEvent, NftTransfer, MempoolWalkParams, MempoolTransactionEnvelope, MempoolListParams, MempoolEnvelope, LOCAL_API_URL, IndexUsage, IndexTransaction, IndexTip, IndexStxTransfer, IndexStxMint, IndexStxLock, IndexStxBurn, IndexStackingAction, IndexSbtcWithdrawalPhase, IndexSbtcWithdrawalDetail, IndexSbtcWithdrawal, IndexSbtcSummary, IndexSbtcEvent, IndexSbtcDepositDetail, IndexSbtcDeposit, IndexReorg, IndexPrint, IndexPoxFunctionCount, IndexPoxCycle, IndexPox5EventTopic, IndexPox5Event, IndexPostCondition, IndexNftTransfer, IndexNftMint, IndexNftBurn, IndexMempoolTransaction, IndexFtTransfer, IndexFtMint, IndexFtBurn, IndexFeedItem, IndexFeedFetcher, IndexFeedEnvelope, IndexEventsResource, IndexEventTypeFilters, IndexEventType, IndexEventOf, IndexEventFields, IndexEvent, IndexDiscovery, IndexContractCall, IndexConsumeOptions, IndexCanonicalBlock, IndexBlock, IndexAlwaysFields, Index, FtTransfersWalkParams, FtTransfersResource, FtTransfersListParams, FtTransfersEnvelope, FtTransferPayload, FtTransferEvent, FtTransfer, FetchLike2 as FetchLike, EventsWalkParams, EventsListParams, EventsEnvelope, EventsConsumeParams, 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, DEFAULT_PREFER_ASSETS, Cursor, CreateSubscriptionResponse2 as CreateSubscriptionResponse, CreateSubscriptionRequest2 as CreateSubscriptionRequest, CreateProjectParams, CreateApiKeyResponse, CreateApiKeyParams, ContractsListParams, ContractsEnvelope, Contracts, ContractSummary, ContractConformance, ContractCallsWalkParams, ContractCallsListParams, ContractCallsEnvelope, ContractCallsConsumeParams, ContextSnapshot, ContextProject, ContextApiKey, ContextAccount, ConsumerSink, ConsumerHealth, ConsumerBatchContext, ChainWebhookEnvelope, ChainWebhookDelivery2 as ChainWebhookDelivery, ChainTxLevelEvent, ChainTriggerType, ChainTrigger, ChainTestDelivery, ChainStxTransferData, ChainStxMintData, ChainStxLockData, ChainStxBurnData, ChainReorgRollbackEnvelope, ChainReorgRollbackDelivery, ChainReorgOrphanedEntry, ChainPrintEventData, ChainNftTransferData, ChainNftMintData, ChainNftBurnData, ChainFtTransferData, ChainFtMintData, ChainFtBurnData, ChainEventEnvelope, ChainApplyEnvelopeOf, ChainApplyEnvelope, ChainApplyDeliveryOf, CanonicalWalkParams, CanonicalListParams, CanonicalEnvelope, ByoBreakingChangeError, ByoBreakingChangeDetails, BuildSignedX402PaymentOptions, BlocksWalkParams, BlocksListParams, BlocksEnvelope, BlockEnvelope, AuthError, ApiKeys, ApiKeySummary, ApiError, ActiveSubgraphOperation };
|
package/dist/index.js
CHANGED
|
@@ -156,7 +156,17 @@ function isByoBreakingDetails(x) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// src/base.ts
|
|
159
|
-
var
|
|
159
|
+
var LOCAL_API_URL = "http://127.0.0.1:3800";
|
|
160
|
+
function resolveBaseUrl(explicit) {
|
|
161
|
+
if (explicit && explicit.length > 0)
|
|
162
|
+
return explicit.replace(/\/+$/, "");
|
|
163
|
+
if (typeof process !== "undefined") {
|
|
164
|
+
const fromEnv = process.env?.SL_API_URL || process.env?.SECONDLAYER_API_URL;
|
|
165
|
+
if (fromEnv)
|
|
166
|
+
return fromEnv.replace(/\/+$/, "");
|
|
167
|
+
}
|
|
168
|
+
return LOCAL_API_URL;
|
|
169
|
+
}
|
|
160
170
|
function resolveApiKey(apiKey) {
|
|
161
171
|
if (apiKey !== undefined)
|
|
162
172
|
return apiKey;
|
|
@@ -184,7 +194,7 @@ class BaseClient {
|
|
|
184
194
|
origin;
|
|
185
195
|
fetchImpl;
|
|
186
196
|
constructor(options = {}) {
|
|
187
|
-
this.baseUrl = (options.baseUrl
|
|
197
|
+
this.baseUrl = resolveBaseUrl(options.baseUrl);
|
|
188
198
|
this.apiKey = resolveApiKey(options.apiKey);
|
|
189
199
|
this.origin = options.origin ?? "cli";
|
|
190
200
|
this.fetchImpl = options.fetchImpl ?? ((...args) => fetch(...args));
|
|
@@ -938,6 +948,10 @@ async function consumeIndexFeed(opts) {
|
|
|
938
948
|
}
|
|
939
949
|
|
|
940
950
|
// src/index-api/client.ts
|
|
951
|
+
function feedFilters(params) {
|
|
952
|
+
const { fromCursor: _checkpoint, ...filters } = params;
|
|
953
|
+
return filters;
|
|
954
|
+
}
|
|
941
955
|
function firstWalkFromHeight(params) {
|
|
942
956
|
if (params.fromHeight !== undefined)
|
|
943
957
|
return params.fromHeight;
|
|
@@ -983,14 +997,7 @@ class Index extends BaseClient {
|
|
|
983
997
|
consume: (params) => consumeIndexFeed({
|
|
984
998
|
...params,
|
|
985
999
|
fetchPage: ({ cursor, fromHeight, limit }) => this.listEvents({
|
|
986
|
-
|
|
987
|
-
contractId: params.contractId,
|
|
988
|
-
assetIdentifier: params.assetIdentifier,
|
|
989
|
-
sender: params.sender,
|
|
990
|
-
recipient: params.recipient,
|
|
991
|
-
trait: params.trait,
|
|
992
|
-
toHeight: params.toHeight,
|
|
993
|
-
txContext: params.txContext,
|
|
1000
|
+
...feedFilters(params),
|
|
994
1001
|
cursor,
|
|
995
1002
|
fromHeight,
|
|
996
1003
|
limit
|
|
@@ -1004,11 +1011,7 @@ class Index extends BaseClient {
|
|
|
1004
1011
|
consume: (params) => consumeIndexFeed({
|
|
1005
1012
|
...params,
|
|
1006
1013
|
fetchPage: ({ cursor, fromHeight, limit }) => this.listContractCalls({
|
|
1007
|
-
|
|
1008
|
-
functionName: params.functionName,
|
|
1009
|
-
sender: params.sender,
|
|
1010
|
-
trait: params.trait,
|
|
1011
|
-
toHeight: params.toHeight,
|
|
1014
|
+
...feedFilters(params),
|
|
1012
1015
|
cursor,
|
|
1013
1016
|
fromHeight,
|
|
1014
1017
|
limit
|
|
@@ -1047,10 +1050,7 @@ class Index extends BaseClient {
|
|
|
1047
1050
|
consume: (params) => consumeIndexFeed({
|
|
1048
1051
|
...params,
|
|
1049
1052
|
fetchPage: ({ cursor, fromHeight, limit }) => this.listSbtcDeposits({
|
|
1050
|
-
|
|
1051
|
-
sender: params.sender,
|
|
1052
|
-
bitcoinTxid: params.bitcoinTxid,
|
|
1053
|
-
toHeight: params.toHeight,
|
|
1053
|
+
...feedFilters(params),
|
|
1054
1054
|
cursor,
|
|
1055
1055
|
fromHeight,
|
|
1056
1056
|
limit
|
|
@@ -1070,12 +1070,7 @@ class Index extends BaseClient {
|
|
|
1070
1070
|
consume: (params) => consumeIndexFeed({
|
|
1071
1071
|
...params,
|
|
1072
1072
|
fetchPage: ({ cursor, fromHeight, limit }) => this.listSbtcEvents({
|
|
1073
|
-
|
|
1074
|
-
topic: params.topic,
|
|
1075
|
-
sender: params.sender,
|
|
1076
|
-
requestId: params.requestId,
|
|
1077
|
-
bitcoinTxid: params.bitcoinTxid,
|
|
1078
|
-
toHeight: params.toHeight,
|
|
1073
|
+
...feedFilters(params),
|
|
1079
1074
|
cursor,
|
|
1080
1075
|
fromHeight,
|
|
1081
1076
|
limit
|
|
@@ -1725,7 +1720,17 @@ function maxCursor(a, b) {
|
|
|
1725
1720
|
const [bh, bi] = cursorTuple(b);
|
|
1726
1721
|
return ah > bh || ah === bh && ai >= bi ? a : b;
|
|
1727
1722
|
}
|
|
1728
|
-
|
|
1723
|
+
function streamsFilters(params) {
|
|
1724
|
+
return {
|
|
1725
|
+
types: params.types,
|
|
1726
|
+
notTypes: params.notTypes,
|
|
1727
|
+
contractId: params.contractId,
|
|
1728
|
+
sender: params.sender,
|
|
1729
|
+
recipient: params.recipient,
|
|
1730
|
+
assetIdentifier: params.assetIdentifier,
|
|
1731
|
+
filters: params.filters
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1729
1734
|
function normalizeBaseUrl(baseUrl) {
|
|
1730
1735
|
return baseUrl.replace(/\/+$/, "");
|
|
1731
1736
|
}
|
|
@@ -1765,7 +1770,7 @@ async function mapStreamsError(response) {
|
|
|
1765
1770
|
throw new ValidationError(errorMessage(body, `Streams request returned ${response.status}.`), response.status, body);
|
|
1766
1771
|
}
|
|
1767
1772
|
function createStreamsClient(options) {
|
|
1768
|
-
const baseUrl = normalizeBaseUrl(options.baseUrl
|
|
1773
|
+
const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl));
|
|
1769
1774
|
const fetchImpl = options.fetchImpl ?? ((input, init) => fetch(input, init));
|
|
1770
1775
|
const verify = options.verify;
|
|
1771
1776
|
const verifyMode = verify === false ? "off" : verify === undefined ? "lenient" : "strict";
|
|
@@ -1836,29 +1841,7 @@ function createStreamsClient(options) {
|
|
|
1836
1841
|
}
|
|
1837
1842
|
return JSON.parse(text);
|
|
1838
1843
|
}
|
|
1839
|
-
const fetchEvents =
|
|
1840
|
-
cursor,
|
|
1841
|
-
limit,
|
|
1842
|
-
types,
|
|
1843
|
-
notTypes,
|
|
1844
|
-
contractId,
|
|
1845
|
-
sender,
|
|
1846
|
-
recipient,
|
|
1847
|
-
assetIdentifier,
|
|
1848
|
-
filters
|
|
1849
|
-
}) => {
|
|
1850
|
-
return listEvents({
|
|
1851
|
-
cursor,
|
|
1852
|
-
limit,
|
|
1853
|
-
types,
|
|
1854
|
-
notTypes,
|
|
1855
|
-
contractId,
|
|
1856
|
-
sender,
|
|
1857
|
-
recipient,
|
|
1858
|
-
assetIdentifier,
|
|
1859
|
-
filters
|
|
1860
|
-
});
|
|
1861
|
-
};
|
|
1844
|
+
const fetchEvents = listEvents;
|
|
1862
1845
|
function encodeFilters(filters) {
|
|
1863
1846
|
return filters ? JSON.stringify(filters) : undefined;
|
|
1864
1847
|
}
|
|
@@ -1903,13 +1886,7 @@ function createStreamsClient(options) {
|
|
|
1903
1886
|
onProgress: params.onProgress,
|
|
1904
1887
|
mode: params.mode,
|
|
1905
1888
|
finalizedOnly: params.finalizedOnly,
|
|
1906
|
-
|
|
1907
|
-
notTypes: params.notTypes,
|
|
1908
|
-
contractId: params.contractId,
|
|
1909
|
-
sender: params.sender,
|
|
1910
|
-
recipient: params.recipient,
|
|
1911
|
-
assetIdentifier: params.assetIdentifier,
|
|
1912
|
-
filters: params.filters,
|
|
1889
|
+
...streamsFilters(params),
|
|
1913
1890
|
batchSize: params.batchSize ?? 100,
|
|
1914
1891
|
fetchEvents,
|
|
1915
1892
|
onBatch,
|
|
@@ -1929,13 +1906,7 @@ function createStreamsClient(options) {
|
|
|
1929
1906
|
fromCursor: params.cursor,
|
|
1930
1907
|
batchSize: params.batchSize ?? 100,
|
|
1931
1908
|
intervalMs: params.intervalMs ?? 2000,
|
|
1932
|
-
|
|
1933
|
-
notTypes: params.notTypes,
|
|
1934
|
-
contractId: params.contractId,
|
|
1935
|
-
sender: params.sender,
|
|
1936
|
-
recipient: params.recipient,
|
|
1937
|
-
assetIdentifier: params.assetIdentifier,
|
|
1938
|
-
filters: params.filters,
|
|
1909
|
+
...streamsFilters(params),
|
|
1939
1910
|
signal: params.signal,
|
|
1940
1911
|
fetchEvents
|
|
1941
1912
|
});
|
|
@@ -1949,13 +1920,7 @@ function createStreamsClient(options) {
|
|
|
1949
1920
|
stream(params = {}) {
|
|
1950
1921
|
return streamStreamsEvents({
|
|
1951
1922
|
fromCursor: params.fromCursor,
|
|
1952
|
-
|
|
1953
|
-
notTypes: params.notTypes,
|
|
1954
|
-
contractId: params.contractId,
|
|
1955
|
-
sender: params.sender,
|
|
1956
|
-
recipient: params.recipient,
|
|
1957
|
-
assetIdentifier: params.assetIdentifier,
|
|
1958
|
-
filters: params.filters,
|
|
1923
|
+
...streamsFilters(params),
|
|
1959
1924
|
batchSize: params.batchSize ?? 100,
|
|
1960
1925
|
emptyBackoffMs: params.emptyBackoffMs,
|
|
1961
1926
|
maxPages: params.maxPages,
|
|
@@ -2820,6 +2785,7 @@ export {
|
|
|
2820
2785
|
toJsonSafe,
|
|
2821
2786
|
shutdownSignal,
|
|
2822
2787
|
selectOffer,
|
|
2788
|
+
resolveBaseUrl,
|
|
2823
2789
|
resolveApiKey,
|
|
2824
2790
|
resolveAccountNonce,
|
|
2825
2791
|
readX402Receipt,
|
|
@@ -2869,6 +2835,7 @@ export {
|
|
|
2869
2835
|
SecondLayer,
|
|
2870
2836
|
RateLimitError,
|
|
2871
2837
|
Projects,
|
|
2838
|
+
LOCAL_API_URL,
|
|
2872
2839
|
Index,
|
|
2873
2840
|
DEFAULT_PREFER_ASSETS,
|
|
2874
2841
|
Cursor,
|
|
@@ -2879,5 +2846,5 @@ export {
|
|
|
2879
2846
|
ApiError
|
|
2880
2847
|
};
|
|
2881
2848
|
|
|
2882
|
-
//# debugId=
|
|
2849
|
+
//# debugId=B183756F9B14B2E364756E2164756E21
|
|
2883
2850
|
//# sourceMappingURL=index.js.map
|