@thru/thru-sdk 0.2.7 → 0.2.9
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/{chunk-DSEDHQB6.js → chunk-7YBVSFCS.js} +927 -829
- package/dist/chunk-7YBVSFCS.js.map +1 -0
- package/dist/{VersionInfo-BsDQIEcl.d.ts → client-BbrO3ANU.d.ts} +98 -3
- package/dist/client.d.ts +3 -100
- package/dist/client.js +1 -100
- package/dist/client.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-DSEDHQB6.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
import { Timestamp } from '@bufbuild/protobuf/wkt';
|
|
3
1
|
import { Transport, createClient, CallOptions, Interceptor } from '@connectrpc/connect';
|
|
4
2
|
import { GrpcWebTransportOptions } from '@connectrpc/connect-web';
|
|
3
|
+
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';
|
|
4
|
+
import { Timestamp } from '@bufbuild/protobuf/wkt';
|
|
5
5
|
|
|
6
6
|
type PubkeyInput = Uint8Array | string | Pubkey;
|
|
7
7
|
declare class Pubkey {
|
|
@@ -1060,4 +1060,99 @@ declare class VersionInfo {
|
|
|
1060
1060
|
get(component: string): string | undefined;
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
1063
|
-
|
|
1063
|
+
declare function getVersion(ctx: ThruClientContext): Promise<VersionInfo>;
|
|
1064
|
+
|
|
1065
|
+
type BoundFunction<F> = F extends (ctx: ThruClientContext, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
1066
|
+
interface BoundBlocks {
|
|
1067
|
+
get: BoundFunction<typeof getBlock>;
|
|
1068
|
+
getRaw: BoundFunction<typeof getRawBlock>;
|
|
1069
|
+
list: BoundFunction<typeof listBlocks>;
|
|
1070
|
+
stream: BoundFunction<typeof streamBlocks>;
|
|
1071
|
+
getBlockHeight: BoundFunction<typeof getBlockHeight>;
|
|
1072
|
+
streamHeight: BoundFunction<typeof streamHeight>;
|
|
1073
|
+
}
|
|
1074
|
+
interface BoundAccounts {
|
|
1075
|
+
get: BoundFunction<typeof getAccount>;
|
|
1076
|
+
getRaw: BoundFunction<typeof getRawAccount>;
|
|
1077
|
+
list: BoundFunction<typeof listAccounts>;
|
|
1078
|
+
stream: BoundFunction<typeof streamAccountUpdates>;
|
|
1079
|
+
create: BoundFunction<typeof createAccount>;
|
|
1080
|
+
}
|
|
1081
|
+
interface BoundTransactions {
|
|
1082
|
+
get: BoundFunction<typeof getTransaction>;
|
|
1083
|
+
getRaw: BoundFunction<typeof getRawTransaction>;
|
|
1084
|
+
getStatus: BoundFunction<typeof getTransactionStatus>;
|
|
1085
|
+
list: BoundFunction<typeof listTransactions>;
|
|
1086
|
+
listForAccount: BoundFunction<typeof listTransactionsForAccount>;
|
|
1087
|
+
stream: BoundFunction<typeof streamTransactions>;
|
|
1088
|
+
build: BoundFunction<typeof buildTransaction>;
|
|
1089
|
+
buildAndSign: BoundFunction<typeof buildAndSignTransaction>;
|
|
1090
|
+
send: BoundFunction<typeof sendTransaction>;
|
|
1091
|
+
batchSend: BoundFunction<typeof batchSendTransactions>;
|
|
1092
|
+
sendAndTrack: BoundFunction<typeof sendAndTrackTxn>;
|
|
1093
|
+
track: BoundFunction<typeof trackTransaction>;
|
|
1094
|
+
}
|
|
1095
|
+
interface BoundEvents {
|
|
1096
|
+
get: BoundFunction<typeof getEvent>;
|
|
1097
|
+
list: BoundFunction<typeof listEvents>;
|
|
1098
|
+
stream: BoundFunction<typeof streamEvents>;
|
|
1099
|
+
}
|
|
1100
|
+
interface BoundProofs {
|
|
1101
|
+
generate: BoundFunction<typeof generateStateProof>;
|
|
1102
|
+
getStateRoots: BoundFunction<typeof getStateRoots>;
|
|
1103
|
+
}
|
|
1104
|
+
interface BoundKeys {
|
|
1105
|
+
generateKeyPair: typeof generateKeyPair;
|
|
1106
|
+
fromPrivateKey: typeof fromPrivateKey;
|
|
1107
|
+
}
|
|
1108
|
+
interface BoundVersion {
|
|
1109
|
+
get: BoundFunction<typeof getVersion>;
|
|
1110
|
+
}
|
|
1111
|
+
interface BoundSlots {
|
|
1112
|
+
getMetrics: BoundFunction<typeof getSlotMetrics>;
|
|
1113
|
+
listMetrics: BoundFunction<typeof listSlotMetrics>;
|
|
1114
|
+
streamMetrics: BoundFunction<typeof streamSlotMetrics>;
|
|
1115
|
+
}
|
|
1116
|
+
interface BoundNode {
|
|
1117
|
+
getPubkey: BoundFunction<typeof getNodePubkey>;
|
|
1118
|
+
getRecords: BoundFunction<typeof getNodeRecords>;
|
|
1119
|
+
streamRecords: BoundFunction<typeof streamNodeRecords>;
|
|
1120
|
+
}
|
|
1121
|
+
interface BoundChain {
|
|
1122
|
+
getChainInfo: BoundFunction<typeof getChainInfo>;
|
|
1123
|
+
getChainId: BoundFunction<typeof getChainId>;
|
|
1124
|
+
}
|
|
1125
|
+
interface BoundConsensus {
|
|
1126
|
+
statusToString: typeof consensusStatusToString;
|
|
1127
|
+
versionContext: typeof versionContext;
|
|
1128
|
+
currentVersionContext: typeof currentVersionContext;
|
|
1129
|
+
currentOrHistoricalVersionContext: typeof currentOrHistoricalVersionContext;
|
|
1130
|
+
slotVersionContext: typeof slotVersionContext;
|
|
1131
|
+
timestampVersionContext: typeof timestampVersionContext;
|
|
1132
|
+
seqVersionContext: typeof seqVersionContext;
|
|
1133
|
+
}
|
|
1134
|
+
interface Helpers {
|
|
1135
|
+
createSignature(value: SignatureInput): Signature;
|
|
1136
|
+
createPubkey(value: PubkeyInput): Pubkey;
|
|
1137
|
+
deriveProgramAddress(options: DeriveProgramAddressOptions): DeriveProgramAddressResult;
|
|
1138
|
+
deriveAddress(inputs: DeriveAddressInput[]): DeriveAddressResult;
|
|
1139
|
+
}
|
|
1140
|
+
interface Thru {
|
|
1141
|
+
ctx: ThruClientContext;
|
|
1142
|
+
blocks: BoundBlocks;
|
|
1143
|
+
accounts: BoundAccounts;
|
|
1144
|
+
transactions: BoundTransactions;
|
|
1145
|
+
events: BoundEvents;
|
|
1146
|
+
slots: BoundSlots;
|
|
1147
|
+
proofs: BoundProofs;
|
|
1148
|
+
keys: BoundKeys;
|
|
1149
|
+
version: BoundVersion;
|
|
1150
|
+
consensus: BoundConsensus;
|
|
1151
|
+
node: BoundNode;
|
|
1152
|
+
chain: BoundChain;
|
|
1153
|
+
helpers: Helpers;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
declare function createThruClient(config?: ThruClientConfig): Thru;
|
|
1157
|
+
|
|
1158
|
+
export { type DeriveProgramAddressOptions as $, Account as A, type BuildTransactionParams as B, ChainEvent as C, type PageResponseParams as D, type Thru as E, Filter as F, type ThruClientConfig as G, HeightSnapshot as H, type PubkeyInput as I, type SignatureInput as J, type VersionContextInput as K, type AccountQueryOptions as L, type CreateAccountOptions as M, type ListAccountsOptions as N, type BlockList as O, PageRequest as P, type BlockQueryOptions as Q, type RawAccountQueryOptions as R, type SignedTransactionResult as S, Transaction as T, type ListBlocksOptions as U, VersionInfo as V, type RawBlockQueryOptions as W, type GetEventOptions as X, type BlockSelector as Y, type DeriveAddressInput as Z, type DeriveAddressResult as _, accounts as a, type DeriveProgramAddressResult as a0, type GeneratedKeyPair as a1, type ListSlotMetricsOptions as a2, type StreamAccountUpdate as a3, type HeightSnapshotParams as a4, type StreamAccountUpdatesOptions as a5, type StreamAccountUpdatesResult as a6, type StreamBlocksOptions as a7, type StreamBlocksResult as a8, type StreamEventsOptions as a9, type GenerateStateProofOptions as aA, type GetStateRootsOptions as aB, type StreamEventsResult as aa, type StreamNodeRecordsOptions as ab, type StreamNodeRecordsResult as ac, type StreamSlotMetricsOptions as ad, type StreamSlotMetricsResult as ae, type StreamTransactionsOptions as af, type StreamTransactionsResult as ag, type StreamTransactionUpdate as ah, type TrackTransactionOptions as ai, type TrackTransactionUpdate as aj, type TransactionExecutionEvent as ak, type TransactionExecutionResultData as al, type InstructionContext as am, type BatchSendTransactionsOptions as an, type BuildAndSignTransactionOptions as ao, type BuildTransactionOptions as ap, type InstructionData as aq, type ListTransactionsForAccountOptions as ar, type RawTransactionQueryOptions as as, type SendAndTrackTxnOptions as at, type SendAndTrackTxnUpdate as au, type TransactionAccountsConfig as av, type TransactionFeePayerConfig as aw, type TransactionHeaderConfig as ax, type TransactionList as ay, type TransactionQueryOptions as az, blocks as b, 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, createThruClient as v, collectStream as w, firstStreamValue as x, forEachStreamValue as y, type PageRequestParams as z };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,102 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import '@thru/proto';
|
|
3
|
-
import '@bufbuild/protobuf/wkt';
|
|
1
|
+
export { E as Thru, G as ThruClientConfig, v as createThruClient } from './client-BbrO3ANU.js';
|
|
4
2
|
import '@connectrpc/connect';
|
|
5
3
|
import '@connectrpc/connect-web';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type BoundFunction<F> = F extends (ctx: ThruClientContext, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
10
|
-
interface BoundBlocks {
|
|
11
|
-
get: BoundFunction<typeof getBlock>;
|
|
12
|
-
getRaw: BoundFunction<typeof getRawBlock>;
|
|
13
|
-
list: BoundFunction<typeof listBlocks>;
|
|
14
|
-
stream: BoundFunction<typeof streamBlocks>;
|
|
15
|
-
getBlockHeight: BoundFunction<typeof getBlockHeight>;
|
|
16
|
-
streamHeight: BoundFunction<typeof streamHeight>;
|
|
17
|
-
}
|
|
18
|
-
interface BoundAccounts {
|
|
19
|
-
get: BoundFunction<typeof getAccount>;
|
|
20
|
-
getRaw: BoundFunction<typeof getRawAccount>;
|
|
21
|
-
list: BoundFunction<typeof listAccounts>;
|
|
22
|
-
stream: BoundFunction<typeof streamAccountUpdates>;
|
|
23
|
-
create: BoundFunction<typeof createAccount>;
|
|
24
|
-
}
|
|
25
|
-
interface BoundTransactions {
|
|
26
|
-
get: BoundFunction<typeof getTransaction>;
|
|
27
|
-
getRaw: BoundFunction<typeof getRawTransaction>;
|
|
28
|
-
getStatus: BoundFunction<typeof getTransactionStatus>;
|
|
29
|
-
list: BoundFunction<typeof listTransactions>;
|
|
30
|
-
listForAccount: BoundFunction<typeof listTransactionsForAccount>;
|
|
31
|
-
stream: BoundFunction<typeof streamTransactions>;
|
|
32
|
-
build: BoundFunction<typeof buildTransaction>;
|
|
33
|
-
buildAndSign: BoundFunction<typeof buildAndSignTransaction>;
|
|
34
|
-
send: BoundFunction<typeof sendTransaction>;
|
|
35
|
-
batchSend: BoundFunction<typeof batchSendTransactions>;
|
|
36
|
-
sendAndTrack: BoundFunction<typeof sendAndTrackTxn>;
|
|
37
|
-
track: BoundFunction<typeof trackTransaction>;
|
|
38
|
-
}
|
|
39
|
-
interface BoundEvents {
|
|
40
|
-
get: BoundFunction<typeof getEvent>;
|
|
41
|
-
list: BoundFunction<typeof listEvents>;
|
|
42
|
-
stream: BoundFunction<typeof streamEvents>;
|
|
43
|
-
}
|
|
44
|
-
interface BoundProofs {
|
|
45
|
-
generate: BoundFunction<typeof generateStateProof>;
|
|
46
|
-
getStateRoots: BoundFunction<typeof getStateRoots>;
|
|
47
|
-
}
|
|
48
|
-
interface BoundKeys {
|
|
49
|
-
generateKeyPair: typeof generateKeyPair;
|
|
50
|
-
fromPrivateKey: typeof fromPrivateKey;
|
|
51
|
-
}
|
|
52
|
-
interface BoundVersion {
|
|
53
|
-
get: BoundFunction<typeof getVersion>;
|
|
54
|
-
}
|
|
55
|
-
interface BoundSlots {
|
|
56
|
-
getMetrics: BoundFunction<typeof getSlotMetrics>;
|
|
57
|
-
listMetrics: BoundFunction<typeof listSlotMetrics>;
|
|
58
|
-
streamMetrics: BoundFunction<typeof streamSlotMetrics>;
|
|
59
|
-
}
|
|
60
|
-
interface BoundNode {
|
|
61
|
-
getPubkey: BoundFunction<typeof getNodePubkey>;
|
|
62
|
-
getRecords: BoundFunction<typeof getNodeRecords>;
|
|
63
|
-
streamRecords: BoundFunction<typeof streamNodeRecords>;
|
|
64
|
-
}
|
|
65
|
-
interface BoundChain {
|
|
66
|
-
getChainInfo: BoundFunction<typeof getChainInfo>;
|
|
67
|
-
getChainId: BoundFunction<typeof getChainId>;
|
|
68
|
-
}
|
|
69
|
-
interface BoundConsensus {
|
|
70
|
-
statusToString: typeof consensusStatusToString;
|
|
71
|
-
versionContext: typeof versionContext;
|
|
72
|
-
currentVersionContext: typeof currentVersionContext;
|
|
73
|
-
currentOrHistoricalVersionContext: typeof currentOrHistoricalVersionContext;
|
|
74
|
-
slotVersionContext: typeof slotVersionContext;
|
|
75
|
-
timestampVersionContext: typeof timestampVersionContext;
|
|
76
|
-
seqVersionContext: typeof seqVersionContext;
|
|
77
|
-
}
|
|
78
|
-
interface Helpers {
|
|
79
|
-
createSignature(value: SignatureInput): Signature;
|
|
80
|
-
createPubkey(value: PubkeyInput): Pubkey;
|
|
81
|
-
deriveProgramAddress(options: DeriveProgramAddressOptions): DeriveProgramAddressResult;
|
|
82
|
-
deriveAddress(inputs: DeriveAddressInput[]): DeriveAddressResult;
|
|
83
|
-
}
|
|
84
|
-
interface Thru {
|
|
85
|
-
ctx: ThruClientContext;
|
|
86
|
-
blocks: BoundBlocks;
|
|
87
|
-
accounts: BoundAccounts;
|
|
88
|
-
transactions: BoundTransactions;
|
|
89
|
-
events: BoundEvents;
|
|
90
|
-
slots: BoundSlots;
|
|
91
|
-
proofs: BoundProofs;
|
|
92
|
-
keys: BoundKeys;
|
|
93
|
-
version: BoundVersion;
|
|
94
|
-
consensus: BoundConsensus;
|
|
95
|
-
node: BoundNode;
|
|
96
|
-
chain: BoundChain;
|
|
97
|
-
helpers: Helpers;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
declare function createThruClient(config?: ThruClientConfig): Thru;
|
|
101
|
-
|
|
102
|
-
export { type Thru, ThruClientConfig, createThruClient };
|
|
4
|
+
import '@thru/proto';
|
|
5
|
+
import '@bufbuild/protobuf/wkt';
|
package/dist/client.js
CHANGED
|
@@ -1,102 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { create } from '@bufbuild/protobuf';
|
|
3
|
-
import { GetVersionRequestSchema } from '@thru/proto';
|
|
4
|
-
|
|
5
|
-
function getVersion(ctx) {
|
|
6
|
-
const request = create(GetVersionRequestSchema);
|
|
7
|
-
return ctx.query.getVersion(request, withCallOptions(ctx)).then((response) => VersionInfo.fromProto(response));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// thru-ts-client-sdk/core/bound-client.ts
|
|
11
|
-
function bind(ctx, fn) {
|
|
12
|
-
return ((...args) => fn(ctx, ...args));
|
|
13
|
-
}
|
|
14
|
-
function createBoundThruClient(ctx) {
|
|
15
|
-
return {
|
|
16
|
-
ctx,
|
|
17
|
-
blocks: {
|
|
18
|
-
get: bind(ctx, getBlock),
|
|
19
|
-
getRaw: bind(ctx, getRawBlock),
|
|
20
|
-
list: bind(ctx, listBlocks),
|
|
21
|
-
stream: bind(ctx, streamBlocks),
|
|
22
|
-
getBlockHeight: bind(ctx, getBlockHeight),
|
|
23
|
-
streamHeight: bind(ctx, streamHeight)
|
|
24
|
-
},
|
|
25
|
-
accounts: {
|
|
26
|
-
get: bind(ctx, getAccount),
|
|
27
|
-
getRaw: bind(ctx, getRawAccount),
|
|
28
|
-
list: bind(ctx, listAccounts),
|
|
29
|
-
stream: bind(ctx, streamAccountUpdates),
|
|
30
|
-
create: bind(ctx, createAccount)
|
|
31
|
-
},
|
|
32
|
-
transactions: {
|
|
33
|
-
get: bind(ctx, getTransaction),
|
|
34
|
-
getRaw: bind(ctx, getRawTransaction),
|
|
35
|
-
getStatus: bind(ctx, getTransactionStatus),
|
|
36
|
-
list: bind(ctx, listTransactions),
|
|
37
|
-
listForAccount: bind(ctx, listTransactionsForAccount),
|
|
38
|
-
stream: bind(ctx, streamTransactions),
|
|
39
|
-
build: bind(ctx, buildTransaction),
|
|
40
|
-
buildAndSign: bind(ctx, buildAndSignTransaction),
|
|
41
|
-
send: bind(ctx, sendTransaction),
|
|
42
|
-
batchSend: bind(ctx, batchSendTransactions),
|
|
43
|
-
sendAndTrack: bind(ctx, sendAndTrackTxn),
|
|
44
|
-
track: bind(ctx, trackTransaction)
|
|
45
|
-
},
|
|
46
|
-
helpers: {
|
|
47
|
-
createSignature: Signature.from,
|
|
48
|
-
createPubkey: Pubkey.from,
|
|
49
|
-
deriveProgramAddress,
|
|
50
|
-
deriveAddress
|
|
51
|
-
},
|
|
52
|
-
keys: {
|
|
53
|
-
generateKeyPair,
|
|
54
|
-
fromPrivateKey
|
|
55
|
-
},
|
|
56
|
-
events: {
|
|
57
|
-
get: bind(ctx, getEvent),
|
|
58
|
-
list: bind(ctx, listEvents),
|
|
59
|
-
stream: bind(ctx, streamEvents)
|
|
60
|
-
},
|
|
61
|
-
slots: {
|
|
62
|
-
getMetrics: bind(ctx, getSlotMetrics),
|
|
63
|
-
listMetrics: bind(ctx, listSlotMetrics),
|
|
64
|
-
streamMetrics: bind(ctx, streamSlotMetrics)
|
|
65
|
-
},
|
|
66
|
-
proofs: {
|
|
67
|
-
generate: bind(ctx, generateStateProof),
|
|
68
|
-
getStateRoots: bind(ctx, getStateRoots)
|
|
69
|
-
},
|
|
70
|
-
node: {
|
|
71
|
-
getPubkey: bind(ctx, getNodePubkey),
|
|
72
|
-
getRecords: bind(ctx, getNodeRecords),
|
|
73
|
-
streamRecords: bind(ctx, streamNodeRecords)
|
|
74
|
-
},
|
|
75
|
-
chain: {
|
|
76
|
-
getChainInfo: bind(ctx, getChainInfo),
|
|
77
|
-
getChainId: bind(ctx, getChainId)
|
|
78
|
-
},
|
|
79
|
-
version: {
|
|
80
|
-
get: bind(ctx, getVersion)
|
|
81
|
-
},
|
|
82
|
-
consensus: {
|
|
83
|
-
statusToString: consensusStatusToString,
|
|
84
|
-
versionContext,
|
|
85
|
-
currentVersionContext,
|
|
86
|
-
currentOrHistoricalVersionContext,
|
|
87
|
-
slotVersionContext,
|
|
88
|
-
timestampVersionContext,
|
|
89
|
-
seqVersionContext
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// thru-ts-client-sdk/client.ts
|
|
95
|
-
function createThruClient(config = {}) {
|
|
96
|
-
const ctx = createThruClientContext(config);
|
|
97
|
-
return createBoundThruClient(ctx);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export { createThruClient };
|
|
1
|
+
export { createThruClient } from './chunk-7YBVSFCS.js';
|
|
101
2
|
//# sourceMappingURL=client.js.map
|
|
102
3
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../thru-ts-client-sdk/modules/version.ts","../thru-ts-client-sdk/core/bound-client.ts","../thru-ts-client-sdk/client.ts"],"names":[],"mappings":";;;;AAOO,SAAS,WAAW,GAAA,EAA8C;AACrE,EAAA,MAAM,OAAA,GAAU,OAAO,uBAAuB,CAAA;AAC9C,EAAA,OAAO,GAAA,CAAI,KAAA,CACN,UAAA,CAAW,OAAA,EAAS,gBAAgB,GAAG,CAAC,CAAA,CACxC,IAAA,CAAK,CAAC,QAAA,KAAiC,WAAA,CAAY,SAAA,CAAU,QAAQ,CAAC,CAAA;AAC/E;;;ACiBA,SAAS,IAAA,CACL,KACA,EAAA,EACgB;AAChB,EAAA,QAAQ,CAAA,GAAI,IAAA,KAAkC,EAAA,CAAG,GAAA,EAAK,GAAG,IAAI,CAAA;AACjE;AAwGO,SAAS,sBAAsB,GAAA,EAA8B;AAChE,EAAA,OAAO;AAAA,IACH,GAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACJ,GAAA,EAAK,IAAA,CAAK,GAAA,EAAkB,QAAQ,CAAA;AAAA,MACpC,MAAA,EAAQ,IAAA,CAAK,GAAA,EAAkB,WAAW,CAAA;AAAA,MAC1C,IAAA,EAAM,IAAA,CAAK,GAAA,EAAkB,UAAU,CAAA;AAAA,MACvC,MAAA,EAAQ,IAAA,CAAK,GAAA,EAAqB,YAAY,CAAA;AAA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K,IAAA,CAAK,GAAA,EAAmB,UAAU;AAAA,KAC3C;AAAA,IACA,SAAA,EAAW;AAAA,MACP,cAAA,EAAgC,uBAAA;AAAA,MAChC,cAAA;AAAA,MACA,qBAAA;AAAA,MACA,iCAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA;AAAA;AACJ,GACJ;AACJ;;;AC5MO,SAAS,gBAAA,CAAiB,MAAA,GAA2B,EAAC,EAAS;AAClE,EAAA,MAAM,GAAA,GAAM,wBAAwB,MAAM,CAAA;AAC1C,EAAA,OAAO,sBAAsB,GAAG,CAAA;AACpC","file":"client.js","sourcesContent":["import { create } from \"@bufbuild/protobuf\";\n\nimport type { ThruClientContext } from \"../core/client\";\nimport { withCallOptions } from \"../core/client\";\nimport { VersionInfo } from \"../domain/version\";\nimport { GetVersionRequestSchema, type GetVersionResponse } from \"@thru/proto\";\n\nexport function getVersion(ctx: ThruClientContext): Promise<VersionInfo> {\n const request = create(GetVersionRequestSchema);\n return ctx.query\n .getVersion(request, withCallOptions(ctx))\n .then((response: GetVersionResponse) => VersionInfo.fromProto(response));\n}\n\n","import type { ThruClientContext } from \"./client\";\n\nimport { Pubkey, Signature, type PubkeyInput, type SignatureInput } from \"../domain/primitives\";\nimport * as accountsModule from \"../modules/accounts\";\nimport * as blocksModule from \"../modules/blocks\";\nimport * as consensusModule from \"../modules/consensus\";\nimport * as eventsModule from \"../modules/events\";\nimport * as heightModule from \"../modules/height\";\nimport {\n deriveAddress,\n DeriveAddressInput,\n DeriveAddressResult,\n deriveProgramAddress,\n type DeriveProgramAddressOptions,\n type DeriveProgramAddressResult\n} from \"../modules/helpers\";\nimport * as chainModule from \"../modules/chain\";\nimport * as keysModule from \"../modules/keys\";\nimport * as nodeModule from \"../modules/node\";\nimport * as proofsModule from \"../modules/proofs\";\nimport * as slotsModule from \"../modules/slots\";\nimport * as streamingModule from \"../modules/streaming\";\nimport * as transactionsModule from \"../modules/transactions\";\nimport * as versionModule from \"../modules/version\";\n\ntype ContextualParameters<F> = F extends (ctx: ThruClientContext, ...args: infer P) => any ? P : never;\n\ntype BoundFunction<F> = F extends (ctx: ThruClientContext, ...args: infer P) => infer R ? (...args: P) => R : never;\n\nfunction bind<F extends (ctx: ThruClientContext, ...args: any[]) => any>(\n ctx: ThruClientContext,\n fn: F,\n): BoundFunction<F> {\n return ((...args: ContextualParameters<F>) => fn(ctx, ...args)) as BoundFunction<F>;\n}\n\ninterface BoundBlocks {\n get: BoundFunction<typeof blocksModule.getBlock>;\n getRaw: BoundFunction<typeof blocksModule.getRawBlock>;\n list: BoundFunction<typeof blocksModule.listBlocks>;\n stream: BoundFunction<typeof streamingModule.streamBlocks>;\n getBlockHeight: BoundFunction<typeof heightModule.getBlockHeight>;\n streamHeight: BoundFunction<typeof streamingModule.streamHeight>;\n}\n\ninterface BoundAccounts {\n get: BoundFunction<typeof accountsModule.getAccount>;\n getRaw: BoundFunction<typeof accountsModule.getRawAccount>;\n list: BoundFunction<typeof accountsModule.listAccounts>;\n stream: BoundFunction<typeof streamingModule.streamAccountUpdates>;\n create: BoundFunction<typeof accountsModule.createAccount>;\n}\n\ninterface BoundTransactions {\n get: BoundFunction<typeof transactionsModule.getTransaction>;\n getRaw: BoundFunction<typeof transactionsModule.getRawTransaction>;\n getStatus: BoundFunction<typeof transactionsModule.getTransactionStatus>;\n list: BoundFunction<typeof transactionsModule.listTransactions>;\n listForAccount: BoundFunction<typeof transactionsModule.listTransactionsForAccount>;\n stream: BoundFunction<typeof streamingModule.streamTransactions>;\n build: BoundFunction<typeof transactionsModule.buildTransaction>;\n buildAndSign: BoundFunction<typeof transactionsModule.buildAndSignTransaction>;\n send: BoundFunction<typeof transactionsModule.sendTransaction>;\n batchSend: BoundFunction<typeof transactionsModule.batchSendTransactions>;\n sendAndTrack: BoundFunction<typeof transactionsModule.sendAndTrackTxn>;\n track: BoundFunction<typeof streamingModule.trackTransaction>;\n}\n\ninterface BoundEvents {\n get: BoundFunction<typeof eventsModule.getEvent>;\n list: BoundFunction<typeof eventsModule.listEvents>;\n stream: BoundFunction<typeof streamingModule.streamEvents>;\n}\n\ninterface BoundProofs {\n generate: BoundFunction<typeof proofsModule.generateStateProof>;\n getStateRoots: BoundFunction<typeof proofsModule.getStateRoots>;\n}\n\ninterface BoundKeys {\n generateKeyPair: typeof keysModule.generateKeyPair;\n fromPrivateKey: typeof keysModule.fromPrivateKey;\n}\n\ninterface BoundVersion {\n get: BoundFunction<typeof versionModule.getVersion>;\n}\n\ninterface BoundSlots {\n getMetrics: BoundFunction<typeof slotsModule.getSlotMetrics>;\n listMetrics: BoundFunction<typeof slotsModule.listSlotMetrics>;\n streamMetrics: BoundFunction<typeof streamingModule.streamSlotMetrics>;\n}\n\ninterface BoundNode {\n getPubkey: BoundFunction<typeof nodeModule.getNodePubkey>;\n getRecords: BoundFunction<typeof nodeModule.getNodeRecords>;\n streamRecords: BoundFunction<typeof streamingModule.streamNodeRecords>;\n}\n\ninterface BoundChain {\n getChainInfo: BoundFunction<typeof chainModule.getChainInfo>;\n getChainId: BoundFunction<typeof chainModule.getChainId>;\n}\n\ninterface BoundConsensus {\n statusToString: typeof consensusModule.consensusStatusToString;\n versionContext: typeof consensusModule.versionContext;\n currentVersionContext: typeof consensusModule.currentVersionContext;\n currentOrHistoricalVersionContext: typeof consensusModule.currentOrHistoricalVersionContext;\n slotVersionContext: typeof consensusModule.slotVersionContext;\n timestampVersionContext: typeof consensusModule.timestampVersionContext;\n seqVersionContext: typeof consensusModule.seqVersionContext;\n}\n\ninterface Helpers {\n createSignature(value: SignatureInput): Signature;\n createPubkey(value: PubkeyInput): Pubkey;\n deriveProgramAddress(options: DeriveProgramAddressOptions): DeriveProgramAddressResult;\n deriveAddress(inputs: DeriveAddressInput[]): DeriveAddressResult;\n}\n\nexport interface Thru {\n ctx: ThruClientContext;\n blocks: BoundBlocks;\n accounts: BoundAccounts;\n transactions: BoundTransactions;\n events: BoundEvents;\n slots: BoundSlots;\n proofs: BoundProofs;\n keys: BoundKeys;\n version: BoundVersion;\n consensus: BoundConsensus;\n node: BoundNode;\n chain: BoundChain;\n helpers: Helpers;\n}\n\nexport function createBoundThruClient(ctx: ThruClientContext): Thru {\n return {\n ctx,\n blocks: {\n get: bind(ctx, blocksModule.getBlock),\n getRaw: bind(ctx, blocksModule.getRawBlock),\n list: bind(ctx, blocksModule.listBlocks),\n stream: bind(ctx, streamingModule.streamBlocks),\n getBlockHeight: bind(ctx, heightModule.getBlockHeight),\n streamHeight: bind(ctx, streamingModule.streamHeight),\n },\n accounts: {\n get: bind(ctx, accountsModule.getAccount),\n getRaw: bind(ctx, accountsModule.getRawAccount),\n list: bind(ctx, accountsModule.listAccounts),\n stream: bind(ctx, streamingModule.streamAccountUpdates),\n create: bind(ctx, accountsModule.createAccount),\n },\n transactions: {\n get: bind(ctx, transactionsModule.getTransaction),\n getRaw: bind(ctx, transactionsModule.getRawTransaction),\n getStatus: bind(ctx, transactionsModule.getTransactionStatus),\n list: bind(ctx, transactionsModule.listTransactions),\n listForAccount: bind(ctx, transactionsModule.listTransactionsForAccount),\n stream: bind(ctx, streamingModule.streamTransactions),\n build: bind(ctx, transactionsModule.buildTransaction),\n buildAndSign: bind(ctx, transactionsModule.buildAndSignTransaction),\n send: bind(ctx, transactionsModule.sendTransaction),\n batchSend: bind(ctx, transactionsModule.batchSendTransactions),\n sendAndTrack: bind(ctx, transactionsModule.sendAndTrackTxn),\n track: bind(ctx, streamingModule.trackTransaction),\n },\n helpers: {\n createSignature: Signature.from,\n createPubkey: Pubkey.from,\n deriveProgramAddress,\n deriveAddress\n },\n keys: {\n generateKeyPair: keysModule.generateKeyPair,\n fromPrivateKey: keysModule.fromPrivateKey,\n },\n events: {\n get: bind(ctx, eventsModule.getEvent),\n list: bind(ctx, eventsModule.listEvents),\n stream: bind(ctx, streamingModule.streamEvents),\n },\n slots: {\n getMetrics: bind(ctx, slotsModule.getSlotMetrics),\n listMetrics: bind(ctx, slotsModule.listSlotMetrics),\n streamMetrics: bind(ctx, streamingModule.streamSlotMetrics),\n },\n proofs: {\n generate: bind(ctx, proofsModule.generateStateProof),\n getStateRoots: bind(ctx, proofsModule.getStateRoots),\n },\n node: {\n getPubkey: bind(ctx, nodeModule.getNodePubkey),\n getRecords: bind(ctx, nodeModule.getNodeRecords),\n streamRecords: bind(ctx, streamingModule.streamNodeRecords),\n },\n chain: {\n getChainInfo: bind(ctx, chainModule.getChainInfo),\n getChainId: bind(ctx, chainModule.getChainId),\n },\n version: {\n get: bind(ctx, versionModule.getVersion),\n },\n consensus: {\n statusToString: consensusModule.consensusStatusToString,\n versionContext: consensusModule.versionContext,\n currentVersionContext: consensusModule.currentVersionContext,\n currentOrHistoricalVersionContext: consensusModule.currentOrHistoricalVersionContext,\n slotVersionContext: consensusModule.slotVersionContext,\n timestampVersionContext: consensusModule.timestampVersionContext,\n seqVersionContext: consensusModule.seqVersionContext,\n },\n };\n}\n","import { createBoundThruClient, Thru } from \"./core/bound-client\";\nimport { createThruClientContext, ThruClientConfig } from \"./core/client\";\n\n// ============================================================================\n// Type Exports\n// ============================================================================\nexport type { Thru } from \"./core/bound-client\";\nexport type { ThruClientConfig } from \"./core/client\";\n\n// ============================================================================\n// Value Exports (functions)\n// ============================================================================\nexport function createThruClient(config: ThruClientConfig = {}): Thru {\n const ctx = createThruClientContext(config);\n return createBoundThruClient(ctx);\n}"]}
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"client.js"}
|