@thru/thru-sdk 0.2.1 → 0.2.3

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.
@@ -1,4 +1,4 @@
1
- import { Pubkey as Pubkey$1, TaPubkey, Signature as Signature$1, TsSignature, TransactionVmError, Transaction as Transaction$1, TransactionExecutionResult, ConsensusStatus, TransactionStatus, AccountFlags as AccountFlags$1, AccountMeta as AccountMeta$1, AccountData as AccountData$1, Account as Account$1, FilterParamValue as FilterParamValue$1, Filter as Filter$1, PageRequest as PageRequest$1, PageResponse as PageResponse$1, AccountView, VersionContext, DataSlice, RawAccount, ExecutionStatus, BlockFooter as BlockFooter$1, BlockHeader as BlockHeader$1, Block as Block$1, BlockView, RawBlock, Event, StreamEventsResponse, StateProof as StateProof$1, StateProofType, TransactionView, RawTransaction, BatchSendTransactionsResponse, GetVersionResponse } from '@thru/proto';
1
+ import { Pubkey as Pubkey$1, TaPubkey, Signature as Signature$1, TsSignature, TransactionVmError, Transaction as Transaction$1, TransactionExecutionResult, ConsensusStatus, TransactionStatus, AccountFlags as AccountFlags$1, AccountMeta as AccountMeta$1, AccountData as AccountData$1, Account as Account$1, FilterParamValue as FilterParamValue$1, Filter as Filter$1, PageRequest as PageRequest$1, PageResponse as PageResponse$1, AccountView, VersionContext, DataSlice, RawAccount, ExecutionStatus, BlockFooter as BlockFooter$1, BlockHeader as BlockHeader$1, Block as Block$1, BlockView, RawBlock, GetChainInfoResponse, Event, StreamEventsResponse, GetNodePubkeyResponse, GetNodeRecordsResponse, StateProof as StateProof$1, StateProofType, GetStateRootsResponse, GetSlotMetricsResponse, ListSlotMetricsResponse, NodeRecord, TransactionView, RawTransaction, BatchSendTransactionsResponse, SubmissionStatus, GetVersionResponse } from '@thru/proto';
2
2
  import { Timestamp } from '@bufbuild/protobuf/wkt';
3
3
  import { Transport, createClient, CallOptions, Interceptor } from '@connectrpc/connect';
4
4
  import { GrpcWebTransportOptions } from '@connectrpc/connect-web';
@@ -623,6 +623,15 @@ declare namespace blocks {
623
623
  export { type blocks_BlockList as BlockList, type blocks_BlockQueryOptions as BlockQueryOptions, type blocks_ListBlocksOptions as ListBlocksOptions, type blocks_RawBlockQueryOptions as RawBlockQueryOptions, blocks_getBlock as getBlock, blocks_getRawBlock as getRawBlock, blocks_listBlocks as listBlocks };
624
624
  }
625
625
 
626
+ declare function getChainInfo(ctx: ThruClientContext): Promise<GetChainInfoResponse>;
627
+ declare function getChainId(ctx: ThruClientContext): Promise<number>;
628
+
629
+ declare const chain_getChainId: typeof getChainId;
630
+ declare const chain_getChainInfo: typeof getChainInfo;
631
+ declare namespace chain {
632
+ export { chain_getChainId as getChainId, chain_getChainInfo as getChainInfo };
633
+ }
634
+
626
635
  declare function consensusStatusToString(status: ConsensusStatus): string;
627
636
 
