@ocap/resolver 1.31.9 → 1.32.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.
Files changed (42) hide show
  1. package/esm/_virtual/rolldown_runtime.mjs +7 -0
  2. package/esm/api.d.mts +33 -5
  3. package/esm/api.mjs +939 -53
  4. package/esm/dashboard.d.mts +199 -0
  5. package/esm/dashboard.mjs +2481 -0
  6. package/esm/explorer.d.mts +29 -0
  7. package/esm/explorer.mjs +227 -0
  8. package/esm/follower.d.mts +294 -0
  9. package/esm/follower.mjs +2452 -0
  10. package/esm/hooks.mjs +1 -1
  11. package/esm/hotstuff-runtime.d.mts +271 -0
  12. package/esm/hotstuff-runtime.mjs +2668 -0
  13. package/esm/index.d.mts +79 -4
  14. package/esm/index.mjs +911 -174
  15. package/esm/node-preferences.d.mts +203 -0
  16. package/esm/node-preferences.mjs +1021 -0
  17. package/esm/replayer.d.mts +114 -0
  18. package/esm/replayer.mjs +430 -0
  19. package/esm/token-distribution.mjs +2 -2
  20. package/esm/token-flow.mjs +1 -1
  21. package/esm/types.d.mts +25 -2
  22. package/lib/api.cjs +941 -52
  23. package/lib/api.d.cts +33 -5
  24. package/lib/dashboard.cjs +2491 -0
  25. package/lib/dashboard.d.cts +199 -0
  26. package/lib/explorer.cjs +227 -0
  27. package/lib/explorer.d.cts +29 -0
  28. package/lib/follower.cjs +2458 -0
  29. package/lib/follower.d.cts +294 -0
  30. package/lib/hooks.cjs +1 -1
  31. package/lib/hotstuff-runtime.cjs +2671 -0
  32. package/lib/hotstuff-runtime.d.cts +271 -0
  33. package/lib/index.cjs +946 -174
  34. package/lib/index.d.cts +79 -4
  35. package/lib/node-preferences.cjs +1043 -0
  36. package/lib/node-preferences.d.cts +203 -0
  37. package/lib/replayer.cjs +432 -0
  38. package/lib/replayer.d.cts +114 -0
  39. package/lib/token-distribution.cjs +2 -2
  40. package/lib/token-flow.cjs +1 -1
  41. package/lib/types.d.cts +25 -2
  42. package/package.json +20 -14
