@thru/thru-sdk 0.1.34 → 0.1.38
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/VersionInfo-Cw5HUNrn.d.ts +960 -0
- package/dist/chunk-YIQKZL4H.js +2936 -0
- package/dist/chunk-YIQKZL4H.js.map +1 -0
- package/dist/client.d.ts +6 -3
- package/dist/client.js +8 -3
- package/dist/client.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/sdk.d.ts +11 -6
- package/dist/sdk.js +2 -371
- package/dist/sdk.js.map +1 -1
- package/package.json +6 -7
- package/dist/VersionInfo-BGciKJJA.d.ts +0 -2172
- package/dist/chunk-ZLV6WP54.js +0 -2534
- package/dist/chunk-ZLV6WP54.js.map +0 -1
|
@@ -0,0 +1,960 @@
|
|
|
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';
|
|
2
|
+
import { Timestamp } from '@bufbuild/protobuf/wkt';
|
|
3
|
+
import { Transport, createClient, CallOptions, Interceptor } from '@connectrpc/connect';
|
|
4
|
+
import { GrpcWebTransportOptions } from '@connectrpc/connect-web';
|
|
5
|
+
|
|
6
|
+
type PubkeyInput = Uint8Array | string | Pubkey;
|
|
7
|
+
declare class Pubkey {
|
|
8
|
+
private readonly bytes;
|
|
9
|
+
private constructor();
|
|
10
|
+
static from(value: PubkeyInput): Pubkey;
|
|
11
|
+
static isThruFmt(value: string): boolean;
|
|
12
|
+
toBytes(): Uint8Array;
|
|
13
|
+
toBytesUnsafe(): Uint8Array;
|
|
14
|
+
toThruFmt(): string;
|
|
15
|
+
toHex(): string;
|
|
16
|
+
equals(other: PubkeyInput): boolean;
|
|
17
|
+
toProtoPubkey(): Pubkey$1;
|
|
18
|
+
toProtoTaPubkey(): TaPubkey;
|
|
19
|
+
static fromProtoPubkey(proto?: Pubkey$1): Pubkey;
|
|
20
|
+
static fromProtoTaPubkey(proto?: TaPubkey): Pubkey;
|
|
21
|
+
private static bytesFromString;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type SignatureInput = Uint8Array | string | Signature;
|
|
25
|
+
declare class Signature {
|
|
26
|
+
private readonly bytes;
|
|
27
|
+
private constructor();
|
|
28
|
+
static from(value: SignatureInput): Signature;
|
|
29
|
+
static fromProto(proto?: Signature$1): Signature;
|
|
30
|
+
static isThruFmt(value: string): boolean;
|
|
31
|
+
toBytes(): Uint8Array;
|
|
32
|
+
toBytesUnsafe(): Uint8Array;
|
|
33
|
+
toThruFmt(): string;
|
|
34
|
+
toHex(): string;
|
|
35
|
+
equals(other: SignatureInput): boolean;
|
|
36
|
+
toProtoSignature(): Signature$1;
|
|
37
|
+
toProtoTsSignature(): TsSignature;
|
|
38
|
+
static fromProtoTsSignature(proto?: TsSignature): Signature;
|
|
39
|
+
static fromProtoSignature(proto?: Signature$1): Signature;
|
|
40
|
+
private static bytesFromString;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface ResourceLimits {
|
|
44
|
+
computeUnits?: number;
|
|
45
|
+
stateUnits?: number;
|
|
46
|
+
memoryUnits?: number;
|
|
47
|
+
}
|
|
48
|
+
interface OptionalProofs {
|
|
49
|
+
feePayerStateProof?: Uint8Array;
|
|
50
|
+
feePayerAccountMetaRaw?: Uint8Array;
|
|
51
|
+
}
|
|
52
|
+
interface TransactionHeaderInput extends ResourceLimits {
|
|
53
|
+
fee: bigint;
|
|
54
|
+
nonce: bigint;
|
|
55
|
+
startSlot: bigint;
|
|
56
|
+
expiryAfter?: number;
|
|
57
|
+
chainId?: number;
|
|
58
|
+
flags?: number;
|
|
59
|
+
}
|
|
60
|
+
interface TransactionAccountsInput {
|
|
61
|
+
readWriteAccounts?: PubkeyInput[];
|
|
62
|
+
readOnlyAccounts?: PubkeyInput[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Context provided to instruction data functions.
|
|
66
|
+
* Contains all transaction accounts in their final sorted order and helper functions
|
|
67
|
+
* for looking up account indexes.
|
|
68
|
+
*/
|
|
69
|
+
interface InstructionContext {
|
|
70
|
+
/** All accounts in final transaction order: [feePayer, program, ...readWrite, ...readOnly] */
|
|
71
|
+
accounts: Pubkey[];
|
|
72
|
+
/** Get the index of an account by its public key. Throws if account is not found in transaction. */
|
|
73
|
+
getAccountIndex: (pubkey: PubkeyInput) => number;
|
|
74
|
+
}
|
|
75
|
+
interface FeePayerInput {
|
|
76
|
+
publicKey: PubkeyInput;
|
|
77
|
+
privateKey?: Uint8Array;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Function that builds instruction data with access to the final account ordering.
|
|
81
|
+
* Use this when your instruction data contains account indices.
|
|
82
|
+
*/
|
|
83
|
+
type InstructionDataBuilder = (context: InstructionContext) => Uint8Array | string;
|
|
84
|
+
interface BuildTransactionParams {
|
|
85
|
+
feePayer: FeePayerInput;
|
|
86
|
+
program: PubkeyInput;
|
|
87
|
+
header: TransactionHeaderInput;
|
|
88
|
+
accounts?: TransactionAccountsInput;
|
|
89
|
+
/**
|
|
90
|
+
* Static instruction data. Use this when your instruction data does not
|
|
91
|
+
* contain account indices, or when you've pre-computed the indices.
|
|
92
|
+
*/
|
|
93
|
+
instructionData?: Uint8Array | string;
|
|
94
|
+
/**
|
|
95
|
+
* Builder function that receives the final account ordering.
|
|
96
|
+
* Use this when your instruction data contains account indices to ensure
|
|
97
|
+
* they match the post-sort transaction layout.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* buildInstructionData: ({ getAccountIndex }) => {
|
|
102
|
+
* return buildMyInstruction(
|
|
103
|
+
* getAccountIndex(configAddress),
|
|
104
|
+
* getAccountIndex(trancheAddress),
|
|
105
|
+
* );
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
buildInstructionData?: InstructionDataBuilder;
|
|
110
|
+
proofs?: OptionalProofs;
|
|
111
|
+
}
|
|
112
|
+
interface BuiltTransactionResult {
|
|
113
|
+
transaction: TransactionLike;
|
|
114
|
+
}
|
|
115
|
+
interface SignedTransactionResult extends BuiltTransactionResult {
|
|
116
|
+
signature: Signature;
|
|
117
|
+
rawTransaction: Uint8Array;
|
|
118
|
+
}
|
|
119
|
+
interface TransactionLike {
|
|
120
|
+
toWire(): Uint8Array;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface TransactionExecutionEvent {
|
|
124
|
+
eventId: string;
|
|
125
|
+
callIdx: number;
|
|
126
|
+
programIdx: number;
|
|
127
|
+
program?: Pubkey;
|
|
128
|
+
payload: Uint8Array;
|
|
129
|
+
}
|
|
130
|
+
interface TransactionExecutionResultData {
|
|
131
|
+
consumedComputeUnits: number;
|
|
132
|
+
consumedMemoryUnits: number;
|
|
133
|
+
consumedStateUnits: number;
|
|
134
|
+
userErrorCode: bigint;
|
|
135
|
+
vmError: TransactionVmError;
|
|
136
|
+
executionResult: bigint;
|
|
137
|
+
pagesUsed: number;
|
|
138
|
+
eventsCount: number;
|
|
139
|
+
eventsSize: number;
|
|
140
|
+
readwriteAccounts: Pubkey[];
|
|
141
|
+
readonlyAccounts: Pubkey[];
|
|
142
|
+
events?: TransactionExecutionEvent[];
|
|
143
|
+
}
|
|
144
|
+
declare class Transaction {
|
|
145
|
+
readonly version: number;
|
|
146
|
+
readonly feePayer: Pubkey;
|
|
147
|
+
readonly program: Pubkey;
|
|
148
|
+
readonly fee: bigint;
|
|
149
|
+
readonly nonce: bigint;
|
|
150
|
+
readonly startSlot: bigint;
|
|
151
|
+
readonly expiryAfter: number;
|
|
152
|
+
readonly chainId: number;
|
|
153
|
+
readonly requestedComputeUnits: number;
|
|
154
|
+
readonly requestedStateUnits: number;
|
|
155
|
+
readonly requestedMemoryUnits: number;
|
|
156
|
+
readonly flags: number;
|
|
157
|
+
readonly readWriteAccounts: Pubkey[];
|
|
158
|
+
readonly readOnlyAccounts: Pubkey[];
|
|
159
|
+
readonly instructionData?: Uint8Array;
|
|
160
|
+
readonly instructionDataSize?: number;
|
|
161
|
+
readonly feePayerStateProof?: Uint8Array;
|
|
162
|
+
readonly feePayerAccountMetaRaw?: Uint8Array;
|
|
163
|
+
executionResult?: TransactionExecutionResultData;
|
|
164
|
+
slot?: bigint;
|
|
165
|
+
blockOffset?: number;
|
|
166
|
+
private signature?;
|
|
167
|
+
constructor(params: {
|
|
168
|
+
version?: number;
|
|
169
|
+
feePayer: PubkeyInput;
|
|
170
|
+
program: PubkeyInput;
|
|
171
|
+
header: TransactionHeaderInput;
|
|
172
|
+
accounts?: TransactionAccountsInput;
|
|
173
|
+
instructionData?: Uint8Array;
|
|
174
|
+
instructionDataSize?: number;
|
|
175
|
+
proofs?: OptionalProofs;
|
|
176
|
+
});
|
|
177
|
+
static fromWire(data: Uint8Array): Transaction;
|
|
178
|
+
static parseWire(data: Uint8Array, options?: {
|
|
179
|
+
strict?: boolean;
|
|
180
|
+
}): {
|
|
181
|
+
transaction: Transaction;
|
|
182
|
+
size: number;
|
|
183
|
+
};
|
|
184
|
+
static fromProto(proto: Transaction$1): Transaction;
|
|
185
|
+
getSignature(): Signature | undefined;
|
|
186
|
+
setSignature(signature: Signature): void;
|
|
187
|
+
sign(privateKey: Uint8Array): Promise<Signature>;
|
|
188
|
+
toWireForSigning(): Uint8Array;
|
|
189
|
+
toWire(): Uint8Array;
|
|
190
|
+
private createHeader;
|
|
191
|
+
private buildWirePayload;
|
|
192
|
+
private static parseBodySections;
|
|
193
|
+
private static ensureAvailable;
|
|
194
|
+
private static parseStateProof;
|
|
195
|
+
static executionResultFromProto(proto: TransactionExecutionResult): TransactionExecutionResultData;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
type StreamTransactionUpdate = {
|
|
199
|
+
kind: "partial";
|
|
200
|
+
signature: Uint8Array;
|
|
201
|
+
slot?: bigint;
|
|
202
|
+
executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
|
|
203
|
+
} | {
|
|
204
|
+
kind: "full";
|
|
205
|
+
transaction: Transaction;
|
|
206
|
+
};
|
|
207
|
+
interface TrackTransactionUpdate {
|
|
208
|
+
signature?: Uint8Array;
|
|
209
|
+
status: string;
|
|
210
|
+
statusCode: ConsensusStatus;
|
|
211
|
+
executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
|
|
212
|
+
transaction?: Transaction;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface TransactionStatusParams {
|
|
216
|
+
signature: Uint8Array;
|
|
217
|
+
consensusStatus?: ConsensusStatus;
|
|
218
|
+
executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
|
|
219
|
+
}
|
|
220
|
+
declare class TransactionStatusSnapshot {
|
|
221
|
+
readonly signature: Uint8Array;
|
|
222
|
+
readonly statusCode?: ConsensusStatus;
|
|
223
|
+
readonly status?: string;
|
|
224
|
+
readonly executionResult?: ReturnType<typeof Transaction.executionResultFromProto>;
|
|
225
|
+
constructor(params: TransactionStatusParams);
|
|
226
|
+
static fromProto(proto: TransactionStatus): TransactionStatusSnapshot;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
type PartialTransportOptions = Partial<GrpcWebTransportOptions>;
|
|
230
|
+
interface ThruClientConfig {
|
|
231
|
+
baseUrl?: string;
|
|
232
|
+
transport?: Transport;
|
|
233
|
+
transportOptions?: PartialTransportOptions;
|
|
234
|
+
interceptors?: Interceptor[];
|
|
235
|
+
callOptions?: CallOptions;
|
|
236
|
+
}
|
|
237
|
+
type QueryClient = ReturnType<typeof createClient<typeof QueryService>>;
|
|
238
|
+
type CommandClient = ReturnType<typeof createClient<typeof CommandService>>;
|
|
239
|
+
type StreamingClient = ReturnType<typeof createClient<typeof StreamingService>>;
|
|
240
|
+
interface ThruClientContext {
|
|
241
|
+
baseUrl: string;
|
|
242
|
+
transport: Transport;
|
|
243
|
+
query: QueryClient;
|
|
244
|
+
command: CommandClient;
|
|
245
|
+
streaming: StreamingClient;
|
|
246
|
+
callOptions?: CallOptions;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface AccountFlagsData {
|
|
250
|
+
isProgram: boolean;
|
|
251
|
+
isPrivileged: boolean;
|
|
252
|
+
isUncompressable: boolean;
|
|
253
|
+
isEphemeral: boolean;
|
|
254
|
+
isDeleted: boolean;
|
|
255
|
+
isNew: boolean;
|
|
256
|
+
isCompressed: boolean;
|
|
257
|
+
}
|
|
258
|
+
declare class AccountFlags implements AccountFlagsData {
|
|
259
|
+
readonly isProgram: boolean;
|
|
260
|
+
readonly isPrivileged: boolean;
|
|
261
|
+
readonly isUncompressable: boolean;
|
|
262
|
+
readonly isEphemeral: boolean;
|
|
263
|
+
readonly isDeleted: boolean;
|
|
264
|
+
readonly isNew: boolean;
|
|
265
|
+
readonly isCompressed: boolean;
|
|
266
|
+
constructor(flags?: Partial<AccountFlagsData>);
|
|
267
|
+
static fromProto(flags?: AccountFlags$1): AccountFlags;
|
|
268
|
+
}
|
|
269
|
+
declare class AccountMeta {
|
|
270
|
+
readonly version: number;
|
|
271
|
+
readonly flags: AccountFlags;
|
|
272
|
+
readonly dataSize: number;
|
|
273
|
+
readonly seq: bigint;
|
|
274
|
+
readonly owner?: Pubkey;
|
|
275
|
+
readonly balance: bigint;
|
|
276
|
+
readonly nonce?: bigint;
|
|
277
|
+
constructor(params: {
|
|
278
|
+
version: number;
|
|
279
|
+
flags?: AccountFlags;
|
|
280
|
+
dataSize: number;
|
|
281
|
+
seq: bigint;
|
|
282
|
+
owner?: Pubkey;
|
|
283
|
+
balance: bigint;
|
|
284
|
+
nonce?: bigint;
|
|
285
|
+
});
|
|
286
|
+
static fromProto(meta?: AccountMeta$1): AccountMeta | undefined;
|
|
287
|
+
}
|
|
288
|
+
declare class AccountData {
|
|
289
|
+
readonly data?: Uint8Array;
|
|
290
|
+
readonly compressed: boolean;
|
|
291
|
+
readonly compressionAlgorithm?: string;
|
|
292
|
+
constructor(params: {
|
|
293
|
+
data?: Uint8Array;
|
|
294
|
+
compressed?: boolean;
|
|
295
|
+
compressionAlgorithm?: string;
|
|
296
|
+
});
|
|
297
|
+
static fromProto(data?: AccountData$1): AccountData | undefined;
|
|
298
|
+
}
|
|
299
|
+
interface AccountVersionContext {
|
|
300
|
+
slot?: bigint;
|
|
301
|
+
blockTimestampNs?: bigint;
|
|
302
|
+
}
|
|
303
|
+
declare class Account {
|
|
304
|
+
readonly address: Pubkey;
|
|
305
|
+
readonly meta?: AccountMeta;
|
|
306
|
+
readonly data?: AccountData;
|
|
307
|
+
readonly versionContext?: AccountVersionContext;
|
|
308
|
+
readonly consensusStatus?: ConsensusStatus;
|
|
309
|
+
constructor(params: {
|
|
310
|
+
address: Pubkey;
|
|
311
|
+
meta?: AccountMeta;
|
|
312
|
+
data?: AccountData;
|
|
313
|
+
versionContext?: AccountVersionContext;
|
|
314
|
+
consensusStatus?: ConsensusStatus;
|
|
315
|
+
});
|
|
316
|
+
static fromProto(proto: Account$1): Account;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface AccountPageChunk {
|
|
320
|
+
pageIndex: number;
|
|
321
|
+
pageSize: number;
|
|
322
|
+
data: Uint8Array;
|
|
323
|
+
compressed?: boolean;
|
|
324
|
+
compressionAlgorithm?: string;
|
|
325
|
+
}
|
|
326
|
+
interface AccountSnapshot {
|
|
327
|
+
account: Account;
|
|
328
|
+
}
|
|
329
|
+
interface AccountUpdateDelta {
|
|
330
|
+
slot: bigint;
|
|
331
|
+
meta?: AccountMeta;
|
|
332
|
+
page?: AccountPageChunk;
|
|
333
|
+
deleted?: boolean;
|
|
334
|
+
}
|
|
335
|
+
type StreamAccountUpdate = {
|
|
336
|
+
kind: "snapshot";
|
|
337
|
+
snapshot: AccountSnapshot;
|
|
338
|
+
} | {
|
|
339
|
+
kind: "update";
|
|
340
|
+
update: AccountUpdateDelta;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
type FilterParamValueCase = "stringValue" | "bytesValue" | "boolValue" | "intValue" | "doubleValue" | "uintValue" | "pubkeyValue" | "signatureValue" | "taPubkeyValue" | "tsSignatureValue";
|
|
344
|
+
declare class FilterParamValue {
|
|
345
|
+
private readonly case?;
|
|
346
|
+
private readonly value?;
|
|
347
|
+
private constructor();
|
|
348
|
+
static none(): FilterParamValue;
|
|
349
|
+
static string(value: string): FilterParamValue;
|
|
350
|
+
static bytes(value: Uint8Array): FilterParamValue;
|
|
351
|
+
static bool(value: boolean): FilterParamValue;
|
|
352
|
+
static int(value: bigint): FilterParamValue;
|
|
353
|
+
static double(value: number): FilterParamValue;
|
|
354
|
+
static uint(value: number | bigint): FilterParamValue;
|
|
355
|
+
static pubkey(value: PubkeyInput): FilterParamValue;
|
|
356
|
+
static signature(value: SignatureInput): FilterParamValue;
|
|
357
|
+
static taPubkey(value: PubkeyInput | string): FilterParamValue;
|
|
358
|
+
static tsSignature(value: SignatureInput): FilterParamValue;
|
|
359
|
+
static fromProto(proto: FilterParamValue$1): FilterParamValue;
|
|
360
|
+
toProto(): FilterParamValue$1;
|
|
361
|
+
getCase(): FilterParamValueCase | undefined;
|
|
362
|
+
getString(): string | undefined;
|
|
363
|
+
getBytes(): Uint8Array | undefined;
|
|
364
|
+
getBool(): boolean | undefined;
|
|
365
|
+
getInt(): bigint | undefined;
|
|
366
|
+
getUint(): bigint | undefined;
|
|
367
|
+
getDouble(): number | undefined;
|
|
368
|
+
getPubkey(): Uint8Array | undefined;
|
|
369
|
+
getSignature(): Uint8Array | undefined;
|
|
370
|
+
getTaPubkey(): string | undefined;
|
|
371
|
+
getTsSignature(): string | undefined;
|
|
372
|
+
}
|
|
373
|
+
interface FilterParamsInit {
|
|
374
|
+
[key: string]: FilterParamValue;
|
|
375
|
+
}
|
|
376
|
+
declare class Filter {
|
|
377
|
+
readonly expression?: string;
|
|
378
|
+
private readonly params;
|
|
379
|
+
constructor(init?: {
|
|
380
|
+
expression?: string;
|
|
381
|
+
params?: FilterParamsInit | Map<string, FilterParamValue> | Iterable<[string, FilterParamValue]>;
|
|
382
|
+
});
|
|
383
|
+
static fromProto(proto: Filter$1): Filter;
|
|
384
|
+
toProto(): Filter$1;
|
|
385
|
+
hasParam(name: string): boolean;
|
|
386
|
+
getParam(name: string): FilterParamValue | undefined;
|
|
387
|
+
listParams(): string[];
|
|
388
|
+
entries(): [string, FilterParamValue][];
|
|
389
|
+
withExpression(expression?: string): Filter;
|
|
390
|
+
withParam(name: string, value: FilterParamValue): Filter;
|
|
391
|
+
withoutParam(name: string): Filter;
|
|
392
|
+
private setParamInternal;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
interface PageRequestParams {
|
|
396
|
+
pageSize?: number;
|
|
397
|
+
pageToken?: string;
|
|
398
|
+
orderBy?: string;
|
|
399
|
+
}
|
|
400
|
+
declare class PageRequest {
|
|
401
|
+
readonly pageSize?: number;
|
|
402
|
+
readonly pageToken?: string;
|
|
403
|
+
readonly orderBy?: string;
|
|
404
|
+
constructor(params?: PageRequestParams);
|
|
405
|
+
static fromProto(proto?: PageRequest$1): PageRequest | undefined;
|
|
406
|
+
toProto(): PageRequest$1;
|
|
407
|
+
withParams(params: PageRequestParams): PageRequest;
|
|
408
|
+
}
|
|
409
|
+
interface PageResponseParams {
|
|
410
|
+
nextPageToken?: string;
|
|
411
|
+
totalSize?: bigint;
|
|
412
|
+
}
|
|
413
|
+
declare class PageResponse {
|
|
414
|
+
readonly nextPageToken?: string;
|
|
415
|
+
readonly totalSize?: bigint;
|
|
416
|
+
constructor(params?: PageResponseParams);
|
|
417
|
+
static fromProto(proto?: PageResponse$1): PageResponse | undefined;
|
|
418
|
+
toProto(): PageResponse$1;
|
|
419
|
+
hasNextPage(): boolean;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
interface CreateAccountOptions {
|
|
423
|
+
/** The new account's public key (fee payer). */
|
|
424
|
+
publicKey: PubkeyInput;
|
|
425
|
+
/** Optional overrides for the transaction header. */
|
|
426
|
+
header?: Partial<TransactionHeaderInput>;
|
|
427
|
+
}
|
|
428
|
+
interface AccountQueryOptions {
|
|
429
|
+
view?: AccountView;
|
|
430
|
+
versionContext?: VersionContext;
|
|
431
|
+
minConsensus?: ConsensusStatus;
|
|
432
|
+
dataSlice?: DataSlice;
|
|
433
|
+
}
|
|
434
|
+
interface RawAccountQueryOptions {
|
|
435
|
+
view?: AccountView;
|
|
436
|
+
versionContext?: VersionContext;
|
|
437
|
+
minConsensus?: ConsensusStatus;
|
|
438
|
+
}
|
|
439
|
+
interface ListAccountsOptions {
|
|
440
|
+
view?: AccountView;
|
|
441
|
+
versionContext?: VersionContext;
|
|
442
|
+
filter?: Filter;
|
|
443
|
+
page?: PageRequest;
|
|
444
|
+
minConsensus?: ConsensusStatus;
|
|
445
|
+
}
|
|
446
|
+
interface AccountList {
|
|
447
|
+
accounts: Account[];
|
|
448
|
+
page?: PageResponse;
|
|
449
|
+
}
|
|
450
|
+
declare function getAccount(ctx: ThruClientContext, address: PubkeyInput, options?: AccountQueryOptions): Promise<Account>;
|
|
451
|
+
declare function getRawAccount(ctx: ThruClientContext, address: PubkeyInput, options?: RawAccountQueryOptions): Promise<RawAccount>;
|
|
452
|
+
declare function listAccounts(ctx: ThruClientContext, options: ListAccountsOptions): Promise<AccountList>;
|
|
453
|
+
declare function createAccount(ctx: ThruClientContext, options: CreateAccountOptions): Promise<Transaction>;
|
|
454
|
+
|
|
455
|
+
type accounts_AccountList = AccountList;
|
|
456
|
+
type accounts_AccountQueryOptions = AccountQueryOptions;
|
|
457
|
+
type accounts_CreateAccountOptions = CreateAccountOptions;
|
|
458
|
+
type accounts_ListAccountsOptions = ListAccountsOptions;
|
|
459
|
+
type accounts_RawAccountQueryOptions = RawAccountQueryOptions;
|
|
460
|
+
declare const accounts_createAccount: typeof createAccount;
|
|
461
|
+
declare const accounts_getAccount: typeof getAccount;
|
|
462
|
+
declare const accounts_getRawAccount: typeof getRawAccount;
|
|
463
|
+
declare const accounts_listAccounts: typeof listAccounts;
|
|
464
|
+
declare namespace accounts {
|
|
465
|
+
export { type accounts_AccountList as AccountList, type accounts_AccountQueryOptions as AccountQueryOptions, type accounts_CreateAccountOptions as CreateAccountOptions, type accounts_ListAccountsOptions as ListAccountsOptions, type accounts_RawAccountQueryOptions as RawAccountQueryOptions, accounts_createAccount as createAccount, accounts_getAccount as getAccount, accounts_getRawAccount as getRawAccount, accounts_listAccounts as listAccounts };
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface BlockFooterParams {
|
|
469
|
+
signature?: Uint8Array;
|
|
470
|
+
status: ExecutionStatus;
|
|
471
|
+
consumedComputeUnits: bigint;
|
|
472
|
+
consumedStateUnits: number;
|
|
473
|
+
attestorPayment: bigint;
|
|
474
|
+
}
|
|
475
|
+
declare class BlockFooter {
|
|
476
|
+
readonly signature?: Uint8Array;
|
|
477
|
+
readonly status: ExecutionStatus;
|
|
478
|
+
readonly consumedComputeUnits: bigint;
|
|
479
|
+
readonly consumedStateUnits: number;
|
|
480
|
+
readonly attestorPayment: bigint;
|
|
481
|
+
constructor(params: BlockFooterParams);
|
|
482
|
+
static fromProto(proto: BlockFooter$1): BlockFooter;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
interface BlockHeaderParams {
|
|
486
|
+
slot: bigint;
|
|
487
|
+
version: number;
|
|
488
|
+
headerSignature?: Uint8Array;
|
|
489
|
+
producer?: Uint8Array;
|
|
490
|
+
expiryTimestamp?: Timestamp;
|
|
491
|
+
startSlot: bigint;
|
|
492
|
+
expiryAfter?: number;
|
|
493
|
+
maxBlockSize?: number;
|
|
494
|
+
maxComputeUnits?: bigint;
|
|
495
|
+
maxStateUnits?: number;
|
|
496
|
+
bondAmountLockUp?: bigint;
|
|
497
|
+
weightSlot?: bigint;
|
|
498
|
+
blockHash?: Uint8Array;
|
|
499
|
+
chainId?: number;
|
|
500
|
+
}
|
|
501
|
+
declare class BlockHeader {
|
|
502
|
+
readonly slot: bigint;
|
|
503
|
+
readonly version: number;
|
|
504
|
+
readonly headerSignature?: Uint8Array;
|
|
505
|
+
readonly producer?: Uint8Array;
|
|
506
|
+
readonly expiryTimestamp?: Timestamp;
|
|
507
|
+
readonly startSlot: bigint;
|
|
508
|
+
readonly expiryAfter?: number;
|
|
509
|
+
readonly maxBlockSize?: number;
|
|
510
|
+
readonly maxComputeUnits?: bigint;
|
|
511
|
+
readonly maxStateUnits?: number;
|
|
512
|
+
readonly bondAmountLockUp?: bigint;
|
|
513
|
+
readonly weightSlot?: bigint;
|
|
514
|
+
readonly blockHash?: Uint8Array;
|
|
515
|
+
readonly chainId?: number;
|
|
516
|
+
constructor(params: BlockHeaderParams);
|
|
517
|
+
static fromProto(proto: BlockHeader$1): BlockHeader;
|
|
518
|
+
withBlockHash(blockHash: Uint8Array): BlockHeader;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
declare class Block {
|
|
522
|
+
readonly header: BlockHeader;
|
|
523
|
+
readonly footer?: BlockFooter;
|
|
524
|
+
readonly body?: Uint8Array;
|
|
525
|
+
readonly consensusStatus?: ConsensusStatus;
|
|
526
|
+
blockTimeNs?: bigint;
|
|
527
|
+
attestorPayment?: bigint;
|
|
528
|
+
constructor(params: {
|
|
529
|
+
header: BlockHeader;
|
|
530
|
+
footer?: BlockFooter;
|
|
531
|
+
body?: Uint8Array;
|
|
532
|
+
consensusStatus?: ConsensusStatus;
|
|
533
|
+
});
|
|
534
|
+
static fromProto(proto: Block$1): Block;
|
|
535
|
+
static fromWire(data: Uint8Array): Block;
|
|
536
|
+
toWire(): Uint8Array;
|
|
537
|
+
getTransactions(): Transaction[];
|
|
538
|
+
private static extractTransactionBody;
|
|
539
|
+
private serializeHeader;
|
|
540
|
+
private serializeFooter;
|
|
541
|
+
private static parseHeader;
|
|
542
|
+
private static parseFooter;
|
|
543
|
+
private static parseTransactionsFromBody;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
type BlockSelector = {
|
|
547
|
+
slot: number | bigint;
|
|
548
|
+
} | {
|
|
549
|
+
blockHash: Uint8Array | string;
|
|
550
|
+
};
|
|
551
|
+
interface DeriveProgramAddressOptions {
|
|
552
|
+
programAddress: PubkeyInput;
|
|
553
|
+
seed: Uint8Array | string;
|
|
554
|
+
ephemeral?: boolean;
|
|
555
|
+
}
|
|
556
|
+
interface DeriveProgramAddressResult {
|
|
557
|
+
bytes: Uint8Array;
|
|
558
|
+
address: string;
|
|
559
|
+
}
|
|
560
|
+
declare function deriveProgramAddress(options: DeriveProgramAddressOptions): DeriveProgramAddressResult;
|
|
561
|
+
type DeriveAddressInput = PubkeyInput | Uint8Array;
|
|
562
|
+
interface DeriveAddressResult {
|
|
563
|
+
bytes: Uint8Array;
|
|
564
|
+
address: string;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Derive an address by hashing an array of inputs.
|
|
568
|
+
* Inputs can be pubkeys (as string, Uint8Array, or Pubkey) or raw Uint8Array data.
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* // Token account: SHA256(owner || mint || seed)
|
|
572
|
+
* deriveAddress([ownerPubkey, mintPubkey, seed])
|
|
573
|
+
*
|
|
574
|
+
* // Mint account: SHA256(creator || seed)
|
|
575
|
+
* deriveAddress([creatorPubkey, seed])
|
|
576
|
+
*/
|
|
577
|
+
declare function deriveAddress(inputs: DeriveAddressInput[]): DeriveAddressResult;
|
|
578
|
+
|
|
579
|
+
interface BlockQueryOptions {
|
|
580
|
+
view?: BlockView;
|
|
581
|
+
minConsensus?: ConsensusStatus;
|
|
582
|
+
}
|
|
583
|
+
interface RawBlockQueryOptions {
|
|
584
|
+
minConsensus?: ConsensusStatus;
|
|
585
|
+
}
|
|
586
|
+
interface ListBlocksOptions {
|
|
587
|
+
filter?: Filter;
|
|
588
|
+
page?: PageRequest;
|
|
589
|
+
view?: BlockView;
|
|
590
|
+
minConsensus?: ConsensusStatus;
|
|
591
|
+
}
|
|
592
|
+
interface BlockList {
|
|
593
|
+
blocks: Block[];
|
|
594
|
+
page?: PageResponse;
|
|
595
|
+
}
|
|
596
|
+
declare function getBlock(ctx: ThruClientContext, selector: BlockSelector, options?: BlockQueryOptions): Promise<Block>;
|
|
597
|
+
declare function getRawBlock(ctx: ThruClientContext, selector: BlockSelector, options?: RawBlockQueryOptions): Promise<RawBlock>;
|
|
598
|
+
declare function listBlocks(ctx: ThruClientContext, options?: ListBlocksOptions): Promise<BlockList>;
|
|
599
|
+
|
|
600
|
+
type blocks_BlockList = BlockList;
|
|
601
|
+
type blocks_BlockQueryOptions = BlockQueryOptions;
|
|
602
|
+
type blocks_ListBlocksOptions = ListBlocksOptions;
|
|
603
|
+
type blocks_RawBlockQueryOptions = RawBlockQueryOptions;
|
|
604
|
+
declare const blocks_getBlock: typeof getBlock;
|
|
605
|
+
declare const blocks_getRawBlock: typeof getRawBlock;
|
|
606
|
+
declare const blocks_listBlocks: typeof listBlocks;
|
|
607
|
+
declare namespace blocks {
|
|
608
|
+
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 };
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
declare function consensusStatusToString(status: ConsensusStatus): string;
|
|
612
|
+
|
|
613
|
+
type VersionContextInput = VersionContext | {
|
|
614
|
+
current: true;
|
|
615
|
+
} | {
|
|
616
|
+
currentOrHistorical: true;
|
|
617
|
+
} | {
|
|
618
|
+
slot: number | bigint;
|
|
619
|
+
} | {
|
|
620
|
+
timestamp: Date | number | Timestamp;
|
|
621
|
+
} | {
|
|
622
|
+
seq: number | bigint;
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
declare function currentVersionContext(): VersionContext;
|
|
626
|
+
declare function currentOrHistoricalVersionContext(): VersionContext;
|
|
627
|
+
declare function slotVersionContext(slot: number | bigint): VersionContext;
|
|
628
|
+
declare function timestampVersionContext(value: Date | number | Timestamp): VersionContext;
|
|
629
|
+
declare function seqVersionContext(seq: number | bigint): VersionContext;
|
|
630
|
+
declare function versionContext(input?: VersionContextInput): VersionContext;
|
|
631
|
+
|
|
632
|
+
type consensus_VersionContextInput = VersionContextInput;
|
|
633
|
+
declare const consensus_consensusStatusToString: typeof consensusStatusToString;
|
|
634
|
+
declare const consensus_currentOrHistoricalVersionContext: typeof currentOrHistoricalVersionContext;
|
|
635
|
+
declare const consensus_currentVersionContext: typeof currentVersionContext;
|
|
636
|
+
declare const consensus_seqVersionContext: typeof seqVersionContext;
|
|
637
|
+
declare const consensus_slotVersionContext: typeof slotVersionContext;
|
|
638
|
+
declare const consensus_timestampVersionContext: typeof timestampVersionContext;
|
|
639
|
+
declare const consensus_versionContext: typeof versionContext;
|
|
640
|
+
declare namespace consensus {
|
|
641
|
+
export { type consensus_VersionContextInput as VersionContextInput, consensus_consensusStatusToString as consensusStatusToString, consensus_currentOrHistoricalVersionContext as currentOrHistoricalVersionContext, consensus_currentVersionContext as currentVersionContext, consensus_seqVersionContext as seqVersionContext, consensus_slotVersionContext as slotVersionContext, consensus_timestampVersionContext as timestampVersionContext, consensus_versionContext as versionContext };
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
interface ChainEventParams {
|
|
645
|
+
id: string;
|
|
646
|
+
transactionSignature?: Uint8Array;
|
|
647
|
+
program?: Uint8Array;
|
|
648
|
+
payload?: Uint8Array;
|
|
649
|
+
slot?: bigint;
|
|
650
|
+
callIndex?: number;
|
|
651
|
+
programIndex?: number;
|
|
652
|
+
payloadSize?: number;
|
|
653
|
+
timestampNs?: bigint;
|
|
654
|
+
}
|
|
655
|
+
declare class ChainEvent {
|
|
656
|
+
readonly id: string;
|
|
657
|
+
readonly transactionSignature?: Uint8Array;
|
|
658
|
+
readonly program?: Uint8Array;
|
|
659
|
+
readonly payload?: Uint8Array;
|
|
660
|
+
readonly slot?: bigint;
|
|
661
|
+
readonly callIndex?: number;
|
|
662
|
+
readonly programIndex?: number;
|
|
663
|
+
readonly payloadSize?: number;
|
|
664
|
+
readonly timestampNs?: bigint;
|
|
665
|
+
constructor(params: ChainEventParams);
|
|
666
|
+
static fromQuery(proto: Event): ChainEvent;
|
|
667
|
+
static fromStream(proto: StreamEventsResponse): ChainEvent;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
interface GetEventOptions {
|
|
671
|
+
versionContext?: VersionContext;
|
|
672
|
+
}
|
|
673
|
+
interface ListEventsOptions {
|
|
674
|
+
filter?: Filter;
|
|
675
|
+
page?: PageRequest;
|
|
676
|
+
versionContext?: VersionContext;
|
|
677
|
+
minConsensus?: ConsensusStatus;
|
|
678
|
+
}
|
|
679
|
+
interface EventList {
|
|
680
|
+
events: ChainEvent[];
|
|
681
|
+
page?: PageResponse;
|
|
682
|
+
}
|
|
683
|
+
declare function getEvent(ctx: ThruClientContext, eventId: string, options?: GetEventOptions): Promise<ChainEvent>;
|
|
684
|
+
declare function listEvents(ctx: ThruClientContext, options?: ListEventsOptions): Promise<EventList>;
|
|
685
|
+
|
|
686
|
+
type events_EventList = EventList;
|
|
687
|
+
type events_GetEventOptions = GetEventOptions;
|
|
688
|
+
type events_ListEventsOptions = ListEventsOptions;
|
|
689
|
+
declare const events_getEvent: typeof getEvent;
|
|
690
|
+
declare const events_listEvents: typeof listEvents;
|
|
691
|
+
declare namespace events {
|
|
692
|
+
export { type events_EventList as EventList, type events_GetEventOptions as GetEventOptions, type events_ListEventsOptions as ListEventsOptions, events_getEvent as getEvent, events_listEvents as listEvents };
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
interface HeightSnapshotParams {
|
|
696
|
+
finalized: bigint;
|
|
697
|
+
locallyExecuted: bigint;
|
|
698
|
+
clusterExecuted: bigint;
|
|
699
|
+
}
|
|
700
|
+
declare class HeightSnapshot {
|
|
701
|
+
readonly finalized: bigint;
|
|
702
|
+
readonly locallyExecuted: bigint;
|
|
703
|
+
readonly clusterExecuted: bigint;
|
|
704
|
+
constructor(params: HeightSnapshotParams);
|
|
705
|
+
static fromProto(proto: {
|
|
706
|
+
finalized: bigint;
|
|
707
|
+
locallyExecuted: bigint;
|
|
708
|
+
clusterExecuted: bigint;
|
|
709
|
+
}): HeightSnapshot;
|
|
710
|
+
delta(other: HeightSnapshot): {
|
|
711
|
+
finalized: bigint;
|
|
712
|
+
locallyExecuted: bigint;
|
|
713
|
+
clusterExecuted: bigint;
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
declare function getBlockHeight(ctx: ThruClientContext): Promise<HeightSnapshot>;
|
|
718
|
+
|
|
719
|
+
declare const height_getBlockHeight: typeof getBlockHeight;
|
|
720
|
+
declare namespace height {
|
|
721
|
+
export { height_getBlockHeight as getBlockHeight };
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
interface GeneratedKeyPair {
|
|
725
|
+
address: string;
|
|
726
|
+
publicKey: Uint8Array;
|
|
727
|
+
privateKey: Uint8Array;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Generates a new Ed25519 keypair using the same HD wallet pipeline as the Thru wallet.
|
|
731
|
+
*/
|
|
732
|
+
declare function generateKeyPair(): Promise<GeneratedKeyPair>;
|
|
733
|
+
declare function fromPrivateKey(privateKey: Uint8Array): Promise<Uint8Array>;
|
|
734
|
+
|
|
735
|
+
type keys_GeneratedKeyPair = GeneratedKeyPair;
|
|
736
|
+
declare const keys_fromPrivateKey: typeof fromPrivateKey;
|
|
737
|
+
declare const keys_generateKeyPair: typeof generateKeyPair;
|
|
738
|
+
declare namespace keys {
|
|
739
|
+
export { type keys_GeneratedKeyPair as GeneratedKeyPair, keys_fromPrivateKey as fromPrivateKey, keys_generateKeyPair as generateKeyPair };
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
declare class StateProof {
|
|
743
|
+
readonly proof: Uint8Array;
|
|
744
|
+
readonly slot: bigint;
|
|
745
|
+
constructor(params: {
|
|
746
|
+
proof: Uint8Array;
|
|
747
|
+
slot: bigint;
|
|
748
|
+
});
|
|
749
|
+
static fromProto(proto: StateProof$1): StateProof;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
type GenerateStateProofOptions = {
|
|
753
|
+
address?: PubkeyInput;
|
|
754
|
+
proofType: StateProofType;
|
|
755
|
+
targetSlot?: bigint;
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
declare function generateStateProof(ctx: ThruClientContext, options: GenerateStateProofOptions): Promise<StateProof>;
|
|
759
|
+
|
|
760
|
+
declare const proofs_generateStateProof: typeof generateStateProof;
|
|
761
|
+
declare namespace proofs {
|
|
762
|
+
export { proofs_generateStateProof as generateStateProof };
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
interface TrackTransactionOptions {
|
|
766
|
+
timeoutMs?: number;
|
|
767
|
+
signal?: AbortSignal;
|
|
768
|
+
}
|
|
769
|
+
interface StreamBlocksOptions {
|
|
770
|
+
startSlot?: bigint;
|
|
771
|
+
filter?: Filter;
|
|
772
|
+
view?: BlockView;
|
|
773
|
+
minConsensus?: ConsensusStatus;
|
|
774
|
+
signal?: AbortSignal;
|
|
775
|
+
}
|
|
776
|
+
interface StreamBlocksResult {
|
|
777
|
+
block: Block;
|
|
778
|
+
}
|
|
779
|
+
declare function streamBlocks(ctx: ThruClientContext, options?: StreamBlocksOptions): AsyncIterable<StreamBlocksResult>;
|
|
780
|
+
interface StreamAccountUpdatesOptions {
|
|
781
|
+
view?: AccountView;
|
|
782
|
+
filter?: Filter;
|
|
783
|
+
signal?: AbortSignal;
|
|
784
|
+
}
|
|
785
|
+
interface StreamAccountUpdatesResult {
|
|
786
|
+
update: StreamAccountUpdate;
|
|
787
|
+
}
|
|
788
|
+
declare function streamAccountUpdates(ctx: ThruClientContext, address: PubkeyInput, options?: StreamAccountUpdatesOptions): AsyncIterable<StreamAccountUpdatesResult>;
|
|
789
|
+
interface StreamTransactionsOptions {
|
|
790
|
+
filter?: Filter;
|
|
791
|
+
minConsensus?: ConsensusStatus;
|
|
792
|
+
signal?: AbortSignal;
|
|
793
|
+
}
|
|
794
|
+
type StreamTransactionsResult = StreamTransactionUpdate;
|
|
795
|
+
declare function streamTransactions(ctx: ThruClientContext, options?: StreamTransactionsOptions): AsyncIterable<StreamTransactionsResult>;
|
|
796
|
+
interface StreamEventsOptions {
|
|
797
|
+
filter?: Filter;
|
|
798
|
+
signal?: AbortSignal;
|
|
799
|
+
}
|
|
800
|
+
interface StreamEventsResult {
|
|
801
|
+
event: ChainEvent;
|
|
802
|
+
}
|
|
803
|
+
declare function streamEvents(ctx: ThruClientContext, options?: StreamEventsOptions): AsyncIterable<StreamEventsResult>;
|
|
804
|
+
declare function trackTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TrackTransactionOptions): AsyncIterable<TrackTransactionUpdate>;
|
|
805
|
+
interface StreamHeightOptions {
|
|
806
|
+
signal?: AbortSignal;
|
|
807
|
+
}
|
|
808
|
+
interface StreamHeightResult {
|
|
809
|
+
height: HeightSnapshot;
|
|
810
|
+
}
|
|
811
|
+
declare function streamHeight(ctx: ThruClientContext, options?: StreamHeightOptions): AsyncIterable<StreamHeightResult>;
|
|
812
|
+
interface CollectStreamOptions {
|
|
813
|
+
limit?: number;
|
|
814
|
+
signal?: AbortSignal;
|
|
815
|
+
}
|
|
816
|
+
declare function collectStream<T>(iterable: AsyncIterable<T>, options?: CollectStreamOptions): Promise<T[]>;
|
|
817
|
+
declare function firstStreamValue<T>(iterable: AsyncIterable<T>, options?: {
|
|
818
|
+
signal?: AbortSignal;
|
|
819
|
+
}): Promise<T | undefined>;
|
|
820
|
+
declare function forEachStreamValue<T>(iterable: AsyncIterable<T>, handler: (value: T, index: number) => void | Promise<void>, options?: {
|
|
821
|
+
signal?: AbortSignal;
|
|
822
|
+
}): Promise<void>;
|
|
823
|
+
|
|
824
|
+
type streaming_CollectStreamOptions = CollectStreamOptions;
|
|
825
|
+
type streaming_StreamAccountUpdatesOptions = StreamAccountUpdatesOptions;
|
|
826
|
+
type streaming_StreamAccountUpdatesResult = StreamAccountUpdatesResult;
|
|
827
|
+
type streaming_StreamBlocksOptions = StreamBlocksOptions;
|
|
828
|
+
type streaming_StreamBlocksResult = StreamBlocksResult;
|
|
829
|
+
type streaming_StreamEventsOptions = StreamEventsOptions;
|
|
830
|
+
type streaming_StreamEventsResult = StreamEventsResult;
|
|
831
|
+
type streaming_StreamHeightOptions = StreamHeightOptions;
|
|
832
|
+
type streaming_StreamHeightResult = StreamHeightResult;
|
|
833
|
+
type streaming_StreamTransactionUpdate = StreamTransactionUpdate;
|
|
834
|
+
type streaming_StreamTransactionsOptions = StreamTransactionsOptions;
|
|
835
|
+
type streaming_StreamTransactionsResult = StreamTransactionsResult;
|
|
836
|
+
type streaming_TrackTransactionOptions = TrackTransactionOptions;
|
|
837
|
+
type streaming_TrackTransactionUpdate = TrackTransactionUpdate;
|
|
838
|
+
declare const streaming_collectStream: typeof collectStream;
|
|
839
|
+
declare const streaming_firstStreamValue: typeof firstStreamValue;
|
|
840
|
+
declare const streaming_forEachStreamValue: typeof forEachStreamValue;
|
|
841
|
+
declare const streaming_streamAccountUpdates: typeof streamAccountUpdates;
|
|
842
|
+
declare const streaming_streamBlocks: typeof streamBlocks;
|
|
843
|
+
declare const streaming_streamEvents: typeof streamEvents;
|
|
844
|
+
declare const streaming_streamHeight: typeof streamHeight;
|
|
845
|
+
declare const streaming_streamTransactions: typeof streamTransactions;
|
|
846
|
+
declare const streaming_trackTransaction: typeof trackTransaction;
|
|
847
|
+
declare namespace streaming {
|
|
848
|
+
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 };
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
interface TransactionFeePayerConfig {
|
|
852
|
+
publicKey: PubkeyInput;
|
|
853
|
+
privateKey?: Uint8Array;
|
|
854
|
+
}
|
|
855
|
+
interface TransactionAccountsConfig {
|
|
856
|
+
readWrite?: PubkeyInput[];
|
|
857
|
+
readOnly?: PubkeyInput[];
|
|
858
|
+
}
|
|
859
|
+
interface TransactionHeaderConfig {
|
|
860
|
+
fee?: bigint;
|
|
861
|
+
nonce?: bigint;
|
|
862
|
+
startSlot?: bigint;
|
|
863
|
+
expiryAfter?: number;
|
|
864
|
+
chainId?: number;
|
|
865
|
+
computeUnits?: number;
|
|
866
|
+
stateUnits?: number;
|
|
867
|
+
memoryUnits?: number;
|
|
868
|
+
flags?: number;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Instruction data can be either:
|
|
872
|
+
* - A Uint8Array directly
|
|
873
|
+
* - A function that takes an InstructionContext and returns a Uint8Array
|
|
874
|
+
*/
|
|
875
|
+
type InstructionData = Uint8Array | string | ((context: InstructionContext) => Promise<Uint8Array>);
|
|
876
|
+
interface BuildTransactionOptions {
|
|
877
|
+
feePayer: TransactionFeePayerConfig;
|
|
878
|
+
program: PubkeyInput;
|
|
879
|
+
header?: TransactionHeaderConfig;
|
|
880
|
+
accounts?: TransactionAccountsConfig;
|
|
881
|
+
instructionData?: InstructionData;
|
|
882
|
+
feePayerStateProof?: Uint8Array;
|
|
883
|
+
feePayerAccountMetaRaw?: Uint8Array;
|
|
884
|
+
}
|
|
885
|
+
interface BuildAndSignTransactionOptions extends BuildTransactionOptions {
|
|
886
|
+
feePayer: TransactionFeePayerConfig & {
|
|
887
|
+
privateKey: Uint8Array;
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
interface TransactionQueryOptions {
|
|
891
|
+
view?: TransactionView;
|
|
892
|
+
versionContext?: VersionContext;
|
|
893
|
+
minConsensus?: ConsensusStatus;
|
|
894
|
+
}
|
|
895
|
+
interface RawTransactionQueryOptions {
|
|
896
|
+
versionContext?: VersionContext;
|
|
897
|
+
minConsensus?: ConsensusStatus;
|
|
898
|
+
}
|
|
899
|
+
interface ListTransactionsForAccountOptions {
|
|
900
|
+
filter?: Filter;
|
|
901
|
+
page?: PageRequest;
|
|
902
|
+
transactionOptions?: TransactionQueryOptions;
|
|
903
|
+
}
|
|
904
|
+
interface TransactionList {
|
|
905
|
+
transactions: Transaction[];
|
|
906
|
+
page?: PageResponse;
|
|
907
|
+
}
|
|
908
|
+
interface ListTransactionsOptions {
|
|
909
|
+
filter?: Filter;
|
|
910
|
+
page?: PageRequest;
|
|
911
|
+
returnEvents?: boolean;
|
|
912
|
+
versionContext?: VersionContext;
|
|
913
|
+
minConsensus?: ConsensusStatus;
|
|
914
|
+
}
|
|
915
|
+
declare function getTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TransactionQueryOptions): Promise<Transaction>;
|
|
916
|
+
declare function getRawTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: RawTransactionQueryOptions): Promise<RawTransaction>;
|
|
917
|
+
declare function getTransactionStatus(ctx: ThruClientContext, signature: SignatureInput): Promise<TransactionStatusSnapshot>;
|
|
918
|
+
declare function listTransactionsForAccount(ctx: ThruClientContext, account: PubkeyInput, options?: ListTransactionsForAccountOptions): Promise<TransactionList>;
|
|
919
|
+
declare function listTransactions(ctx: ThruClientContext, options?: ListTransactionsOptions): Promise<TransactionList>;
|
|
920
|
+
declare function buildTransaction(ctx: ThruClientContext, options: BuildTransactionOptions): Promise<Transaction>;
|
|
921
|
+
declare function buildAndSignTransaction(ctx: ThruClientContext, options: BuildAndSignTransactionOptions): Promise<SignedTransactionResult>;
|
|
922
|
+
declare function sendTransaction(ctx: ThruClientContext, transaction: Transaction | Uint8Array): Promise<string>;
|
|
923
|
+
interface BatchSendTransactionsOptions {
|
|
924
|
+
numRetries?: number;
|
|
925
|
+
}
|
|
926
|
+
declare function batchSendTransactions(ctx: ThruClientContext, transactions: (Transaction | Uint8Array)[], options?: BatchSendTransactionsOptions): Promise<BatchSendTransactionsResponse>;
|
|
927
|
+
|
|
928
|
+
type transactions_BatchSendTransactionsOptions = BatchSendTransactionsOptions;
|
|
929
|
+
type transactions_BuildAndSignTransactionOptions = BuildAndSignTransactionOptions;
|
|
930
|
+
type transactions_BuildTransactionOptions = BuildTransactionOptions;
|
|
931
|
+
type transactions_InstructionData = InstructionData;
|
|
932
|
+
type transactions_ListTransactionsForAccountOptions = ListTransactionsForAccountOptions;
|
|
933
|
+
type transactions_ListTransactionsOptions = ListTransactionsOptions;
|
|
934
|
+
type transactions_RawTransactionQueryOptions = RawTransactionQueryOptions;
|
|
935
|
+
type transactions_TransactionAccountsConfig = TransactionAccountsConfig;
|
|
936
|
+
type transactions_TransactionFeePayerConfig = TransactionFeePayerConfig;
|
|
937
|
+
type transactions_TransactionHeaderConfig = TransactionHeaderConfig;
|
|
938
|
+
type transactions_TransactionList = TransactionList;
|
|
939
|
+
type transactions_TransactionQueryOptions = TransactionQueryOptions;
|
|
940
|
+
declare const transactions_batchSendTransactions: typeof batchSendTransactions;
|
|
941
|
+
declare const transactions_buildAndSignTransaction: typeof buildAndSignTransaction;
|
|
942
|
+
declare const transactions_buildTransaction: typeof buildTransaction;
|
|
943
|
+
declare const transactions_getRawTransaction: typeof getRawTransaction;
|
|
944
|
+
declare const transactions_getTransaction: typeof getTransaction;
|
|
945
|
+
declare const transactions_getTransactionStatus: typeof getTransactionStatus;
|
|
946
|
+
declare const transactions_listTransactions: typeof listTransactions;
|
|
947
|
+
declare const transactions_listTransactionsForAccount: typeof listTransactionsForAccount;
|
|
948
|
+
declare const transactions_sendTransaction: typeof sendTransaction;
|
|
949
|
+
declare namespace transactions {
|
|
950
|
+
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 };
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
declare class VersionInfo {
|
|
954
|
+
readonly components: Record<string, string>;
|
|
955
|
+
constructor(components: Record<string, string>);
|
|
956
|
+
static fromProto(proto: GetVersionResponse): VersionInfo;
|
|
957
|
+
get(component: string): string | undefined;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
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 };
|