628
637
  type VersionContextInput = VersionContext | {
@@ -754,6 +763,15 @@ declare namespace keys {
754
763
  export { type keys_GeneratedKeyPair as GeneratedKeyPair, keys_fromPrivateKey as fromPrivateKey, keys_generateKeyPair as generateKeyPair };
755
764
  }
756
765
 
766
+ declare function getNodePubkey(ctx: ThruClientContext): Promise<GetNodePubkeyResponse>;
767
+ declare function getNodeRecords(ctx: ThruClientContext): Promise<GetNodeRecordsResponse>;
768
+
769
+ declare const node_getNodePubkey: typeof getNodePubkey;
770
+ declare const node_getNodeRecords: typeof getNodeRecords;
771
+ declare namespace node {
772
+ export { node_getNodePubkey as getNodePubkey, node_getNodeRecords as getNodeRecords };
773
+ }
774
+
757
775
  declare class StateProof {
758
776
  readonly proof: Uint8Array;
759
777
  readonly slot: bigint;
@@ -771,10 +789,31 @@ type GenerateStateProofOptions = {
771
789
  };
772
790
 
773
791
  declare function generateStateProof(ctx: ThruClientContext, options: GenerateStateProofOptions): Promise<StateProof>;
792
+ interface GetStateRootsOptions {
793
+ slot?: bigint;
794
+ }
795
+ declare function getStateRoots(ctx: ThruClientContext, options?: GetStateRootsOptions): Promise<GetStateRootsResponse>;
774
796
 
797
+ type proofs_GetStateRootsOptions = GetStateRootsOptions;
775
798
  declare const proofs_generateStateProof: typeof generateStateProof;
799
+ declare const proofs_getStateRoots: typeof getStateRoots;
776
800
  declare namespace proofs {
777
- export { proofs_generateStateProof as generateStateProof };
801
+ export { type proofs_GetStateRootsOptions as GetStateRootsOptions, proofs_generateStateProof as generateStateProof, proofs_getStateRoots as getStateRoots };
802
+ }
803
+
804
+ interface ListSlotMetricsOptions {
805
+ startSlot: bigint;
806
+ endSlot?: bigint;
807
+ limit?: number;
808
+ }
809
+ declare function getSlotMetrics(ctx: ThruClientContext, slot: bigint): Promise<GetSlotMetricsResponse>;
810
+ declare function listSlotMetrics(ctx: ThruClientContext, options: ListSlotMetricsOptions): Promise<ListSlotMetricsResponse>;
811
+
812
+ type slots_ListSlotMetricsOptions = ListSlotMetricsOptions;
813
+ declare const slots_getSlotMetrics: typeof getSlotMetrics;
814
+ declare const slots_listSlotMetrics: typeof listSlotMetrics;
815
+ declare namespace slots {
816
+ export { type slots_ListSlotMetricsOptions as ListSlotMetricsOptions, slots_getSlotMetrics as getSlotMetrics, slots_listSlotMetrics as listSlotMetrics };
778
817
  }
779
818
 
780
819
  interface TrackTransactionOptions {
@@ -824,6 +863,28 @@ interface StreamHeightResult {
824
863
  height: HeightSnapshot;
825
864
  }
826
865
  declare function streamHeight(ctx: ThruClientContext, options?: StreamHeightOptions): AsyncIterable<StreamHeightResult>;
866
+ interface StreamSlotMetricsOptions {
867
+ startSlot?: bigint;
868
+ signal?: AbortSignal;
869
+ }
870
+ interface StreamSlotMetricsResult {
871
+ slot: bigint;
872
+ collectedFees: bigint;
873
+ globalActivatedStateCounter: bigint;
874
+ globalDeactivatedStateCounter: bigint;
875
+ blockTimestamp?: Timestamp;
876
+ }
877
+ declare function streamSlotMetrics(ctx: ThruClientContext, options?: StreamSlotMetricsOptions): AsyncIterable<StreamSlotMetricsResult>;
878
+ type StreamNodeRecordsResult = {
879
+ type: "record";
880
+ record: NodeRecord;
881
+ } | {
882
+ type: "finished";
883
+ };
884
+ interface StreamNodeRecordsOptions {
885
+ signal?: AbortSignal;
886
+ }
887
+ declare function streamNodeRecords(ctx: ThruClientContext, options?: StreamNodeRecordsOptions): AsyncIterable<StreamNodeRecordsResult>;
827
888
  interface CollectStreamOptions {
828
889
  limit?: number;
829
890
  signal?: AbortSignal;
@@ -845,6 +906,10 @@ type streaming_StreamEventsOptions = StreamEventsOptions;
845
906
  type streaming_StreamEventsResult = StreamEventsResult;
846
907
  type streaming_StreamHeightOptions = StreamHeightOptions;
847
908
  type streaming_StreamHeightResult = StreamHeightResult;
909
+ type streaming_StreamNodeRecordsOptions = StreamNodeRecordsOptions;
910
+ type streaming_StreamNodeRecordsResult = StreamNodeRecordsResult;
911
+ type streaming_StreamSlotMetricsOptions = StreamSlotMetricsOptions;
912
+ type streaming_StreamSlotMetricsResult = StreamSlotMetricsResult;
848
913
  type streaming_StreamTransactionUpdate = StreamTransactionUpdate;
849
914
  type streaming_StreamTransactionsOptions = StreamTransactionsOptions;
850
915
  type streaming_StreamTransactionsResult = StreamTransactionsResult;
@@ -857,10 +922,12 @@ declare const streaming_streamAccountUpdates: typeof streamAccountUpdates;
857
922
  declare const streaming_streamBlocks: typeof streamBlocks;
858
923
  declare const streaming_streamEvents: typeof streamEvents;
859
924
  declare const streaming_streamHeight: typeof streamHeight;
925
+ declare const streaming_streamNodeRecords: typeof streamNodeRecords;
926
+ declare const streaming_streamSlotMetrics: typeof streamSlotMetrics;
860
927
  declare const streaming_streamTransactions: typeof streamTransactions;
861
928
  declare const streaming_trackTransaction: typeof trackTransaction;
862
929
  declare namespace streaming {
863
- export { type streaming_CollectStreamOptions as CollectStreamOptions, type streaming_StreamAccountUpdatesOptions as StreamAccountUpdatesOptions, type streaming_StreamAccountUpdatesResult as StreamAccountUpdatesResult, type streaming_StreamBlocksOptions as StreamBlocksOptions, type streaming_StreamBlocksResult as StreamBlocksResult, type streaming_StreamEventsOptions as StreamEventsOptions, type streaming_StreamEventsResult as StreamEventsResult, type streaming_StreamHeightOptions as StreamHeightOptions, type streaming_StreamHeightResult as StreamHeightResult, type streaming_StreamTransactionUpdate as StreamTransactionUpdate, type streaming_StreamTransactionsOptions as StreamTransactionsOptions, type streaming_StreamTransactionsResult as StreamTransactionsResult, type streaming_TrackTransactionOptions as TrackTransactionOptions, type streaming_TrackTransactionUpdate as TrackTransactionUpdate, streaming_collectStream as collectStream, streaming_firstStreamValue as firstStreamValue, streaming_forEachStreamValue as forEachStreamValue, streaming_streamAccountUpdates as streamAccountUpdates, streaming_streamBlocks as streamBlocks, streaming_streamEvents as streamEvents, streaming_streamHeight as streamHeight, streaming_streamTransactions as streamTransactions, streaming_trackTransaction as trackTransaction };
930
+ export { type streaming_CollectStreamOptions as CollectStreamOptions, type streaming_StreamAccountUpdatesOptions as StreamAccountUpdatesOptions, type streaming_StreamAccountUpdatesResult as StreamAccountUpdatesResult, type streaming_StreamBlocksOptions as StreamBlocksOptions, type streaming_StreamBlocksResult as StreamBlocksResult, type streaming_StreamEventsOptions as StreamEventsOptions, type streaming_StreamEventsResult as StreamEventsResult, type streaming_StreamHeightOptions as StreamHeightOptions, type streaming_StreamHeightResult as StreamHeightResult, type streaming_StreamNodeRecordsOptions as StreamNodeRecordsOptions, type streaming_StreamNodeRecordsResult as StreamNodeRecordsResult, type streaming_StreamSlotMetricsOptions as StreamSlotMetricsOptions, type streaming_StreamSlotMetricsResult as StreamSlotMetricsResult, type streaming_StreamTransactionUpdate as StreamTransactionUpdate, type streaming_StreamTransactionsOptions as StreamTransactionsOptions, type streaming_StreamTransactionsResult as StreamTransactionsResult, type streaming_TrackTransactionOptions as TrackTransactionOptions, type streaming_TrackTransactionUpdate as TrackTransactionUpdate, streaming_collectStream as collectStream, streaming_firstStreamValue as firstStreamValue, streaming_forEachStreamValue as forEachStreamValue, streaming_streamAccountUpdates as streamAccountUpdates, streaming_streamBlocks as streamBlocks, streaming_streamEvents as streamEvents, streaming_streamHeight as streamHeight, streaming_streamNodeRecords as streamNodeRecords, streaming_streamSlotMetrics as streamSlotMetrics, streaming_streamTransactions as streamTransactions, streaming_trackTransaction as trackTransaction };
864
931
  }
865
932
 
866
933
  interface TransactionFeePayerConfig {
@@ -939,6 +1006,23 @@ interface BatchSendTransactionsOptions {
939
1006
  numRetries?: number;
940
1007
  }
941
1008
  declare function batchSendTransactions(ctx: ThruClientContext, transactions: (Transaction | Uint8Array)[], options?: BatchSendTransactionsOptions): Promise<BatchSendTransactionsResponse>;
1009
+ interface SendAndTrackTxnOptions {
1010
+ timeoutMs?: number;
1011
+ signal?: AbortSignal;
1012
+ }
1013
+ interface SendAndTrackTxnUpdate {
1014
+ status: SubmissionStatus;
1015
+ signature?: {
1016
+ value: Uint8Array;
1017
+ };
1018
+ consensusStatus: number;
1019
+ executionResult?: {
1020
+ vmError: number;
1021
+ consumedComputeUnits: number;
1022
+ userErrorCode: bigint;
1023
+ };
1024
+ }
1025
+ declare function sendAndTrackTxn(ctx: ThruClientContext, transaction: Transaction | Uint8Array, options?: SendAndTrackTxnOptions): AsyncIterable<SendAndTrackTxnUpdate>;
942
1026
 
943
1027
  type transactions_BatchSendTransactionsOptions = BatchSendTransactionsOptions;
944
1028
  type transactions_BuildAndSignTransactionOptions = BuildAndSignTransactionOptions;
@@ -947,6 +1031,8 @@ type transactions_InstructionData = InstructionData;
947
1031
  type transactions_ListTransactionsForAccountOptions = ListTransactionsForAccountOptions;
948
1032
  type transactions_ListTransactionsOptions = ListTransactionsOptions;
949
1033
  type transactions_RawTransactionQueryOptions = RawTransactionQueryOptions;
1034
+ type transactions_SendAndTrackTxnOptions = SendAndTrackTxnOptions;
1035
+ type transactions_SendAndTrackTxnUpdate = SendAndTrackTxnUpdate;
950
1036
  type transactions_TransactionAccountsConfig = TransactionAccountsConfig;
951
1037
  type transactions_TransactionFeePayerConfig = TransactionFeePayerConfig;
952
1038
  type transactions_TransactionHeaderConfig = TransactionHeaderConfig;
@@ -960,9 +1046,10 @@ declare const transactions_getTransaction: typeof getTransaction;
960
1046
  declare const transactions_getTransactionStatus: typeof getTransactionStatus;
961
1047
  declare const transactions_listTransactions: typeof listTransactions;
962
1048
  declare const transactions_listTransactionsForAccount: typeof listTransactionsForAccount;
1049
+ declare const transactions_sendAndTrackTxn: typeof sendAndTrackTxn;
963
1050
  declare const transactions_sendTransaction: typeof sendTransaction;
964
1051
  declare namespace transactions {
965
- export { type transactions_BatchSendTransactionsOptions as BatchSendTransactionsOptions, type transactions_BuildAndSignTransactionOptions as BuildAndSignTransactionOptions, type transactions_BuildTransactionOptions as BuildTransactionOptions, type transactions_InstructionData as InstructionData, type transactions_ListTransactionsForAccountOptions as ListTransactionsForAccountOptions, type transactions_ListTransactionsOptions as ListTransactionsOptions, type transactions_RawTransactionQueryOptions as RawTransactionQueryOptions, type transactions_TransactionAccountsConfig as TransactionAccountsConfig, type transactions_TransactionFeePayerConfig as TransactionFeePayerConfig, type transactions_TransactionHeaderConfig as TransactionHeaderConfig, type transactions_TransactionList as TransactionList, type transactions_TransactionQueryOptions as TransactionQueryOptions, transactions_batchSendTransactions as batchSendTransactions, transactions_buildAndSignTransaction as buildAndSignTransaction, transactions_buildTransaction as buildTransaction, transactions_getRawTransaction as getRawTransaction, transactions_getTransaction as getTransaction, transactions_getTransactionStatus as getTransactionStatus, transactions_listTransactions as listTransactions, transactions_listTransactionsForAccount as listTransactionsForAccount, transactions_sendTransaction as sendTransaction };
1052
+ export { type transactions_BatchSendTransactionsOptions as BatchSendTransactionsOptions, type transactions_BuildAndSignTransactionOptions as BuildAndSignTransactionOptions, type transactions_BuildTransactionOptions as BuildTransactionOptions, type transactions_InstructionData as InstructionData, type transactions_ListTransactionsForAccountOptions as ListTransactionsForAccountOptions, type transactions_ListTransactionsOptions as ListTransactionsOptions, type transactions_RawTransactionQueryOptions as RawTransactionQueryOptions, type transactions_SendAndTrackTxnOptions as SendAndTrackTxnOptions, type transactions_SendAndTrackTxnUpdate as SendAndTrackTxnUpdate, type transactions_TransactionAccountsConfig as TransactionAccountsConfig, type transactions_TransactionFeePayerConfig as TransactionFeePayerConfig, type transactions_TransactionHeaderConfig as TransactionHeaderConfig, type transactions_TransactionList as TransactionList, type transactions_TransactionQueryOptions as TransactionQueryOptions, transactions_batchSendTransactions as batchSendTransactions, transactions_buildAndSignTransaction as buildAndSignTransaction, transactions_buildTransaction as buildTransaction, transactions_getRawTransaction as getRawTransaction, transactions_getTransaction as getTransaction, transactions_getTransactionStatus as getTransactionStatus, transactions_listTransactions as listTransactions, transactions_listTransactionsForAccount as listTransactionsForAccount, transactions_sendAndTrackTxn as sendAndTrackTxn, transactions_sendTransaction as sendTransaction };
966
1053
  }
967
1054
 
968
1055
  declare class VersionInfo {
@@ -972,4 +1059,4 @@ declare class VersionInfo {
972
1059
  get(component: string): string | undefined;
973
1060
  }
974
1061
 
975
- export { type StreamAccountUpdatesOptions as $, Account as A, type BuildTransactionParams as B, ChainEvent as C, type VersionContextInput as D, type AccountQueryOptions as E, Filter as F, type CreateAccountOptions as G, HeightSnapshot as H, type BlockList as I, type BlockQueryOptions as J, type ListBlocksOptions as K, type ListAccountsOptions as L, type RawBlockQueryOptions as M, type GetEventOptions as N, type BlockSelector as O, PageRequest as P, type DeriveAddressInput as Q, type RawAccountQueryOptions as R, type SignedTransactionResult as S, Transaction as T, type DeriveAddressResult as U, VersionInfo as V, type DeriveProgramAddressOptions as W, type DeriveProgramAddressResult as X, type GeneratedKeyPair as Y, type StreamAccountUpdate as Z, type HeightSnapshotParams as _, type ThruClientContext as a, type StreamAccountUpdatesResult as a0, type StreamBlocksOptions as a1, type StreamBlocksResult as a2, type StreamEventsOptions as a3, type StreamEventsResult as a4, type StreamTransactionsOptions as a5, type StreamTransactionsResult as a6, type StreamTransactionUpdate as a7, type TrackTransactionOptions as a8, type TrackTransactionUpdate as a9, getTransaction as aA, getRawTransaction as aB, getTransactionStatus as aC, listTransactions as aD, listTransactionsForAccount as aE, streamTransactions as aF, buildTransaction as aG, buildAndSignTransaction as aH, sendTransaction as aI, batchSendTransactions as aJ, trackTransaction as aK, getEvent as aL, listEvents as aM, streamEvents as aN, generateStateProof as aO, generateKeyPair as aP, fromPrivateKey as aQ, consensusStatusToString as aR, versionContext as aS, currentVersionContext as aT, currentOrHistoricalVersionContext as aU, slotVersionContext as aV, timestampVersionContext as aW, seqVersionContext as aX, type ThruClientConfig as aY, type TransactionExecutionEvent as aa, type TransactionExecutionResultData as ab, type InstructionContext as ac, type BatchSendTransactionsOptions as ad, type BuildAndSignTransactionOptions as ae, type BuildTransactionOptions as af, type InstructionData as ag, type ListTransactionsForAccountOptions as ah, type RawTransactionQueryOptions as ai, type TransactionAccountsConfig as aj, type TransactionFeePayerConfig as ak, type TransactionHeaderConfig as al, type TransactionList as am, type TransactionQueryOptions as an, type GenerateStateProofOptions as ao, getBlock as ap, getRawBlock as aq, listBlocks as ar, streamBlocks as as, getBlockHeight as at, streamHeight as au, getAccount as av, getRawAccount as aw, listAccounts as ax, streamAccountUpdates as ay, createAccount as az, accounts as b, blocks as c, consensus as d, events as e, Block as f, FilterParamValue as g, height as h, PageResponse as i, Pubkey as j, keys as k, Signature as l, StateProof as m, TransactionStatusSnapshot as n, deriveAddress as o, proofs as p, deriveProgramAddress as q, collectStream as r, streaming as s, transactions as t, firstStreamValue as u, forEachStreamValue as v, type PageRequestParams as w, type PageResponseParams as x, type PubkeyInput as y, type SignatureInput as z };
1062
+ export { type ListSlotMetricsOptions as $, Account as A, type BuildTransactionParams as B, ChainEvent as C, type PubkeyInput as D, type SignatureInput as E, Filter as F, type VersionContextInput as G, HeightSnapshot as H, type AccountQueryOptions as I, type CreateAccountOptions as J, type BlockList as K, type ListAccountsOptions as L, type BlockQueryOptions as M, type ListBlocksOptions as N, type RawBlockQueryOptions as O, PageRequest as P, type GetEventOptions as Q, type RawAccountQueryOptions as R, type SignedTransactionResult as S, Transaction as T, type BlockSelector as U, VersionInfo as V, type DeriveAddressInput as W, type DeriveAddressResult as X, type DeriveProgramAddressOptions as Y, type DeriveProgramAddressResult as Z, type GeneratedKeyPair as _, accounts as a, listSlotMetrics as a$, type StreamAccountUpdate as a0, type HeightSnapshotParams as a1, type StreamAccountUpdatesOptions as a2, type StreamAccountUpdatesResult as a3, type StreamBlocksOptions as a4, type StreamBlocksResult as a5, type StreamEventsOptions as a6, type StreamEventsResult as a7, type StreamNodeRecordsOptions as a8, type StreamNodeRecordsResult as a9, getBlock as aA, getRawBlock as aB, listBlocks as aC, streamBlocks as aD, getBlockHeight as aE, streamHeight as aF, getAccount as aG, getRawAccount as aH, listAccounts as aI, streamAccountUpdates as aJ, createAccount as aK, getTransaction as aL, getRawTransaction as aM, getTransactionStatus as aN, listTransactions as aO, listTransactionsForAccount as aP, streamTransactions as aQ, buildTransaction as aR, buildAndSignTransaction as aS, sendTransaction as aT, batchSendTransactions as aU, sendAndTrackTxn as aV, trackTransaction as aW, getEvent as aX, listEvents as aY, streamEvents as aZ, getSlotMetrics as a_, type StreamSlotMetricsOptions as aa, type StreamSlotMetricsResult as ab, type StreamTransactionsOptions as ac, type StreamTransactionsResult as ad, type StreamTransactionUpdate as ae, type TrackTransactionOptions as af, type TrackTransactionUpdate as ag, type TransactionExecutionEvent as ah, type TransactionExecutionResultData as ai, type InstructionContext as aj, type BatchSendTransactionsOptions as ak, type BuildAndSignTransactionOptions as al, type BuildTransactionOptions as am, type InstructionData as an, type ListTransactionsForAccountOptions as ao, type RawTransactionQueryOptions as ap, type SendAndTrackTxnOptions as aq, type SendAndTrackTxnUpdate as ar, type TransactionAccountsConfig as as, type TransactionFeePayerConfig as at, type TransactionHeaderConfig as au, type TransactionList as av, type TransactionQueryOptions as aw, type GenerateStateProofOptions as ax, type GetStateRootsOptions as ay, type ThruClientContext as az, blocks as b, streamSlotMetrics as b0, generateStateProof as b1, getStateRoots as b2, generateKeyPair as b3, fromPrivateKey as b4, consensusStatusToString as b5, versionContext as b6, currentVersionContext as b7, currentOrHistoricalVersionContext as b8, slotVersionContext as b9, timestampVersionContext as ba, seqVersionContext as bb, getNodePubkey as bc, getNodeRecords as bd, streamNodeRecords as be, getChainInfo as bf, getChainId as bg, type ThruClientConfig as bh, chain as c, consensus as d, events as e, streaming as f, Block as g, height as h, FilterParamValue as i, PageResponse as j, keys as k, Pubkey as l, Signature as m, node as n, StateProof as o, proofs as p, TransactionStatusSnapshot as q, deriveAddress as r, slots as s, transactions as t, deriveProgramAddress as u, collectStream as v, firstStreamValue as w, forEachStreamValue as x, type PageRequestParams as y, type PageResponseParams as z };
@@ -1,7 +1,7 @@
1
1
  import { utils, etc, Point, CURVE, getPublicKeyAsync } from '@noble/ed25519';
2
2
  import { create } from '@bufbuild/protobuf';
3
3
  import { encodeAddress, decodeAddress, isHexString, hexToBytes, encodeSignature, decodeSignature, ensureBytes } from '@thru/helpers';
4
- import { AccountView, BlockView, TransactionView, ConsensusStatus, VersionContextSchema, CurrentVersionSchema, PubkeySchema, TaPubkeySchema, SignatureSchema, TsSignatureSchema, TransactionVmError, StreamingService, CommandService, QueryService, PageRequestSchema, PageResponseSchema, StateProofRequestSchema, GenerateStateProofRequestSchema, GetAccountRequestSchema, GetRawAccountRequestSchema, ListAccountsRequestSchema, StateProofType, ExecutionStatus, GetBlockRequestSchema, GetRawBlockRequestSchema, ListBlocksRequestSchema, GetChainInfoRequestSchema, CurrentOrHistoricalVersionSchema, GetEventRequestSchema, ListEventsRequestSchema, GetHeightRequestSchema, FilterParamValueSchema, FilterSchema, StreamBlocksRequestSchema, StreamAccountUpdatesRequestSchema, StreamTransactionsRequestSchema, StreamEventsRequestSchema, TrackTransactionRequestSchema, StreamHeightRequestSchema, GetTransactionRequestSchema, GetRawTransactionRequestSchema, GetTransactionStatusRequestSchema, ListTransactionsForAccountRequestSchema, ListTransactionsRequestSchema, BatchSendTransactionsRequestSchema, SendTransactionRequestSchema, BlockHashSchema } from '@thru/proto';
4
+ import { AccountView, BlockView, TransactionView, ConsensusStatus, VersionContextSchema, CurrentVersionSchema, PubkeySchema, TaPubkeySchema, SignatureSchema, TsSignatureSchema, TransactionVmError, StreamingService, CommandService, QueryService, PageRequestSchema, PageResponseSchema, StateProofRequestSchema, GenerateStateProofRequestSchema, GetStateRootsRequestSchema, GetAccountRequestSchema, GetRawAccountRequestSchema, ListAccountsRequestSchema, StateProofType, ExecutionStatus, GetBlockRequestSchema, GetRawBlockRequestSchema, ListBlocksRequestSchema, GetChainInfoRequestSchema, CurrentOrHistoricalVersionSchema, GetEventRequestSchema, ListEventsRequestSchema, GetHeightRequestSchema, GetNodePubkeyRequestSchema, GetNodeRecordsRequestSchema, GetSlotMetricsRequestSchema, ListSlotMetricsRequestSchema, FilterParamValueSchema, FilterSchema, StreamBlocksRequestSchema, StreamAccountUpdatesRequestSchema, StreamTransactionsRequestSchema, StreamEventsRequestSchema, TrackTransactionRequestSchema, StreamHeightRequestSchema, StreamSlotMetricsRequestSchema, StreamNodeRecordsRequestSchema, GetTransactionRequestSchema, GetRawTransactionRequestSchema, GetTransactionStatusRequestSchema, ListTransactionsForAccountRequestSchema, ListTransactionsRequestSchema, BatchSendTransactionsRequestSchema, SendAndTrackTxnRequestSchema, SendTransactionRequestSchema, BlockHashSchema } from '@thru/proto';
5
5
  import { createClient } from '@connectrpc/connect';
6
6
  import { createGrpcWebTransport } from '@connectrpc/connect-web';
7
7
  import { sha256 } from '@noble/hashes/sha2';
@@ -1323,7 +1323,8 @@ function copyBytes4(bytes) {
1323
1323
  // thru-ts-client-sdk/modules/proofs.ts
1324
1324
  var proofs_exports = {};
1325
1325
  __export(proofs_exports, {
1326
- generateStateProof: () => generateStateProof
1326
+ generateStateProof: () => generateStateProof,
1327
+ getStateRoots: () => getStateRoots
1327
1328
  });
1328
1329
  async function generateStateProof(ctx, options) {
1329
1330
  const targetSlot = options.targetSlot ?? 0n;
@@ -1342,6 +1343,12 @@ async function generateStateProof(ctx, options) {
1342
1343
  }
1343
1344
  return StateProof.fromProto(response.proof);
1344
1345
  }
1346
+ async function getStateRoots(ctx, options = {}) {
1347
+ const request = create(GetStateRootsRequestSchema, {
1348
+ slot: options.slot
1349
+ });
1350
+ return ctx.query.getStateRoots(request, withCallOptions(ctx));
1351
+ }
1345
1352
 
1346
1353
  // thru-ts-client-sdk/modules/accounts.ts
1347
1354
  var accounts_exports = {};
@@ -2033,11 +2040,15 @@ async function listBlocks(ctx, options = {}) {
2033
2040
  // thru-ts-client-sdk/modules/chain.ts
2034
2041
  var chain_exports = {};
2035
2042
  __export(chain_exports, {
2036
- getChainId: () => getChainId
2043
+ getChainId: () => getChainId,
2044
+ getChainInfo: () => getChainInfo
2037
2045
  });
2038
- async function getChainId(ctx) {
2046
+ async function getChainInfo(ctx) {
2039
2047
  const request = create(GetChainInfoRequestSchema);
2040
- const response = await ctx.query.getChainInfo(request, withCallOptions(ctx));
2048
+ return ctx.query.getChainInfo(request, withCallOptions(ctx));
2049
+ }
2050
+ async function getChainId(ctx) {
2051
+ const response = await getChainInfo(ctx);
2041
2052
  return response.chainId;
2042
2053
  }
2043
2054
 
@@ -2281,6 +2292,40 @@ function generateSeed() {
2281
2292
  cryptoObj.getRandomValues(bytes);
2282
2293
  return bytes;
2283
2294
  }
2295
+
2296
+ // thru-ts-client-sdk/modules/node.ts
2297
+ var node_exports = {};
2298
+ __export(node_exports, {
2299
+ getNodePubkey: () => getNodePubkey,
2300
+ getNodeRecords: () => getNodeRecords
2301
+ });
2302
+ async function getNodePubkey(ctx) {
2303
+ const request = create(GetNodePubkeyRequestSchema, {});
2304
+ return ctx.query.getNodePubkey(request, withCallOptions(ctx));
2305
+ }
2306
+ async function getNodeRecords(ctx) {
2307
+ const request = create(GetNodeRecordsRequestSchema, {});
2308
+ return ctx.query.getNodeRecords(request, withCallOptions(ctx));
2309
+ }
2310
+
2311
+ // thru-ts-client-sdk/modules/slots.ts
2312
+ var slots_exports = {};
2313
+ __export(slots_exports, {
2314
+ getSlotMetrics: () => getSlotMetrics,
2315
+ listSlotMetrics: () => listSlotMetrics
2316
+ });
2317
+ async function getSlotMetrics(ctx, slot) {
2318
+ const request = create(GetSlotMetricsRequestSchema, { slot });
2319
+ return ctx.query.getSlotMetrics(request, withCallOptions(ctx));
2320
+ }
2321
+ async function listSlotMetrics(ctx, options) {
2322
+ const request = create(ListSlotMetricsRequestSchema, {
2323
+ startSlot: options.startSlot,
2324
+ endSlot: options.endSlot,
2325
+ limit: options.limit
2326
+ });
2327
+ return ctx.query.listSlotMetrics(request, withCallOptions(ctx));
2328
+ }
2284
2329
  function copyBytes8(source) {
2285
2330
  const bytes = new Uint8Array(source.length);
2286
2331
  bytes.set(source);
@@ -2657,6 +2702,8 @@ __export(streaming_exports, {
2657
2702
  streamBlocks: () => streamBlocks,
2658
2703
  streamEvents: () => streamEvents,
2659
2704
  streamHeight: () => streamHeight,
2705
+ streamNodeRecords: () => streamNodeRecords,
2706
+ streamSlotMetrics: () => streamSlotMetrics,
2660
2707
  streamTransactions: () => streamTransactions,
2661
2708
  trackTransaction: () => trackTransaction
2662
2709
  });
@@ -2681,7 +2728,7 @@ function streamBlocks(ctx, options = {}) {
2681
2728
  function streamAccountUpdates(ctx, address, options = {}) {
2682
2729
  const addressBytes = Pubkey.from(address).toBytes();
2683
2730
  const addressFilter = new Filter({
2684
- expression: "snapshot.address.value == params.address || account_update.address.value == params.address",
2731
+ expression: "account_address.value == params.address",
2685
2732
  params: {
2686
2733
  address: FilterParamValue.bytes(addressBytes)
2687
2734
  }
@@ -2775,6 +2822,38 @@ function streamHeight(ctx, options = {}) {
2775
2822
  }
2776
2823
  return mapper();
2777
2824
  }
2825
+ function streamSlotMetrics(ctx, options = {}) {
2826
+ const request = create(StreamSlotMetricsRequestSchema, {
2827
+ startSlot: options.startSlot
2828
+ });
2829
+ const iterable = ctx.streaming.streamSlotMetrics(request, withCallOptions(ctx, { signal: options.signal }));
2830
+ async function* mapper() {
2831
+ for await (const response of iterable) {
2832
+ yield {
2833
+ slot: response.slot,
2834
+ collectedFees: response.collectedFees,
2835
+ globalActivatedStateCounter: response.globalActivatedStateCounter,
2836
+ globalDeactivatedStateCounter: response.globalDeactivatedStateCounter,
2837
+ blockTimestamp: response.blockTimestamp
2838
+ };
2839
+ }
2840
+ }
2841
+ return mapper();
2842
+ }
2843
+ function streamNodeRecords(ctx, options = {}) {
2844
+ const request = create(StreamNodeRecordsRequestSchema, {});
2845
+ const iterable = ctx.streaming.streamNodeRecords(request, withCallOptions(ctx, { signal: options.signal }));
2846
+ async function* mapper() {
2847
+ for await (const response of iterable) {
2848
+ if (response.message.case === "record") {
2849
+ yield { type: "record", record: response.message.value };
2850
+ } else if (response.message.case === "finished") {
2851
+ yield { type: "finished" };
2852
+ }
2853
+ }
2854
+ }
2855
+ return mapper();
2856
+ }
2778
2857
  async function collectStream(iterable, options = {}) {
2779
2858
  const { limit, signal } = options;
2780
2859
  throwIfAborted(signal);
@@ -2831,6 +2910,7 @@ __export(transactions_exports, {
2831
2910
  getTransactionStatus: () => getTransactionStatus,
2832
2911
  listTransactions: () => listTransactions,
2833
2912
  listTransactionsForAccount: () => listTransactionsForAccount,
2913
+ sendAndTrackTxn: () => sendAndTrackTxn,
2834
2914
  sendTransaction: () => sendTransaction
2835
2915
  });
2836
2916
  async function getTransaction(ctx, signature, options = {}) {
@@ -2926,6 +3006,35 @@ async function batchSendTransactions(ctx, transactions, options = {}) {
2926
3006
  });
2927
3007
  return ctx.command.batchSendTransactions(request, withCallOptions(ctx));
2928
3008
  }
3009
+ function sendAndTrackTxn(ctx, transaction, options = {}) {
3010
+ const raw = transaction instanceof Uint8Array ? transaction : transaction.toWire();
3011
+ const request = create(SendAndTrackTxnRequestSchema, {
3012
+ transaction: raw,
3013
+ timeout: options.timeoutMs != null ? {
3014
+ seconds: BigInt(Math.floor(options.timeoutMs / 1e3)),
3015
+ nanos: options.timeoutMs % 1e3 * 1e6
3016
+ } : void 0
3017
+ });
3018
+ const iterable = ctx.command.sendAndTrackTxn(request, {
3019
+ ...withCallOptions(ctx),
3020
+ signal: options.signal
3021
+ });
3022
+ async function* mapper() {
3023
+ for await (const response of iterable) {
3024
+ yield {
3025
+ status: response.status,
3026
+ signature: response.signature ? { value: response.signature.value } : void 0,
3027
+ consensusStatus: response.consensusStatus,
3028
+ executionResult: response.executionResult ? {
3029
+ vmError: response.executionResult.vmError,
3030
+ consumedComputeUnits: response.executionResult.consumedComputeUnits,
3031
+ userErrorCode: response.executionResult.userErrorCode
3032
+ } : void 0
3033
+ };
3034
+ }
3035
+ }
3036
+ return mapper();
3037
+ }
2929
3038
  async function sendRawTransaction(ctx, rawTransaction) {
2930
3039
  const request = create(SendTransactionRequestSchema, { rawTransaction });
2931
3040
  const response = await ctx.command.sendTransaction(request, withCallOptions(ctx));
@@ -3064,6 +3173,6 @@ var VersionInfo = class _VersionInfo {
3064
3173
  }
3065
3174
  };
3066
3175
 
3067
- export { Account, Block, ChainEvent, Filter, FilterParamValue, HeightSnapshot, PageRequest, PageResponse, Pubkey, Signature, SignatureDomain, StateProof, Transaction, TransactionBuilder, TransactionStatusSnapshot, VersionInfo, accounts_exports, batchSendTransactions, blocks_exports, buildAndSignTransaction, buildTransaction, chain_exports, collectStream, consensusStatusToString, consensus_exports, createAccount, createThruClientContext, currentOrHistoricalVersionContext, currentVersionContext, deriveAddress, deriveProgramAddress, events_exports, firstStreamValue, forEachStreamValue, fromPrivateKey, generateKeyPair, generateStateProof, getAccount, getBlock, getBlockHeight, getEvent, getRawAccount, getRawBlock, getRawTransaction, getTransaction, getTransactionStatus, height_exports, keys_exports, listAccounts, listBlocks, listEvents, listTransactions, listTransactionsForAccount, proofs_exports, sendTransaction, seqVersionContext, signWithDomain, slotVersionContext, streamAccountUpdates, streamBlocks, streamEvents, streamHeight, streamTransactions, streaming_exports, timestampVersionContext, trackTransaction, transactions_exports, verifyWithDomain, versionContext, withCallOptions };
3068
- //# sourceMappingURL=chunk-BYQMY4EE.js.map
3069
- //# sourceMappingURL=chunk-BYQMY4EE.js.map
3176
+ export { Account, Block, ChainEvent, Filter, FilterParamValue, HeightSnapshot, PageRequest, PageResponse, Pubkey, Signature, SignatureDomain, StateProof, Transaction, TransactionBuilder, TransactionStatusSnapshot, VersionInfo, accounts_exports, batchSendTransactions, blocks_exports, buildAndSignTransaction, buildTransaction, chain_exports, collectStream, consensusStatusToString, consensus_exports, createAccount, createThruClientContext, currentOrHistoricalVersionContext, currentVersionContext, deriveAddress, deriveProgramAddress, events_exports, firstStreamValue, forEachStreamValue, fromPrivateKey, generateKeyPair, generateStateProof, getAccount, getBlock, getBlockHeight, getChainId, getChainInfo, getEvent, getNodePubkey, getNodeRecords, getRawAccount, getRawBlock, getRawTransaction, getSlotMetrics, getStateRoots, getTransaction, getTransactionStatus, height_exports, keys_exports, listAccounts, listBlocks, listEvents, listSlotMetrics, listTransactions, listTransactionsForAccount, node_exports, proofs_exports, sendAndTrackTxn, sendTransaction, seqVersionContext, signWithDomain, slotVersionContext, slots_exports, streamAccountUpdates, streamBlocks, streamEvents, streamHeight, streamNodeRecords, streamSlotMetrics, streamTransactions, streaming_exports, timestampVersionContext, trackTransaction, transactions_exports, verifyWithDomain, versionContext, withCallOptions };
3177
+ //# sourceMappingURL=chunk-ZMDQDIE5.js.map
3178
+ //# sourceMappingURL=chunk-ZMDQDIE5.js.map