package/esm/index.d.mts CHANGED
@@ -1,4 +1,11 @@
1
- import { IAddressArgs, IAssetState, IChainConfig, IChunkIterator, IDataObject, IDelegateState, IEvidenceState, IFilter, IGetAccountStateArgs, IGetAccountTokensArgs, IGetStateParams, IIndexDB as IIndexDB$1, IListChunksParams, IPaginatedResult, IPipelineLogger as IPipelineLogger$1, IResolver, IResolverAccountState, IResolverChainInfo, IResolverContext as IResolverContext$1, IResolverFactoryState, IResolverForgeStats, IResolverListAccountsResult, IResolverListAssetsResult, IResolverListDelegationsResult, IResolverListFactoriesResult, IResolverListRollupBlocksResult, IResolverListRollupValidatorsResult, IResolverListRollupsResult, IResolverListStakesResult, IResolverListTokenFactoriesResult, IResolverListTokensResult, IResolverListTransactionsResult, IResolverNetInfo, IResolverNodeInfo, IResolverPaging, IResolverParams, IResolverRollupState, IResolverStakeState, IResolverTransaction, IResolverValidatorsInfo, IRollupBlock, IStateDB as IStateDB$1, ITokenCache, ITokenFactoryState, ITokenFlowsResult, ITokenInfo, ITokenState, TIndexedTokenState as TIndexedTokenState$1, TRequestEstimateGas, TRequestGetEvidenceState, TRequestGetRollupBlock, TRequestGetTokenDistribution, TRequestGetTx, TRequestListAssetTransactions, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokenFlows, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions, TRequestSearch, TRequestVerifyAccountRisk, TSearchResult, TTokenDistribution, TVerifyAccountRiskResult } from "./types.mjs";
1
+ import { AdminAuthGuardOptions, DnsLookupAllFn, IAdminAuthGuard, IAttributedBlockedAccount, IAttributedReservedSymbol, IAttributedTrustedAccount, IBlockedAccountEntry, ILedgerHealthThresholds, ILegacyPreferencesResult, INodePreferencesFileSchema, INodePreferencesSnapshot, INodeRuntimePreferences, IReservedSymbolEntry, ITrustedAccountEntry, IUpdateNodePreferencesInput, IUpdateNodePreferencesResult, MAX_BLOCKED_ACCOUNTS, MAX_CONFIG_BODY_BYTES, MAX_MEMO_LENGTH, MAX_PEER_URLS, MAX_RESERVED_SYMBOLS, MAX_TRUSTED_ACCOUNTS, NodePreferencesError, NodePreferencesManager, NodePreferencesManagerOptions, TPreferenceSource, applyBootRuntimePreferences, createAdminAuthGuard, createFollowerPeerFetchGuard, isPrivateOrReservedIpAddress, isValidAccountAddressCandidate, loadNodePreferences, normalizeBlockedAccountKey, timingSafeTokenEqual, validateFollowerPeerUrls } from "./node-preferences.mjs";
2
+ import { CreateNodeDashboardRouterOptions, CreateUnifiedConsoleMiddlewareOptions, IDashboardResolverTarget, IDatabaseFileMetrics, ILedgerHealthSummary, INodeMaintenanceController, INodeMaintenanceStatusSummary, ISlowStorageTelemetry, NodeMaintenanceControllerOptions, UNIFIED_CONSOLE_APP_JS, buildUnifiedConsoleHtml, collectLedgerHealthSummary, createNodeDashboardRouter, createNodeMaintenanceController, createUnifiedConsoleMiddleware, isDashboardEnabled } from "./dashboard.mjs";
3
+ import { IAddressArgs, IAssetState, IChainConfig, IChunkIterator, IDataObject, IDelegateState, IEvidenceState, IFilter as IFilter$1, IFollowerStatusResponse, IGetAccountStateArgs, IGetAccountTokensArgs, IGetStateParams, IIndexDB as IIndexDB$1, IListChunksParams, INodeRuntimeAdapter, IPaginatedResult, IPipelineLogger as IPipelineLogger$1, IResolver, IResolverAccountState, IResolverChainInfo, IResolverContext as IResolverContext$1, IResolverFactoryState, IResolverForgeStats, IResolverListAccountsResult, IResolverListAssetsResult, IResolverListDelegationsResult, IResolverListFactoriesResult, IResolverListRollupBlocksResult, IResolverListRollupValidatorsResult, IResolverListRollupsResult, IResolverListStakesResult, IResolverListTokenFactoriesResult, IResolverListTokensResult, IResolverListTransactionsResult, IResolverNetInfo, IResolverNodeInfo, IResolverPaging, IResolverParams, IResolverRollupState, IResolverStakeState, IResolverTransaction, IResolverValidatorsInfo, IRollupBlock, IStateDB as IStateDB$1, ITokenCache, ITokenFactoryState, ITokenFlowsResult, ITokenInfo, ITokenState, TIndexedTokenState as TIndexedTokenState$1, TRequestEstimateGas, TRequestGetEvidenceState, TRequestGetRollupBlock, TRequestGetTokenDistribution, TRequestGetTx, TRequestListAssetTransactions, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokenFlows, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions, TRequestSearch, TRequestVerifyAccountRisk, TSearchResult, TTokenDistribution, TVerifyAccountRiskResult } from "./types.mjs";
4
+ import { CreateAPIHandlerOptions, ICreateAPIHandlerParams } from "./api.mjs";
5
+ import { CreateExplorerMiddlewareOptions, createExplorerMiddleware, isExplorerEnabled } from "./explorer.mjs";
6
+ import { FUTURE_LEDGER_ENTRY_TIMESTAMP, IDryRunVerifyEntriesOptions, IDryRunVerifyEntriesResult, IFutureTimestampGuardOptions, IFutureTimestampRejection, ILedgerEntryReplayerOptions, IReplayEntryOptions, IReplayEntryResult, IReplayerResolverTarget, IValidateWireEntryOptions, LedgerEntryReplayer } from "./replayer.mjs";
7
+ import { DEFAULT_FOLLOWER_MAX_SYNC_LAG, DEFAULT_FOLLOWER_MAX_UPSTREAM_STALE_MS, DEFAULT_FOLLOWER_POLL_INTERVAL_MS, FollowerSyncService, FollowerSyncServiceOptions, IColdSegmentReader, ILeaderRouterLike, TFollowerUpstreamFetchInterceptor, TFollowerUpstreamFetchKind, isTransientSqliteLockError } from "./follower.mjs";
8
+ import { ConsensusAbortError, HotStuffNodeRuntime, HotStuffNodeRuntimeOptions, IHotStuffNetworkInterceptorContext, IHotStuffRuntimeStateSnapshot, IHotStuffRuntimeStateStore, TConsensusAbortCode } from "./hotstuff-runtime.mjs";
2
9
  import { MigrationChainManager } from "./migration-chain.mjs";
