@thru/thru-sdk 0.1.29 → 0.1.30
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/README.md +27 -0
- package/dist/{VersionInfo-BLq6Evyp.d.ts → VersionInfo-CNh_p-_y.d.ts} +110 -88
- package/dist/{chunk-QJACP7VX.js → chunk-NXEQLBXB.js} +368 -373
- package/dist/chunk-NXEQLBXB.js.map +1 -0
- package/dist/client.d.ts +3 -13
- package/dist/client.js +3 -13
- package/dist/client.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/sdk.d.ts +23 -4
- package/dist/sdk.js +18 -18
- package/dist/sdk.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-QJACP7VX.js.map +0 -1
package/README.md
CHANGED
|
@@ -110,6 +110,33 @@ All classes are exported from the root package for easy access:
|
|
|
110
110
|
import { Block, Account, ChainEvent } from "@thru/thru-sdk";
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
### Primitives
|
|
114
|
+
|
|
115
|
+
`Pubkey` and `Signature` wrap the 32-byte Ed25519 public key and 64-byte signature primitives, respectively. They centralize validation, conversion, and proto interop so you can work with either Thru-formatted strings (`ta...` / `ts...`), hex, or raw bytes without sprinkling helpers throughout your app.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { Pubkey, Signature } from "@thru/thru-sdk";
|
|
119
|
+
|
|
120
|
+
const payer = Pubkey.from("taDs2..."); // accepts ta string, hex, or Uint8Array
|
|
121
|
+
const sig = Signature.from("ts8Lk..."); // accepts ts string, hex, or Uint8Array
|
|
122
|
+
|
|
123
|
+
payer.toBytes(); // defensive copy
|
|
124
|
+
payer.toThruFmt(); // "ta..." string
|
|
125
|
+
payer.toProtoPubkey(); // thru.common.v1.Pubkey
|
|
126
|
+
payer.toProtoTaPubkey(); // thru.common.v1.TaPubkey
|
|
127
|
+
|
|
128
|
+
sig.toBytes();
|
|
129
|
+
sig.toThruFmt(); // "ts..." string
|
|
130
|
+
sig.toProtoSignature(); // thru.common.v1.Signature
|
|
131
|
+
sig.toProtoTsSignature(); // thru.common.v1.TsSignature
|
|
132
|
+
|
|
133
|
+
// Helper namespace now returns these domain objects:
|
|
134
|
+
const parsed = sdk.helpers.createPubkey("taFeePayerAddress...");
|
|
135
|
+
const signature = sdk.helpers.createSignature(sigBytes);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The bound client accepts either raw bytes or the new primitives; call `.toBytes()` on `Pubkey`/`Signature` when you need to interop with legacy code.
|
|
139
|
+
|
|
113
140
|
## View Options
|
|
114
141
|
|
|
115
142
|
When fetching resources, you can control which parts of the resource are returned using view options. This allows you to optimize network usage by only fetching the data you need.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BytesLike, Pubkey as Pubkey$1 } from '@thru/helpers';
|
|
2
1
|
import { Timestamp } from '@bufbuild/protobuf/wkt';
|
|
3
2
|
import { Message } from '@bufbuild/protobuf';
|
|
4
3
|
import { Transport, createClient, CallOptions, Interceptor } from '@connectrpc/connect';
|
|
@@ -129,7 +128,7 @@ declare enum ConsensusStatus {
|
|
|
129
128
|
*
|
|
130
129
|
* @generated from message thru.common.v1.Pubkey
|
|
131
130
|
*/
|
|
132
|
-
type Pubkey = Message<"thru.common.v1.Pubkey"> & {
|
|
131
|
+
type Pubkey$1 = Message<"thru.common.v1.Pubkey"> & {
|
|
133
132
|
/**
|
|
134
133
|
* 32-byte public key buffer.
|
|
135
134
|
*
|
|
@@ -142,7 +141,7 @@ type Pubkey = Message<"thru.common.v1.Pubkey"> & {
|
|
|
142
141
|
*
|
|
143
142
|
* @generated from message thru.common.v1.Signature
|
|
144
143
|
*/
|
|
145
|
-
type Signature = Message<"thru.common.v1.Signature"> & {
|
|
144
|
+
type Signature$1 = Message<"thru.common.v1.Signature"> & {
|
|
146
145
|
/**
|
|
147
146
|
* 64-byte signature buffer.
|
|
148
147
|
*
|
|
@@ -186,7 +185,7 @@ type TransactionHeader = Message<"thru.core.v1.TransactionHeader"> & {
|
|
|
186
185
|
/**
|
|
187
186
|
* @generated from field: thru.common.v1.Signature fee_payer_signature = 1;
|
|
188
187
|
*/
|
|
189
|
-
feePayerSignature?: Signature;
|
|
188
|
+
feePayerSignature?: Signature$1;
|
|
190
189
|
/**
|
|
191
190
|
* @generated from field: uint32 version = 2;
|
|
192
191
|
*/
|
|
@@ -238,11 +237,11 @@ type TransactionHeader = Message<"thru.core.v1.TransactionHeader"> & {
|
|
|
238
237
|
/**
|
|
239
238
|
* @generated from field: thru.common.v1.Pubkey fee_payer_pubkey = 14;
|
|
240
239
|
*/
|
|
241
|
-
feePayerPubkey?: Pubkey;
|
|
240
|
+
feePayerPubkey?: Pubkey$1;
|
|
242
241
|
/**
|
|
243
242
|
* @generated from field: thru.common.v1.Pubkey program_pubkey = 15;
|
|
244
243
|
*/
|
|
245
|
-
programPubkey?: Pubkey;
|
|
244
|
+
programPubkey?: Pubkey$1;
|
|
246
245
|
};
|
|
247
246
|
/**
|
|
248
247
|
* TransactionExecutionResult captures execution outcomes.
|
|
@@ -289,11 +288,11 @@ type TransactionExecutionResult = Message<"thru.core.v1.TransactionExecutionResu
|
|
|
289
288
|
/**
|
|
290
289
|
* @generated from field: repeated thru.common.v1.Pubkey readwrite_accounts = 10;
|
|
291
290
|
*/
|
|
292
|
-
readwriteAccounts: Pubkey[];
|
|
291
|
+
readwriteAccounts: Pubkey$1[];
|
|
293
292
|
/**
|
|
294
293
|
* @generated from field: repeated thru.common.v1.Pubkey readonly_accounts = 11;
|
|
295
294
|
*/
|
|
296
|
-
readonlyAccounts: Pubkey[];
|
|
295
|
+
readonlyAccounts: Pubkey$1[];
|
|
297
296
|
/**
|
|
298
297
|
* @generated from field: repeated thru.core.v1.TransactionEvent events = 12;
|
|
299
298
|
*/
|
|
@@ -320,7 +319,7 @@ type TransactionEvent = Message<"thru.core.v1.TransactionEvent"> & {
|
|
|
320
319
|
/**
|
|
321
320
|
* @generated from field: thru.common.v1.Pubkey program = 4;
|
|
322
321
|
*/
|
|
323
|
-
program?: Pubkey;
|
|
322
|
+
program?: Pubkey$1;
|
|
324
323
|
/**
|
|
325
324
|
* @generated from field: bytes payload = 5;
|
|
326
325
|
*/
|
|
@@ -335,7 +334,7 @@ type Transaction$1 = Message<"thru.core.v1.Transaction"> & {
|
|
|
335
334
|
/**
|
|
336
335
|
* @generated from field: thru.common.v1.Signature signature = 1;
|
|
337
336
|
*/
|
|
338
|
-
signature?: Signature;
|
|
337
|
+
signature?: Signature$1;
|
|
339
338
|
/**
|
|
340
339
|
* @generated from field: thru.core.v1.TransactionHeader header = 2;
|
|
341
340
|
*/
|
|
@@ -366,7 +365,7 @@ type RawTransaction = Message<"thru.core.v1.RawTransaction"> & {
|
|
|
366
365
|
/**
|
|
367
366
|
* @generated from field: thru.common.v1.Signature signature = 1;
|
|
368
367
|
*/
|
|
369
|
-
signature?: Signature;
|
|
368
|
+
signature?: Signature$1;
|
|
370
369
|
/**
|
|
371
370
|
* @generated from field: bytes raw_transaction = 2;
|
|
372
371
|
*/
|
|
@@ -644,13 +643,13 @@ type FilterParamValue$1 = Message<"thru.common.v1.FilterParamValue"> & {
|
|
|
644
643
|
/**
|
|
645
644
|
* @generated from field: thru.common.v1.Pubkey pubkey_value = 7;
|
|
646
645
|
*/
|
|
647
|
-
value: Pubkey;
|
|
646
|
+
value: Pubkey$1;
|
|
648
647
|
case: "pubkeyValue";
|
|
649
648
|
} | {
|
|
650
649
|
/**
|
|
651
650
|
* @generated from field: thru.common.v1.Signature signature_value = 8;
|
|
652
651
|
*/
|
|
653
|
-
value: Signature;
|
|
652
|
+
value: Signature$1;
|
|
654
653
|
case: "signatureValue";
|
|
655
654
|
} | {
|
|
656
655
|
/**
|
|
@@ -737,7 +736,7 @@ type AccountMeta$1 = Message<"thru.core.v1.AccountMeta"> & {
|
|
|
737
736
|
/**
|
|
738
737
|
* @generated from field: thru.common.v1.Pubkey owner = 5;
|
|
739
738
|
*/
|
|
740
|
-
owner?: Pubkey;
|
|
739
|
+
owner?: Pubkey$1;
|
|
741
740
|
/**
|
|
742
741
|
* @generated from field: uint64 balance = 6;
|
|
743
742
|
*/
|
|
@@ -805,7 +804,7 @@ type Account$1 = Message<"thru.core.v1.Account"> & {
|
|
|
805
804
|
/**
|
|
806
805
|
* @generated from field: thru.common.v1.Pubkey address = 1;
|
|
807
806
|
*/
|
|
808
|
-
address?: Pubkey;
|
|
807
|
+
address?: Pubkey$1;
|
|
809
808
|
/**
|
|
810
809
|
* @generated from field: optional thru.core.v1.AccountMeta meta = 2;
|
|
811
810
|
*/
|
|
@@ -832,7 +831,7 @@ type RawAccount = Message<"thru.core.v1.RawAccount"> & {
|
|
|
832
831
|
/**
|
|
833
832
|
* @generated from field: thru.common.v1.Pubkey address = 1;
|
|
834
833
|
*/
|
|
835
|
-
address?: Pubkey;
|
|
834
|
+
address?: Pubkey$1;
|
|
836
835
|
/**
|
|
837
836
|
* @generated from field: bytes raw_meta = 2;
|
|
838
837
|
*/
|
|
@@ -915,7 +914,7 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
|
|
|
915
914
|
/**
|
|
916
915
|
* @generated from field: thru.common.v1.Signature header_signature = 3;
|
|
917
916
|
*/
|
|
918
|
-
headerSignature?: Signature;
|
|
917
|
+
headerSignature?: Signature$1;
|
|
919
918
|
/**
|
|
920
919
|
* @generated from field: uint32 version = 4;
|
|
921
920
|
*/
|
|
@@ -923,7 +922,7 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
|
|
|
923
922
|
/**
|
|
924
923
|
* @generated from field: thru.common.v1.Pubkey producer = 5;
|
|
925
924
|
*/
|
|
926
|
-
producer?: Pubkey;
|
|
925
|
+
producer?: Pubkey$1;
|
|
927
926
|
/**
|
|
928
927
|
* @generated from field: google.protobuf.Timestamp expiry_timestamp = 6;
|
|
929
928
|
*/
|
|
@@ -966,7 +965,7 @@ type BlockFooter$1 = Message<"thru.core.v1.BlockFooter"> & {
|
|
|
966
965
|
/**
|
|
967
966
|
* @generated from field: thru.common.v1.Signature signature = 1;
|
|
968
967
|
*/
|
|
969
|
-
signature?: Signature;
|
|
968
|
+
signature?: Signature$1;
|
|
970
969
|
/**
|
|
971
970
|
* @generated from field: thru.core.v1.ExecutionStatus status = 2;
|
|
972
971
|
*/
|
|
@@ -1090,7 +1089,7 @@ type StreamEventsResponse = Message<"thru.services.v1.StreamEventsResponse"> & {
|
|
|
1090
1089
|
/**
|
|
1091
1090
|
* @generated from field: thru.common.v1.Pubkey program = 4;
|
|
1092
1091
|
*/
|
|
1093
|
-
program?: Pubkey;
|
|
1092
|
+
program?: Pubkey$1;
|
|
1094
1093
|
/**
|
|
1095
1094
|
* @generated from field: uint32 call_idx = 5;
|
|
1096
1095
|
*/
|
|
@@ -1098,17 +1097,50 @@ type StreamEventsResponse = Message<"thru.services.v1.StreamEventsResponse"> & {
|
|
|
1098
1097
|
/**
|
|
1099
1098
|
* @generated from field: thru.common.v1.Signature signature = 6;
|
|
1100
1099
|
*/
|
|
1101
|
-
signature?: Signature;
|
|
1100
|
+
signature?: Signature$1;
|
|
1102
1101
|
/**
|
|
1103
1102
|
* @generated from field: uint64 slot = 7;
|
|
1104
1103
|
*/
|
|
1105
1104
|
slot: bigint;
|
|
1106
1105
|
};
|
|
1107
1106
|
|
|
1108
|
-
type
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1107
|
+
type PubkeyInput = Uint8Array | string | Pubkey;
|
|
1108
|
+
declare class Pubkey {
|
|
1109
|
+
private readonly bytes;
|
|
1110
|
+
private constructor();
|
|
1111
|
+
static from(value: PubkeyInput): Pubkey;
|
|
1112
|
+
static isThruFmt(value: string): boolean;
|
|
1113
|
+
toBytes(): Uint8Array;
|
|
1114
|
+
toBytesUnsafe(): Uint8Array;
|
|
1115
|
+
toThruFmt(): string;
|
|
1116
|
+
toHex(): string;
|
|
1117
|
+
equals(other: PubkeyInput): boolean;
|
|
1118
|
+
toProtoPubkey(): Pubkey$1;
|
|
1119
|
+
toProtoTaPubkey(): TaPubkey;
|
|
1120
|
+
static fromProtoPubkey(proto?: Pubkey$1): Pubkey;
|
|
1121
|
+
static fromProtoTaPubkey(proto?: TaPubkey): Pubkey;
|
|
1122
|
+
private static bytesFromString;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
type SignatureInput = Uint8Array | string | Signature;
|
|
1126
|
+
declare class Signature {
|
|
1127
|
+
private readonly bytes;
|
|
1128
|
+
private constructor();
|
|
1129
|
+
static from(value: SignatureInput): Signature;
|
|
1130
|
+
static fromProto(proto?: Signature$1): Signature;
|
|
1131
|
+
static isThruFmt(value: string): boolean;
|
|
1132
|
+
toBytes(): Uint8Array;
|
|
1133
|
+
toBytesUnsafe(): Uint8Array;
|
|
1134
|
+
toThruFmt(): string;
|
|
1135
|
+
toHex(): string;
|
|
1136
|
+
equals(other: SignatureInput): boolean;
|
|
1137
|
+
toProtoSignature(): Signature$1;
|
|
1138
|
+
toProtoTsSignature(): TsSignature;
|
|
1139
|
+
static fromProtoTsSignature(proto?: TsSignature): Signature;
|
|
1140
|
+
static fromProtoSignature(proto?: Signature$1): Signature;
|
|
1141
|
+
private static bytesFromString;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1112
1144
|
interface ResourceLimits {
|
|
1113
1145
|
computeUnits?: number;
|
|
1114
1146
|
stateUnits?: number;
|
|
@@ -1126,8 +1158,8 @@ interface TransactionHeaderInput extends ResourceLimits {
|
|
|
1126
1158
|
flags?: number;
|
|
1127
1159
|
}
|
|
1128
1160
|
interface TransactionAccountsInput {
|
|
1129
|
-
readWriteAccounts?:
|
|
1130
|
-
readOnlyAccounts?:
|
|
1161
|
+
readWriteAccounts?: PubkeyInput[];
|
|
1162
|
+
readOnlyAccounts?: PubkeyInput[];
|
|
1131
1163
|
}
|
|
1132
1164
|
/**
|
|
1133
1165
|
* Context provided to instruction data functions.
|
|
@@ -1136,27 +1168,27 @@ interface TransactionAccountsInput {
|
|
|
1136
1168
|
*/
|
|
1137
1169
|
interface InstructionContext {
|
|
1138
1170
|
/** All accounts in final transaction order: [feePayer, program, ...readWrite, ...readOnly] */
|
|
1139
|
-
accounts:
|
|
1171
|
+
accounts: Pubkey[];
|
|
1140
1172
|
/** Get the index of an account by its public key. Throws if account is not found in transaction. */
|
|
1141
|
-
getAccountIndex: (pubkey:
|
|
1173
|
+
getAccountIndex: (pubkey: PubkeyInput) => number;
|
|
1142
1174
|
}
|
|
1143
1175
|
interface FeePayerInput {
|
|
1144
|
-
publicKey:
|
|
1145
|
-
privateKey?:
|
|
1176
|
+
publicKey: PubkeyInput;
|
|
1177
|
+
privateKey?: Uint8Array;
|
|
1146
1178
|
}
|
|
1147
1179
|
interface BuildTransactionParams {
|
|
1148
1180
|
feePayer: FeePayerInput;
|
|
1149
|
-
program:
|
|
1181
|
+
program: PubkeyInput;
|
|
1150
1182
|
header: TransactionHeaderInput;
|
|
1151
1183
|
accounts?: TransactionAccountsInput;
|
|
1152
|
-
instructionData?:
|
|
1184
|
+
instructionData?: Uint8Array | string;
|
|
1153
1185
|
proofs?: OptionalProofs;
|
|
1154
1186
|
}
|
|
1155
1187
|
interface BuiltTransactionResult {
|
|
1156
1188
|
transaction: TransactionLike;
|
|
1157
1189
|
}
|
|
1158
1190
|
interface SignedTransactionResult extends BuiltTransactionResult {
|
|
1159
|
-
signature:
|
|
1191
|
+
signature: Signature;
|
|
1160
1192
|
rawTransaction: Uint8Array;
|
|
1161
1193
|
}
|
|
1162
1194
|
interface TransactionLike {
|
|
@@ -1167,7 +1199,7 @@ interface TransactionExecutionEvent {
|
|
|
1167
1199
|
eventId: string;
|
|
1168
1200
|
callIdx: number;
|
|
1169
1201
|
programIdx: number;
|
|
1170
|
-
program?:
|
|
1202
|
+
program?: Pubkey;
|
|
1171
1203
|
payload: Uint8Array;
|
|
1172
1204
|
}
|
|
1173
1205
|
interface TransactionExecutionResultData {
|
|
@@ -1180,14 +1212,14 @@ interface TransactionExecutionResultData {
|
|
|
1180
1212
|
pagesUsed: number;
|
|
1181
1213
|
eventsCount: number;
|
|
1182
1214
|
eventsSize: number;
|
|
1183
|
-
readwriteAccounts:
|
|
1184
|
-
readonlyAccounts:
|
|
1215
|
+
readwriteAccounts: Pubkey[];
|
|
1216
|
+
readonlyAccounts: Pubkey[];
|
|
1185
1217
|
events?: TransactionExecutionEvent[];
|
|
1186
1218
|
}
|
|
1187
1219
|
declare class Transaction {
|
|
1188
1220
|
readonly version: number;
|
|
1189
|
-
readonly feePayer:
|
|
1190
|
-
readonly program:
|
|
1221
|
+
readonly feePayer: Pubkey;
|
|
1222
|
+
readonly program: Pubkey;
|
|
1191
1223
|
readonly fee: bigint;
|
|
1192
1224
|
readonly nonce: bigint;
|
|
1193
1225
|
readonly startSlot: bigint;
|
|
@@ -1196,8 +1228,8 @@ declare class Transaction {
|
|
|
1196
1228
|
readonly requestedStateUnits: number;
|
|
1197
1229
|
readonly requestedMemoryUnits: number;
|
|
1198
1230
|
readonly flags: number;
|
|
1199
|
-
readonly readWriteAccounts:
|
|
1200
|
-
readonly readOnlyAccounts:
|
|
1231
|
+
readonly readWriteAccounts: Pubkey[];
|
|
1232
|
+
readonly readOnlyAccounts: Pubkey[];
|
|
1201
1233
|
readonly instructionData?: Uint8Array;
|
|
1202
1234
|
readonly instructionDataSize?: number;
|
|
1203
1235
|
readonly feePayerStateProof?: Uint8Array;
|
|
@@ -1208,8 +1240,8 @@ declare class Transaction {
|
|
|
1208
1240
|
private signature?;
|
|
1209
1241
|
constructor(params: {
|
|
1210
1242
|
version?: number;
|
|
1211
|
-
feePayer:
|
|
1212
|
-
program:
|
|
1243
|
+
feePayer: PubkeyInput;
|
|
1244
|
+
program: PubkeyInput;
|
|
1213
1245
|
header: TransactionHeaderInput;
|
|
1214
1246
|
accounts?: TransactionAccountsInput;
|
|
1215
1247
|
instructionData?: Uint8Array;
|
|
@@ -1224,9 +1256,9 @@ declare class Transaction {
|
|
|
1224
1256
|
size: number;
|
|
1225
1257
|
};
|
|
1226
1258
|
static fromProto(proto: Transaction$1): Transaction;
|
|
1227
|
-
getSignature():
|
|
1228
|
-
setSignature(signature:
|
|
1229
|
-
sign(privateKey: Uint8Array): Promise<
|
|
1259
|
+
getSignature(): Signature | undefined;
|
|
1260
|
+
setSignature(signature: Signature): void;
|
|
1261
|
+
sign(privateKey: Uint8Array): Promise<Signature>;
|
|
1230
1262
|
toWireForSigning(): Uint8Array;
|
|
1231
1263
|
toWire(): Uint8Array;
|
|
1232
1264
|
private createHeader;
|
|
@@ -1235,7 +1267,6 @@ declare class Transaction {
|
|
|
1235
1267
|
private static ensureAvailable;
|
|
1236
1268
|
private static parseStateProof;
|
|
1237
1269
|
static executionResultFromProto(proto: TransactionExecutionResult): TransactionExecutionResultData;
|
|
1238
|
-
private static convertExecutionResultToProto;
|
|
1239
1270
|
}
|
|
1240
1271
|
|
|
1241
1272
|
type StreamTransactionUpdate = {
|
|
@@ -1365,11 +1396,11 @@ type Event = Message<"thru.services.v1.Event"> & {
|
|
|
1365
1396
|
/**
|
|
1366
1397
|
* @generated from field: thru.common.v1.Signature transaction_signature = 2;
|
|
1367
1398
|
*/
|
|
1368
|
-
transactionSignature?: Signature;
|
|
1399
|
+
transactionSignature?: Signature$1;
|
|
1369
1400
|
/**
|
|
1370
1401
|
* @generated from field: optional thru.common.v1.Pubkey program = 3;
|
|
1371
1402
|
*/
|
|
1372
|
-
program?: Pubkey;
|
|
1403
|
+
program?: Pubkey$1;
|
|
1373
1404
|
/**
|
|
1374
1405
|
* @generated from field: optional bytes payload = 4;
|
|
1375
1406
|
*/
|
|
@@ -1408,7 +1439,7 @@ type TransactionStatus = Message<"thru.services.v1.TransactionStatus"> & {
|
|
|
1408
1439
|
/**
|
|
1409
1440
|
* @generated from field: thru.common.v1.Signature signature = 1;
|
|
1410
1441
|
*/
|
|
1411
|
-
signature?: Signature;
|
|
1442
|
+
signature?: Signature$1;
|
|
1412
1443
|
/**
|
|
1413
1444
|
* @generated from field: optional thru.common.v1.ConsensusStatus consensus_status = 2;
|
|
1414
1445
|
*/
|
|
@@ -1444,7 +1475,7 @@ type BatchSendTransactionsResponse = Message<"thru.services.v1.BatchSendTransact
|
|
|
1444
1475
|
*
|
|
1445
1476
|
* @generated from field: repeated thru.common.v1.Signature signatures = 1;
|
|
1446
1477
|
*/
|
|
1447
|
-
signatures: Signature[];
|
|
1478
|
+
signatures: Signature$1[];
|
|
1448
1479
|
/**
|
|
1449
1480
|
* Acceptance status for each transaction (true if accepted, false if not).
|
|
1450
1481
|
*
|
|
@@ -1498,7 +1529,7 @@ declare class AccountMeta {
|
|
|
1498
1529
|
readonly flags: AccountFlags;
|
|
1499
1530
|
readonly dataSize: number;
|
|
1500
1531
|
readonly seq: bigint;
|
|
1501
|
-
readonly owner?:
|
|
1532
|
+
readonly owner?: Pubkey;
|
|
1502
1533
|
readonly balance: bigint;
|
|
1503
1534
|
readonly nonce?: bigint;
|
|
1504
1535
|
constructor(params: {
|
|
@@ -1506,7 +1537,7 @@ declare class AccountMeta {
|
|
|
1506
1537
|
flags?: AccountFlags;
|
|
1507
1538
|
dataSize: number;
|
|
1508
1539
|
seq: bigint;
|
|
1509
|
-
owner?:
|
|
1540
|
+
owner?: Pubkey;
|
|
1510
1541
|
balance: bigint;
|
|
1511
1542
|
nonce?: bigint;
|
|
1512
1543
|
});
|
|
@@ -1528,13 +1559,13 @@ interface AccountVersionContext {
|
|
|
1528
1559
|
blockTimestampNs?: bigint;
|
|
1529
1560
|
}
|
|
1530
1561
|
declare class Account {
|
|
1531
|
-
readonly address:
|
|
1562
|
+
readonly address: Pubkey;
|
|
1532
1563
|
readonly meta?: AccountMeta;
|
|
1533
1564
|
readonly data?: AccountData;
|
|
1534
1565
|
readonly versionContext?: AccountVersionContext;
|
|
1535
1566
|
readonly consensusStatus?: ConsensusStatus;
|
|
1536
1567
|
constructor(params: {
|
|
1537
|
-
address:
|
|
1568
|
+
address: Pubkey;
|
|
1538
1569
|
meta?: AccountMeta;
|
|
1539
1570
|
data?: AccountData;
|
|
1540
1571
|
versionContext?: AccountVersionContext;
|
|
@@ -1579,10 +1610,10 @@ declare class FilterParamValue {
|
|
|
1579
1610
|
static int(value: bigint): FilterParamValue;
|
|
1580
1611
|
static double(value: number): FilterParamValue;
|
|
1581
1612
|
static uint(value: number | bigint): FilterParamValue;
|
|
1582
|
-
static pubkey(value:
|
|
1583
|
-
static signature(value:
|
|
1584
|
-
static taPubkey(value:
|
|
1585
|
-
static tsSignature(value:
|
|
1613
|
+
static pubkey(value: PubkeyInput): FilterParamValue;
|
|
1614
|
+
static signature(value: SignatureInput): FilterParamValue;
|
|
1615
|
+
static taPubkey(value: PubkeyInput | string): FilterParamValue;
|
|
1616
|
+
static tsSignature(value: SignatureInput): FilterParamValue;
|
|
1586
1617
|
static fromProto(proto: FilterParamValue$1): FilterParamValue;
|
|
1587
1618
|
toProto(): FilterParamValue$1;
|
|
1588
1619
|
getCase(): FilterParamValueCase | undefined;
|
|
@@ -1648,7 +1679,7 @@ declare class PageResponse {
|
|
|
1648
1679
|
|
|
1649
1680
|
interface CreateAccountOptions {
|
|
1650
1681
|
/** The new account's public key (fee payer). */
|
|
1651
|
-
publicKey:
|
|
1682
|
+
publicKey: PubkeyInput;
|
|
1652
1683
|
/** Optional overrides for the transaction header. */
|
|
1653
1684
|
header?: Partial<TransactionHeaderInput>;
|
|
1654
1685
|
}
|
|
@@ -1674,8 +1705,8 @@ interface AccountList {
|
|
|
1674
1705
|
accounts: Account[];
|
|
1675
1706
|
page?: PageResponse;
|
|
1676
1707
|
}
|
|
1677
|
-
declare function getAccount(ctx: ThruClientContext, address:
|
|
1678
|
-
declare function getRawAccount(ctx: ThruClientContext, address:
|
|
1708
|
+
declare function getAccount(ctx: ThruClientContext, address: PubkeyInput, options?: AccountQueryOptions): Promise<Account>;
|
|
1709
|
+
declare function getRawAccount(ctx: ThruClientContext, address: PubkeyInput, options?: RawAccountQueryOptions): Promise<RawAccount>;
|
|
1679
1710
|
declare function listAccounts(ctx: ThruClientContext, options: ListAccountsOptions): Promise<AccountList>;
|
|
1680
1711
|
declare function createAccount(ctx: ThruClientContext, options: CreateAccountOptions): Promise<Transaction>;
|
|
1681
1712
|
|
|
@@ -1764,23 +1795,14 @@ declare class Block {
|
|
|
1764
1795
|
private static parseTransactionsFromBody;
|
|
1765
1796
|
}
|
|
1766
1797
|
|
|
1767
|
-
type TsSignatureInput = string | Uint8Array;
|
|
1768
|
-
|
|
1769
1798
|
type BlockSelector = {
|
|
1770
1799
|
slot: number | bigint;
|
|
1771
1800
|
} | {
|
|
1772
|
-
blockHash:
|
|
1801
|
+
blockHash: Uint8Array | string;
|
|
1773
1802
|
};
|
|
1774
|
-
declare function toSignature(value: BytesLike): Signature;
|
|
1775
|
-
declare function toSignatureBytes(value: BytesLike): Uint8Array;
|
|
1776
|
-
declare function toTsSignature(value: TsSignatureInput | BytesLike, field?: string): TsSignature;
|
|
1777
|
-
declare function toPubkey(value: Pubkey$1, field: string): Pubkey;
|
|
1778
|
-
declare function toPubkeyBytes(value: Pubkey$1, field: string): Uint8Array;
|
|
1779
|
-
declare function toTaPubkey(value: Pubkey$1 | string, field?: string): TaPubkey;
|
|
1780
|
-
declare function toBlockHash(value: BytesLike): BlockHash;
|
|
1781
1803
|
interface DeriveProgramAddressOptions {
|
|
1782
|
-
programAddress:
|
|
1783
|
-
seed:
|
|
1804
|
+
programAddress: PubkeyInput;
|
|
1805
|
+
seed: Uint8Array | string;
|
|
1784
1806
|
ephemeral?: boolean;
|
|
1785
1807
|
}
|
|
1786
1808
|
interface DeriveProgramAddressResult {
|
|
@@ -1949,7 +1971,7 @@ declare class StateProof {
|
|
|
1949
1971
|
}
|
|
1950
1972
|
|
|
1951
1973
|
type GenerateStateProofOptions = {
|
|
1952
|
-
address?:
|
|
1974
|
+
address?: PubkeyInput;
|
|
1953
1975
|
proofType: StateProofType;
|
|
1954
1976
|
targetSlot?: bigint;
|
|
1955
1977
|
};
|
|
@@ -1984,7 +2006,7 @@ interface StreamAccountUpdatesOptions {
|
|
|
1984
2006
|
interface StreamAccountUpdatesResult {
|
|
1985
2007
|
update: StreamAccountUpdate;
|
|
1986
2008
|
}
|
|
1987
|
-
declare function streamAccountUpdates(ctx: ThruClientContext, address:
|
|
2009
|
+
declare function streamAccountUpdates(ctx: ThruClientContext, address: PubkeyInput, options?: StreamAccountUpdatesOptions): AsyncIterable<StreamAccountUpdatesResult>;
|
|
1988
2010
|
interface StreamTransactionsOptions {
|
|
1989
2011
|
filter?: Filter;
|
|
1990
2012
|
minConsensus?: ConsensusStatus;
|
|
@@ -2000,7 +2022,7 @@ interface StreamEventsResult {
|
|
|
2000
2022
|
event: ChainEvent;
|
|
2001
2023
|
}
|
|
2002
2024
|
declare function streamEvents(ctx: ThruClientContext, options?: StreamEventsOptions): AsyncIterable<StreamEventsResult>;
|
|
2003
|
-
declare function trackTransaction(ctx: ThruClientContext, signature:
|
|
2025
|
+
declare function trackTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TrackTransactionOptions): AsyncIterable<TrackTransactionUpdate>;
|
|
2004
2026
|
interface CollectStreamOptions {
|
|
2005
2027
|
limit?: number;
|
|
2006
2028
|
signal?: AbortSignal;
|
|
@@ -2038,12 +2060,12 @@ declare namespace streaming {
|
|
|
2038
2060
|
}
|
|
2039
2061
|
|
|
2040
2062
|
interface TransactionFeePayerConfig {
|
|
2041
|
-
publicKey:
|
|
2063
|
+
publicKey: PubkeyInput;
|
|
2042
2064
|
privateKey?: Uint8Array;
|
|
2043
2065
|
}
|
|
2044
2066
|
interface TransactionAccountsConfig {
|
|
2045
|
-
readWrite?:
|
|
2046
|
-
readOnly?:
|
|
2067
|
+
readWrite?: PubkeyInput[];
|
|
2068
|
+
readOnly?: PubkeyInput[];
|
|
2047
2069
|
}
|
|
2048
2070
|
interface TransactionHeaderConfig {
|
|
2049
2071
|
fee?: bigint;
|
|
@@ -2060,13 +2082,13 @@ interface TransactionHeaderConfig {
|
|
|
2060
2082
|
* - A Uint8Array directly
|
|
2061
2083
|
* - A function that takes an InstructionContext and returns a Uint8Array
|
|
2062
2084
|
*/
|
|
2063
|
-
type InstructionData = Uint8Array | ((context: InstructionContext) => Promise<Uint8Array>);
|
|
2085
|
+
type InstructionData = Uint8Array | string | ((context: InstructionContext) => Promise<Uint8Array>);
|
|
2064
2086
|
interface BuildTransactionOptions {
|
|
2065
2087
|
feePayer: TransactionFeePayerConfig;
|
|
2066
|
-
program:
|
|
2088
|
+
program: PubkeyInput;
|
|
2067
2089
|
header?: TransactionHeaderConfig;
|
|
2068
2090
|
accounts?: TransactionAccountsConfig;
|
|
2069
|
-
instructionData?: InstructionData
|
|
2091
|
+
instructionData?: InstructionData;
|
|
2070
2092
|
feePayerStateProof?: Uint8Array;
|
|
2071
2093
|
feePayerAccountMetaRaw?: Uint8Array;
|
|
2072
2094
|
}
|
|
@@ -2093,10 +2115,10 @@ interface TransactionList {
|
|
|
2093
2115
|
transactions: Transaction[];
|
|
2094
2116
|
page?: PageResponse;
|
|
2095
2117
|
}
|
|
2096
|
-
declare function getTransaction(ctx: ThruClientContext, signature:
|
|
2097
|
-
declare function getRawTransaction(ctx: ThruClientContext, signature:
|
|
2098
|
-
declare function getTransactionStatus(ctx: ThruClientContext, signature:
|
|
2099
|
-
declare function listTransactionsForAccount(ctx: ThruClientContext, account:
|
|
2118
|
+
declare function getTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TransactionQueryOptions): Promise<Transaction>;
|
|
2119
|
+
declare function getRawTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: RawTransactionQueryOptions): Promise<RawTransaction>;
|
|
2120
|
+
declare function getTransactionStatus(ctx: ThruClientContext, signature: SignatureInput): Promise<TransactionStatusSnapshot>;
|
|
2121
|
+
declare function listTransactionsForAccount(ctx: ThruClientContext, account: PubkeyInput, options?: ListTransactionsForAccountOptions): Promise<TransactionList>;
|
|
2100
2122
|
declare function buildTransaction(ctx: ThruClientContext, options: BuildTransactionOptions): Promise<Transaction>;
|
|
2101
2123
|
declare function buildAndSignTransaction(ctx: ThruClientContext, options: BuildAndSignTransactionOptions): Promise<SignedTransactionResult>;
|
|
2102
2124
|
declare function sendTransaction(ctx: ThruClientContext, transaction: Transaction | Uint8Array): Promise<string>;
|
|
@@ -2135,4 +2157,4 @@ declare class VersionInfo {
|
|
|
2135
2157
|
get(component: string): string | undefined;
|
|
2136
2158
|
}
|
|
2137
2159
|
|
|
2138
|
-
export { type
|
|
2160
|
+
export { type DeriveProgramAddressResult as $, Account as A, type BuildTransactionParams as B, ChainEvent as C, TransactionVmError as D, ExecutionStatus as E, Filter as F, type PageRequestParams as G, HeightSnapshot as H, type PageResponseParams as I, type PubkeyInput as J, type SignatureInput as K, type VersionContextInput as L, type AccountQueryOptions as M, type CreateAccountOptions as N, type ListAccountsOptions as O, PageRequest as P, type BlockList as Q, type RawAccountQueryOptions as R, type SignedTransactionResult as S, Transaction as T, type BlockQueryOptions as U, VersionInfo as V, type ListBlocksOptions as W, type RawBlockQueryOptions as X, type GetEventOptions as Y, type BlockSelector as Z, type DeriveProgramAddressOptions as _, accounts as a, type GeneratedKeyPair as a0, type StreamAccountUpdate as a1, type HeightSnapshotParams as a2, type StreamAccountUpdatesOptions as a3, type StreamAccountUpdatesResult as a4, type StreamBlocksOptions as a5, type StreamBlocksResult as a6, type StreamEventsOptions as a7, type StreamEventsResult as a8, type StreamTransactionsOptions as a9, getRawAccount as aA, listAccounts as aB, streamAccountUpdates as aC, createAccount as aD, getTransaction as aE, getRawTransaction as aF, getTransactionStatus as aG, listTransactionsForAccount as aH, streamTransactions as aI, buildTransaction as aJ, buildAndSignTransaction as aK, sendTransaction as aL, batchSendTransactions as aM, trackTransaction as aN, getEvent as aO, streamEvents as aP, generateStateProof as aQ, generateKeyPair as aR, fromPrivateKey as aS, consensusStatusToString as aT, versionContext as aU, currentVersionContext as aV, currentOrHistoricalVersionContext as aW, slotVersionContext as aX, timestampVersionContext as aY, seqVersionContext as aZ, type ThruClientConfig as a_, type StreamTransactionsResult as aa, type StreamTransactionUpdate as ab, type TrackTransactionOptions as ac, type TrackTransactionUpdate as ad, type TransactionExecutionEvent as ae, type TransactionExecutionResultData as af, type InstructionContext as ag, type BatchSendTransactionsOptions as ah, type BuildAndSignTransactionOptions as ai, type BuildTransactionOptions as aj, type InstructionData as ak, type ListTransactionsForAccountOptions as al, type RawTransactionQueryOptions as am, type TransactionAccountsConfig as an, type TransactionFeePayerConfig as ao, type TransactionHeaderConfig as ap, type TransactionList as aq, type TransactionQueryOptions as ar, type GenerateStateProofOptions as as, type ThruClientContext as at, getBlock as au, getRawBlock as av, listBlocks as aw, streamBlocks as ax, getBlockHeight as ay, getAccount as az, blocks as b, consensus as c, Block as d, events as e, FilterParamValue as f, PageResponse as g, height as h, Pubkey as i, Signature as j, keys as k, StateProof as l, TransactionStatusSnapshot as m, deriveProgramAddress as n, collectStream as o, proofs as p, firstStreamValue as q, forEachStreamValue as r, streaming as s, transactions as t, ConsensusStatus as u, FilterParamValueSchema as v, FilterSchema as w, AccountView as x, BlockView as y, TransactionView as z };
|