3
10
  import { TokenDistributionManager } from "./token-distribution.mjs";
4
11
  import { ITxSecurityWarning, createExecutor } from "@ocap/tx-protocols";
@@ -20,7 +27,7 @@ declare class OCAPResolver implements IResolver {
20
27
  statedb: IStateDB$1;
21
28
  indexdb: IIndexDB$1;
22
29
  ledger: ILedger;
23
- filter?: IFilter;
30
+ filter?: IFilter$1;
24
31
  config: IChainConfig;
25
32
  chainAddr: string;
26
33
  tokenItx: TIndexedTokenState$1 | null;
@@ -34,6 +41,24 @@ declare class OCAPResolver implements IResolver {
34
41
  formatTx: (tx: IResolverTransaction | null, ctx?: IResolverContext$1) => Promise<IResolverTransaction | null>;
35
42
  inFlightPreFlights: number;
36
43
  private initializationPromise;
44
+ private shutdownPromise;
45
+ private isShuttingDown;
46
+ private preFlightDrainWaiters;
47
+ private readonly deferInitialize;
48
+ private readonly explicitConsensusMode?;
49
+ private readonly now;
50
+ private skipInitializeStateDB;
51
+ private nodeRuntime?;
52
+ private admissionBlockedCheck?;
53
+ private admissionReservedSymbolCheck?;
54
+ private maxTxRequestOverride?;
55
+ private pendingIndexWrites;
56
+ private txAcceptedTotal;
57
+ private txPersistedFailedTotal;
58
+ private txPreFlightRejectedTotal;
59
+ private txForwardedTotal;
60
+ private readonly txBucketsSec;
61
+ private readonly txBucketCounts;
37
62
  /**
38
63
  * Creates an instance of OCAPResolver.
39
64
  * @param params Parameters to bootstrap the resolver
@@ -50,9 +75,46 @@ declare class OCAPResolver implements IResolver {
50
75
  ledger,
51
76
  config,
52
77
  filter,
78
+ admissionBlockedCheck,
79
+ admissionReservedSymbolCheck,
53
80
  validateTokenConfig,
81
+ skipInitializeStateDB,
82
+ deferInitialize,
83
+ consensusMode,
84
+ txQueueConfig,
85
+ now,
86
+ nodeRuntime,
54
87
  logger
55
88
  }: IResolverParams);
89
+ initialize(): Promise<void>;
90
+ setNodeRuntime(runtime?: INodeRuntimeAdapter): void;
91
+ getNodeRuntime(): INodeRuntimeAdapter | undefined;
92
+ setAdmissionBlockedCheck(fn?: (address: string) => boolean | Promise<boolean>): void;
93
+ setAdmissionReservedSymbolCheck(fn?: (symbol: string) => boolean | Promise<boolean>): void;
94
+ getMaxTxRequest(): number;
95
+ setMaxTxRequest(maxRequest?: number): void;
96
+ private recordCommittedTxSample;
97
+ getPipelineTelemetry(nowMs?: number): {
98
+ queueDepth: number;
99
+ inFlightPreFlights: number;
100
+ maxTxRequest: number;
101
+ concurrency: number;
102
+ acceptedTotal: number;
103
+ persistedFailedTotal: number;
104
+ preFlightRejectedTotal: number;
105
+ forwardedTotal: number;
106
+ tps10s: number;
107
+ tps60s: number;
108
+ };
109
+ private assertNotBlockedAtAdmission;
110
+ getFollowerStatus(): Promise<IFollowerStatusResponse | null>;
111
+ signForwardedSendTxReceipt(txHash: string): Promise<{
112
+ proposer: string;
113
+ signature: string;
114
+ commitProof?: string;
115
+ } | null>;
116
+ private trackIndexWrite;
117
+ flushIndexWrites(): Promise<void>;
56
118
  sendTx({
57
119
  tx: txBase64,
58
120
  extra
@@ -68,10 +130,19 @@ declare class OCAPResolver implements IResolver {
68
130
  getBlock(): null;
69
131
  getBlocks(): never[];
70
132
  getUnconfirmedTxs(): never[];
133
+ private resolveNodeSyncMetadata;
71
134
  getChainInfo(): Promise<IResolverChainInfo>;
72
135
  getNodeInfo(): Promise<IResolverNodeInfo>;
73
136
  getNetInfo(): Promise<IResolverNetInfo>;
74
137
  getValidatorsInfo(): Promise<IResolverValidatorsInfo>;
138
+ getLedgerInfo(): Promise<{
139
+ chainId: string;
140
+ latestSequence: number;
141
+ entryHashV2From: string | null;
142
+ proposer: string | null;
143
+ proposerPublicKey: string | null;
144
+ checkpointSigningEnabled: boolean;
145
+ } | null>;
75
146
  getLatestCheckpoint({
76
147
  height
77
148
  }?: {
@@ -91,6 +162,7 @@ declare class OCAPResolver implements IResolver {
91
162
  }): Promise<{
92
163
  proof: unknown;
93
164
  checkpoint: unknown;
165
+ entryHashV2From?: string;
94
166
  } | null>;
95
167
  getConfig(): string;
96
168
  getAccountState({
@@ -163,7 +235,10 @@ declare class OCAPResolver implements IResolver {
163
235
  runAsLambda<T>(fn: (txn?: unknown) => T | Promise<T>, args?: Record<string, unknown>): Promise<T>;
164
236
  getChain(): Promise<Record<string, unknown> | null>;
165
237
  getToken(id: string): Promise<ITokenState | null>;
166
- initializeStateDB(): Promise<void>;
238
+ initializeStateDB(options?: {
239
+ txTime?: string | number | Date;
240
+ readonly?: boolean;
241
+ }): Promise<void>;
167
242
  /**
168
243
  * Persist a durable trail for a failed indexdb write from connectIndexDB()'s statedb
169
244
  * listeners. The write path itself is fire-and-forget (EventEmitter, no retry) — this
@@ -275,4 +350,4 @@ declare class OCAPResolver implements IResolver {
275
350
  }): Promise<IChunkIterator<IResolverStakeState>>;
276
351
  }
277
352
  //#endregion
278
- export { GRAPHQL_INDEXED_TX_COLUMNS, type IChainConfig, type IChunkIterator, type IDataObject, type IPaginatedResult, type IResolverPaging, type IResolverParams, type IResolverTransaction, type ITokenInfo, OCAPResolver as default, formatData, formatDelegationOps };
353
+ export { type AdminAuthGuardOptions, ConsensusAbortError, type CreateAPIHandlerOptions, type CreateExplorerMiddlewareOptions, type CreateNodeDashboardRouterOptions, type CreateUnifiedConsoleMiddlewareOptions, DEFAULT_FOLLOWER_MAX_SYNC_LAG, DEFAULT_FOLLOWER_MAX_UPSTREAM_STALE_MS, DEFAULT_FOLLOWER_POLL_INTERVAL_MS, type DnsLookupAllFn, FUTURE_LEDGER_ENTRY_TIMESTAMP, FollowerSyncService, type FollowerSyncServiceOptions, GRAPHQL_INDEXED_TX_COLUMNS, HotStuffNodeRuntime, type HotStuffNodeRuntimeOptions, type IAdminAuthGuard, type IAttributedBlockedAccount, type IAttributedReservedSymbol, type IAttributedTrustedAccount, type IBlockedAccountEntry, type IChainConfig, type IChunkIterator, type IColdSegmentReader, type ICreateAPIHandlerParams, type IDashboardResolverTarget, type IDataObject, type IDatabaseFileMetrics, type IDryRunVerifyEntriesOptions, type IDryRunVerifyEntriesResult, type IFollowerStatusResponse, type IFutureTimestampGuardOptions, type IFutureTimestampRejection, type IHotStuffNetworkInterceptorContext, type IHotStuffRuntimeStateSnapshot, type IHotStuffRuntimeStateStore, type ILeaderRouterLike, type ILedgerEntryReplayerOptions, type ILedgerHealthSummary, type ILedgerHealthThresholds, type ILegacyPreferencesResult, type INodeMaintenanceController, type INodeMaintenanceStatusSummary, type INodePreferencesFileSchema, type INodePreferencesSnapshot, type INodeRuntimeAdapter, type INodeRuntimePreferences, type IPaginatedResult, type IReplayEntryOptions, type IReplayEntryResult, type IReplayerResolverTarget, type IReservedSymbolEntry, type IResolverPaging, type IResolverParams, type IResolverTransaction, type ISlowStorageTelemetry, type ITokenInfo, type ITrustedAccountEntry, type IUpdateNodePreferencesInput, type IUpdateNodePreferencesResult, type IValidateWireEntryOptions, LedgerEntryReplayer, MAX_BLOCKED_ACCOUNTS, MAX_CONFIG_BODY_BYTES, MAX_MEMO_LENGTH, MAX_PEER_URLS, MAX_RESERVED_SYMBOLS, MAX_TRUSTED_ACCOUNTS, type NodeMaintenanceControllerOptions, NodePreferencesError, NodePreferencesManager, type NodePreferencesManagerOptions, type TConsensusAbortCode, type TFollowerUpstreamFetchInterceptor, type TFollowerUpstreamFetchKind, type TPreferenceSource, UNIFIED_CONSOLE_APP_JS, applyBootRuntimePreferences, buildUnifiedConsoleHtml, collectLedgerHealthSummary, createAdminAuthGuard, createExplorerMiddleware, createFollowerPeerFetchGuard, createNodeDashboardRouter, createNodeMaintenanceController, createUnifiedConsoleMiddleware, OCAPResolver as default, formatData, formatDelegationOps, isDashboardEnabled, isExplorerEnabled, isPrivateOrReservedIpAddress, isTransientSqliteLockError, isValidAccountAddressCandidate, loadNodePreferences, normalizeBlockedAccountKey, timingSafeTokenEqual, validateFollowerPeerUrls };