@thru/thru-sdk 0.1.29 → 0.1.33
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-BGciKJJA.d.ts} +128 -94
- package/dist/{chunk-QJACP7VX.js → chunk-ZLV6WP54.js} +543 -484
- package/dist/chunk-ZLV6WP54.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 +24 -4
- package/dist/sdk.js +18 -18
- package/dist/sdk.js.map +1 -1
- package/package.json +6 -5
- 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
|
*/
|
|
@@ -885,13 +884,13 @@ declare enum AccountView {
|
|
|
885
884
|
}
|
|
886
885
|
|
|
887
886
|
/**
|
|
888
|
-
* BlockHash represents a
|
|
887
|
+
* BlockHash represents a 32-byte hash for block identifiers.
|
|
889
888
|
*
|
|
890
889
|
* @generated from message thru.core.v1.BlockHash
|
|
891
890
|
*/
|
|
892
891
|
type BlockHash = Message<"thru.core.v1.BlockHash"> & {
|
|
893
892
|
/**
|
|
894
|
-
*
|
|
893
|
+
* 32-byte block hash buffer.
|
|
895
894
|
*
|
|
896
895
|
* @generated from field: bytes value = 1;
|
|
897
896
|
*/
|
|
@@ -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
|
*/
|
|
@@ -949,13 +948,17 @@ type BlockHeader$1 = Message<"thru.core.v1.BlockHeader"> & {
|
|
|
949
948
|
*/
|
|
950
949
|
maxStateUnits: number;
|
|
951
950
|
/**
|
|
952
|
-
* @generated from field: uint64
|
|
951
|
+
* @generated from field: uint64 bond_amount_lock_up = 12;
|
|
953
952
|
*/
|
|
954
|
-
|
|
953
|
+
bondAmountLockUp: bigint;
|
|
955
954
|
/**
|
|
956
955
|
* @generated from field: google.protobuf.Timestamp block_time = 13;
|
|
957
956
|
*/
|
|
958
957
|
blockTime?: Timestamp;
|
|
958
|
+
/**
|
|
959
|
+
* @generated from field: uint64 weight_slot = 14;
|
|
960
|
+
*/
|
|
961
|
+
weightSlot: bigint;
|
|
959
962
|
};
|
|
960
963
|
/**
|
|
961
964
|
* BlockFooter captures execution result metadata for a block.
|
|
@@ -966,7 +969,7 @@ type BlockFooter$1 = Message<"thru.core.v1.BlockFooter"> & {
|
|
|
966
969
|
/**
|
|
967
970
|
* @generated from field: thru.common.v1.Signature signature = 1;
|
|
968
971
|
*/
|
|
969
|
-
signature?: Signature;
|
|
972
|
+
signature?: Signature$1;
|
|
970
973
|
/**
|
|
971
974
|
* @generated from field: thru.core.v1.ExecutionStatus status = 2;
|
|
972
975
|
*/
|
|
@@ -979,6 +982,10 @@ type BlockFooter$1 = Message<"thru.core.v1.BlockFooter"> & {
|
|
|
979
982
|
* @generated from field: uint32 consumed_state_units = 4;
|
|
980
983
|
*/
|
|
981
984
|
consumedStateUnits: number;
|
|
985
|
+
/**
|
|
986
|
+
* @generated from field: uint64 attestor_payment = 5;
|
|
987
|
+
*/
|
|
988
|
+
attestorPayment: bigint;
|
|
982
989
|
};
|
|
983
990
|
/**
|
|
984
991
|
* Block represents a fully decoded block resource.
|
|
@@ -1090,7 +1097,7 @@ type StreamEventsResponse = Message<"thru.services.v1.StreamEventsResponse"> & {
|
|
|
1090
1097
|
/**
|
|
1091
1098
|
* @generated from field: thru.common.v1.Pubkey program = 4;
|
|
1092
1099
|
*/
|
|
1093
|
-
program?: Pubkey;
|
|
1100
|
+
program?: Pubkey$1;
|
|
1094
1101
|
/**
|
|
1095
1102
|
* @generated from field: uint32 call_idx = 5;
|
|
1096
1103
|
*/
|
|
@@ -1098,17 +1105,50 @@ type StreamEventsResponse = Message<"thru.services.v1.StreamEventsResponse"> & {
|
|
|
1098
1105
|
/**
|
|
1099
1106
|
* @generated from field: thru.common.v1.Signature signature = 6;
|
|
1100
1107
|
*/
|
|
1101
|
-
signature?: Signature;
|
|
1108
|
+
signature?: Signature$1;
|
|
1102
1109
|
/**
|
|
1103
1110
|
* @generated from field: uint64 slot = 7;
|
|
1104
1111
|
*/
|
|
1105
1112
|
slot: bigint;
|
|
1106
1113
|
};
|
|
1107
1114
|
|
|
1108
|
-
type
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1115
|
+
type PubkeyInput = Uint8Array | string | Pubkey;
|
|
1116
|
+
declare class Pubkey {
|
|
1117
|
+
private readonly bytes;
|
|
1118
|
+
private constructor();
|
|
1119
|
+
static from(value: PubkeyInput): Pubkey;
|
|
1120
|
+
static isThruFmt(value: string): boolean;
|
|
1121
|
+
toBytes(): Uint8Array;
|
|
1122
|
+
toBytesUnsafe(): Uint8Array;
|
|
1123
|
+
toThruFmt(): string;
|
|
1124
|
+
toHex(): string;
|
|
1125
|
+
equals(other: PubkeyInput): boolean;
|
|
1126
|
+
toProtoPubkey(): Pubkey$1;
|
|
1127
|
+
toProtoTaPubkey(): TaPubkey;
|
|
1128
|
+
static fromProtoPubkey(proto?: Pubkey$1): Pubkey;
|
|
1129
|
+
static fromProtoTaPubkey(proto?: TaPubkey): Pubkey;
|
|
1130
|
+
private static bytesFromString;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
type SignatureInput = Uint8Array | string | Signature;
|
|
1134
|
+
declare class Signature {
|
|
1135
|
+
private readonly bytes;
|
|
1136
|
+
private constructor();
|
|
1137
|
+
static from(value: SignatureInput): Signature;
|
|
1138
|
+
static fromProto(proto?: Signature$1): Signature;
|
|
1139
|
+
static isThruFmt(value: string): boolean;
|
|
1140
|
+
toBytes(): Uint8Array;
|
|
1141
|
+
toBytesUnsafe(): Uint8Array;
|
|
1142
|
+
toThruFmt(): string;
|
|
1143
|
+
toHex(): string;
|
|
1144
|
+
equals(other: SignatureInput): boolean;
|
|
1145
|
+
toProtoSignature(): Signature$1;
|
|
1146
|
+
toProtoTsSignature(): TsSignature;
|
|
1147
|
+
static fromProtoTsSignature(proto?: TsSignature): Signature;
|
|
1148
|
+
static fromProtoSignature(proto?: Signature$1): Signature;
|
|
1149
|
+
private static bytesFromString;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1112
1152
|
interface ResourceLimits {
|
|
1113
1153
|
computeUnits?: number;
|
|
1114
1154
|
stateUnits?: number;
|
|
@@ -1126,8 +1166,8 @@ interface TransactionHeaderInput extends ResourceLimits {
|
|
|
1126
1166
|
flags?: number;
|
|
1127
1167
|
}
|
|
1128
1168
|
interface TransactionAccountsInput {
|
|
1129
|
-
readWriteAccounts?:
|
|
1130
|
-
readOnlyAccounts?:
|
|
1169
|
+
readWriteAccounts?: PubkeyInput[];
|
|
1170
|
+
readOnlyAccounts?: PubkeyInput[];
|
|
1131
1171
|
}
|
|
1132
1172
|
/**
|
|
1133
1173
|
* Context provided to instruction data functions.
|
|
@@ -1136,27 +1176,27 @@ interface TransactionAccountsInput {
|
|
|
1136
1176
|
*/
|
|
1137
1177
|
interface InstructionContext {
|
|
1138
1178
|
/** All accounts in final transaction order: [feePayer, program, ...readWrite, ...readOnly] */
|
|
1139
|
-
accounts:
|
|
1179
|
+
accounts: Pubkey[];
|
|
1140
1180
|
/** Get the index of an account by its public key. Throws if account is not found in transaction. */
|
|
1141
|
-
getAccountIndex: (pubkey:
|
|
1181
|
+
getAccountIndex: (pubkey: PubkeyInput) => number;
|
|
1142
1182
|
}
|
|
1143
1183
|
interface FeePayerInput {
|
|
1144
|
-
publicKey:
|
|
1145
|
-
privateKey?:
|
|
1184
|
+
publicKey: PubkeyInput;
|
|
1185
|
+
privateKey?: Uint8Array;
|
|
1146
1186
|
}
|
|
1147
1187
|
interface BuildTransactionParams {
|
|
1148
1188
|
feePayer: FeePayerInput;
|
|
1149
|
-
program:
|
|
1189
|
+
program: PubkeyInput;
|
|
1150
1190
|
header: TransactionHeaderInput;
|
|
1151
1191
|
accounts?: TransactionAccountsInput;
|
|
1152
|
-
instructionData?:
|
|
1192
|
+
instructionData?: Uint8Array | string;
|
|
1153
1193
|
proofs?: OptionalProofs;
|
|
1154
1194
|
}
|
|
1155
1195
|
interface BuiltTransactionResult {
|
|
1156
1196
|
transaction: TransactionLike;
|
|
1157
1197
|
}
|
|
1158
1198
|
interface SignedTransactionResult extends BuiltTransactionResult {
|
|
1159
|
-
signature:
|
|
1199
|
+
signature: Signature;
|
|
1160
1200
|
rawTransaction: Uint8Array;
|
|
1161
1201
|
}
|
|
1162
1202
|
interface TransactionLike {
|
|
@@ -1167,7 +1207,7 @@ interface TransactionExecutionEvent {
|
|
|
1167
1207
|
eventId: string;
|
|
1168
1208
|
callIdx: number;
|
|
1169
1209
|
programIdx: number;
|
|
1170
|
-
program?:
|
|
1210
|
+
program?: Pubkey;
|
|
1171
1211
|
payload: Uint8Array;
|
|
1172
1212
|
}
|
|
1173
1213
|
interface TransactionExecutionResultData {
|
|
@@ -1180,14 +1220,14 @@ interface TransactionExecutionResultData {
|
|
|
1180
1220
|
pagesUsed: number;
|
|
1181
1221
|
eventsCount: number;
|
|
1182
1222
|
eventsSize: number;
|
|
1183
|
-
readwriteAccounts:
|
|
1184
|
-
readonlyAccounts:
|
|
1223
|
+
readwriteAccounts: Pubkey[];
|
|
1224
|
+
readonlyAccounts: Pubkey[];
|
|
1185
1225
|
events?: TransactionExecutionEvent[];
|
|
1186
1226
|
}
|
|
1187
1227
|
declare class Transaction {
|
|
1188
1228
|
readonly version: number;
|
|
1189
|
-
readonly feePayer:
|
|
1190
|
-
readonly program:
|
|
1229
|
+
readonly feePayer: Pubkey;
|
|
1230
|
+
readonly program: Pubkey;
|
|
1191
1231
|
readonly fee: bigint;
|
|
1192
1232
|
readonly nonce: bigint;
|
|
1193
1233
|
readonly startSlot: bigint;
|
|
@@ -1196,8 +1236,8 @@ declare class Transaction {
|
|
|
1196
1236
|
readonly requestedStateUnits: number;
|
|
1197
1237
|
readonly requestedMemoryUnits: number;
|
|
1198
1238
|
readonly flags: number;
|
|
1199
|
-
readonly readWriteAccounts:
|
|
1200
|
-
readonly readOnlyAccounts:
|
|
1239
|
+
readonly readWriteAccounts: Pubkey[];
|
|
1240
|
+
readonly readOnlyAccounts: Pubkey[];
|
|
1201
1241
|
readonly instructionData?: Uint8Array;
|
|
1202
1242
|
readonly instructionDataSize?: number;
|
|
1203
1243
|
readonly feePayerStateProof?: Uint8Array;
|
|
@@ -1208,8 +1248,8 @@ declare class Transaction {
|
|
|
1208
1248
|
private signature?;
|
|
1209
1249
|
constructor(params: {
|
|
1210
1250
|
version?: number;
|
|
1211
|
-
feePayer:
|
|
1212
|
-
program:
|
|
1251
|
+
feePayer: PubkeyInput;
|
|
1252
|
+
program: PubkeyInput;
|
|
1213
1253
|
header: TransactionHeaderInput;
|
|
1214
1254
|
accounts?: TransactionAccountsInput;
|
|
1215
1255
|
instructionData?: Uint8Array;
|
|
@@ -1224,9 +1264,9 @@ declare class Transaction {
|
|
|
1224
1264
|
size: number;
|
|
1225
1265
|
};
|
|
1226
1266
|
static fromProto(proto: Transaction$1): Transaction;
|
|
1227
|
-
getSignature():
|
|
1228
|
-
setSignature(signature:
|
|
1229
|
-
sign(privateKey: Uint8Array): Promise<
|
|
1267
|
+
getSignature(): Signature | undefined;
|
|
1268
|
+
setSignature(signature: Signature): void;
|
|
1269
|
+
sign(privateKey: Uint8Array): Promise<Signature>;
|
|
1230
1270
|
toWireForSigning(): Uint8Array;
|
|
1231
1271
|
toWire(): Uint8Array;
|
|
1232
1272
|
private createHeader;
|
|
@@ -1235,7 +1275,6 @@ declare class Transaction {
|
|
|
1235
1275
|
private static ensureAvailable;
|
|
1236
1276
|
private static parseStateProof;
|
|
1237
1277
|
static executionResultFromProto(proto: TransactionExecutionResult): TransactionExecutionResultData;
|
|
1238
|
-
private static convertExecutionResultToProto;
|
|
1239
1278
|
}
|
|
1240
1279
|
|
|
1241
1280
|
type StreamTransactionUpdate = {
|
|
@@ -1365,11 +1404,11 @@ type Event = Message<"thru.services.v1.Event"> & {
|
|
|
1365
1404
|
/**
|
|
1366
1405
|
* @generated from field: thru.common.v1.Signature transaction_signature = 2;
|
|
1367
1406
|
*/
|
|
1368
|
-
transactionSignature?: Signature;
|
|
1407
|
+
transactionSignature?: Signature$1;
|
|
1369
1408
|
/**
|
|
1370
1409
|
* @generated from field: optional thru.common.v1.Pubkey program = 3;
|
|
1371
1410
|
*/
|
|
1372
|
-
program?: Pubkey;
|
|
1411
|
+
program?: Pubkey$1;
|
|
1373
1412
|
/**
|
|
1374
1413
|
* @generated from field: optional bytes payload = 4;
|
|
1375
1414
|
*/
|
|
@@ -1408,7 +1447,7 @@ type TransactionStatus = Message<"thru.services.v1.TransactionStatus"> & {
|
|
|
1408
1447
|
/**
|
|
1409
1448
|
* @generated from field: thru.common.v1.Signature signature = 1;
|
|
1410
1449
|
*/
|
|
1411
|
-
signature?: Signature;
|
|
1450
|
+
signature?: Signature$1;
|
|
1412
1451
|
/**
|
|
1413
1452
|
* @generated from field: optional thru.common.v1.ConsensusStatus consensus_status = 2;
|
|
1414
1453
|
*/
|
|
@@ -1444,7 +1483,7 @@ type BatchSendTransactionsResponse = Message<"thru.services.v1.BatchSendTransact
|
|
|
1444
1483
|
*
|
|
1445
1484
|
* @generated from field: repeated thru.common.v1.Signature signatures = 1;
|
|
1446
1485
|
*/
|
|
1447
|
-
signatures: Signature[];
|
|
1486
|
+
signatures: Signature$1[];
|
|
1448
1487
|
/**
|
|
1449
1488
|
* Acceptance status for each transaction (true if accepted, false if not).
|
|
1450
1489
|
*
|
|
@@ -1498,7 +1537,7 @@ declare class AccountMeta {
|
|
|
1498
1537
|
readonly flags: AccountFlags;
|
|
1499
1538
|
readonly dataSize: number;
|
|
1500
1539
|
readonly seq: bigint;
|
|
1501
|
-
readonly owner?:
|
|
1540
|
+
readonly owner?: Pubkey;
|
|
1502
1541
|
readonly balance: bigint;
|
|
1503
1542
|
readonly nonce?: bigint;
|
|
1504
1543
|
constructor(params: {
|
|
@@ -1506,7 +1545,7 @@ declare class AccountMeta {
|
|
|
1506
1545
|
flags?: AccountFlags;
|
|
1507
1546
|
dataSize: number;
|
|
1508
1547
|
seq: bigint;
|
|
1509
|
-
owner?:
|
|
1548
|
+
owner?: Pubkey;
|
|
1510
1549
|
balance: bigint;
|
|
1511
1550
|
nonce?: bigint;
|
|
1512
1551
|
});
|
|
@@ -1528,13 +1567,13 @@ interface AccountVersionContext {
|
|
|
1528
1567
|
blockTimestampNs?: bigint;
|
|
1529
1568
|
}
|
|
1530
1569
|
declare class Account {
|
|
1531
|
-
readonly address:
|
|
1570
|
+
readonly address: Pubkey;
|
|
1532
1571
|
readonly meta?: AccountMeta;
|
|
1533
1572
|
readonly data?: AccountData;
|
|
1534
1573
|
readonly versionContext?: AccountVersionContext;
|
|
1535
1574
|
readonly consensusStatus?: ConsensusStatus;
|
|
1536
1575
|
constructor(params: {
|
|
1537
|
-
address:
|
|
1576
|
+
address: Pubkey;
|
|
1538
1577
|
meta?: AccountMeta;
|
|
1539
1578
|
data?: AccountData;
|
|
1540
1579
|
versionContext?: AccountVersionContext;
|
|
@@ -1579,10 +1618,10 @@ declare class FilterParamValue {
|
|
|
1579
1618
|
static int(value: bigint): FilterParamValue;
|
|
1580
1619
|
static double(value: number): FilterParamValue;
|
|
1581
1620
|
static uint(value: number | bigint): FilterParamValue;
|
|
1582
|
-
static pubkey(value:
|
|
1583
|
-
static signature(value:
|
|
1584
|
-
static taPubkey(value:
|
|
1585
|
-
static tsSignature(value:
|
|
1621
|
+
static pubkey(value: PubkeyInput): FilterParamValue;
|
|
1622
|
+
static signature(value: SignatureInput): FilterParamValue;
|
|
1623
|
+
static taPubkey(value: PubkeyInput | string): FilterParamValue;
|
|
1624
|
+
static tsSignature(value: SignatureInput): FilterParamValue;
|
|
1586
1625
|
static fromProto(proto: FilterParamValue$1): FilterParamValue;
|
|
1587
1626
|
toProto(): FilterParamValue$1;
|
|
1588
1627
|
getCase(): FilterParamValueCase | undefined;
|
|
@@ -1648,7 +1687,7 @@ declare class PageResponse {
|
|
|
1648
1687
|
|
|
1649
1688
|
interface CreateAccountOptions {
|
|
1650
1689
|
/** The new account's public key (fee payer). */
|
|
1651
|
-
publicKey:
|
|
1690
|
+
publicKey: PubkeyInput;
|
|
1652
1691
|
/** Optional overrides for the transaction header. */
|
|
1653
1692
|
header?: Partial<TransactionHeaderInput>;
|
|
1654
1693
|
}
|
|
@@ -1674,8 +1713,8 @@ interface AccountList {
|
|
|
1674
1713
|
accounts: Account[];
|
|
1675
1714
|
page?: PageResponse;
|
|
1676
1715
|
}
|
|
1677
|
-
declare function getAccount(ctx: ThruClientContext, address:
|
|
1678
|
-
declare function getRawAccount(ctx: ThruClientContext, address:
|
|
1716
|
+
declare function getAccount(ctx: ThruClientContext, address: PubkeyInput, options?: AccountQueryOptions): Promise<Account>;
|
|
1717
|
+
declare function getRawAccount(ctx: ThruClientContext, address: PubkeyInput, options?: RawAccountQueryOptions): Promise<RawAccount>;
|
|
1679
1718
|
declare function listAccounts(ctx: ThruClientContext, options: ListAccountsOptions): Promise<AccountList>;
|
|
1680
1719
|
declare function createAccount(ctx: ThruClientContext, options: CreateAccountOptions): Promise<Transaction>;
|
|
1681
1720
|
|
|
@@ -1697,12 +1736,14 @@ interface BlockFooterParams {
|
|
|
1697
1736
|
status: ExecutionStatus;
|
|
1698
1737
|
consumedComputeUnits: bigint;
|
|
1699
1738
|
consumedStateUnits: number;
|
|
1739
|
+
attestorPayment: bigint;
|
|
1700
1740
|
}
|
|
1701
1741
|
declare class BlockFooter {
|
|
1702
1742
|
readonly signature?: Uint8Array;
|
|
1703
1743
|
readonly status: ExecutionStatus;
|
|
1704
1744
|
readonly consumedComputeUnits: bigint;
|
|
1705
1745
|
readonly consumedStateUnits: number;
|
|
1746
|
+
readonly attestorPayment: bigint;
|
|
1706
1747
|
constructor(params: BlockFooterParams);
|
|
1707
1748
|
static fromProto(proto: BlockFooter$1): BlockFooter;
|
|
1708
1749
|
}
|
|
@@ -1718,7 +1759,8 @@ interface BlockHeaderParams {
|
|
|
1718
1759
|
maxBlockSize?: number;
|
|
1719
1760
|
maxComputeUnits?: bigint;
|
|
1720
1761
|
maxStateUnits?: number;
|
|
1721
|
-
|
|
1762
|
+
bondAmountLockUp?: bigint;
|
|
1763
|
+
weightSlot?: bigint;
|
|
1722
1764
|
blockHash?: Uint8Array;
|
|
1723
1765
|
}
|
|
1724
1766
|
declare class BlockHeader {
|
|
@@ -1732,7 +1774,8 @@ declare class BlockHeader {
|
|
|
1732
1774
|
readonly maxBlockSize?: number;
|
|
1733
1775
|
readonly maxComputeUnits?: bigint;
|
|
1734
1776
|
readonly maxStateUnits?: number;
|
|
1735
|
-
readonly
|
|
1777
|
+
readonly bondAmountLockUp?: bigint;
|
|
1778
|
+
readonly weightSlot?: bigint;
|
|
1736
1779
|
readonly blockHash?: Uint8Array;
|
|
1737
1780
|
constructor(params: BlockHeaderParams);
|
|
1738
1781
|
static fromProto(proto: BlockHeader$1): BlockHeader;
|
|
@@ -1764,23 +1807,14 @@ declare class Block {
|
|
|
1764
1807
|
private static parseTransactionsFromBody;
|
|
1765
1808
|
}
|
|
1766
1809
|
|
|
1767
|
-
type TsSignatureInput = string | Uint8Array;
|
|
1768
|
-
|
|
1769
1810
|
type BlockSelector = {
|
|
1770
1811
|
slot: number | bigint;
|
|
1771
1812
|
} | {
|
|
1772
|
-
blockHash:
|
|
1813
|
+
blockHash: Uint8Array | string;
|
|
1773
1814
|
};
|
|
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
1815
|
interface DeriveProgramAddressOptions {
|
|
1782
|
-
programAddress:
|
|
1783
|
-
seed:
|
|
1816
|
+
programAddress: PubkeyInput;
|
|
1817
|
+
seed: Uint8Array | string;
|
|
1784
1818
|
ephemeral?: boolean;
|
|
1785
1819
|
}
|
|
1786
1820
|
interface DeriveProgramAddressResult {
|
|
@@ -1949,7 +1983,7 @@ declare class StateProof {
|
|
|
1949
1983
|
}
|
|
1950
1984
|
|
|
1951
1985
|
type GenerateStateProofOptions = {
|
|
1952
|
-
address?:
|
|
1986
|
+
address?: PubkeyInput;
|
|
1953
1987
|
proofType: StateProofType;
|
|
1954
1988
|
targetSlot?: bigint;
|
|
1955
1989
|
};
|
|
@@ -1984,7 +2018,7 @@ interface StreamAccountUpdatesOptions {
|
|
|
1984
2018
|
interface StreamAccountUpdatesResult {
|
|
1985
2019
|
update: StreamAccountUpdate;
|
|
1986
2020
|
}
|
|
1987
|
-
declare function streamAccountUpdates(ctx: ThruClientContext, address:
|
|
2021
|
+
declare function streamAccountUpdates(ctx: ThruClientContext, address: PubkeyInput, options?: StreamAccountUpdatesOptions): AsyncIterable<StreamAccountUpdatesResult>;
|
|
1988
2022
|
interface StreamTransactionsOptions {
|
|
1989
2023
|
filter?: Filter;
|
|
1990
2024
|
minConsensus?: ConsensusStatus;
|
|
@@ -2000,7 +2034,7 @@ interface StreamEventsResult {
|
|
|
2000
2034
|
event: ChainEvent;
|
|
2001
2035
|
}
|
|
2002
2036
|
declare function streamEvents(ctx: ThruClientContext, options?: StreamEventsOptions): AsyncIterable<StreamEventsResult>;
|
|
2003
|
-
declare function trackTransaction(ctx: ThruClientContext, signature:
|
|
2037
|
+
declare function trackTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TrackTransactionOptions): AsyncIterable<TrackTransactionUpdate>;
|
|
2004
2038
|
interface CollectStreamOptions {
|
|
2005
2039
|
limit?: number;
|
|
2006
2040
|
signal?: AbortSignal;
|
|
@@ -2038,12 +2072,12 @@ declare namespace streaming {
|
|
|
2038
2072
|
}
|
|
2039
2073
|
|
|
2040
2074
|
interface TransactionFeePayerConfig {
|
|
2041
|
-
publicKey:
|
|
2075
|
+
publicKey: PubkeyInput;
|
|
2042
2076
|
privateKey?: Uint8Array;
|
|
2043
2077
|
}
|
|
2044
2078
|
interface TransactionAccountsConfig {
|
|
2045
|
-
readWrite?:
|
|
2046
|
-
readOnly?:
|
|
2079
|
+
readWrite?: PubkeyInput[];
|
|
2080
|
+
readOnly?: PubkeyInput[];
|
|
2047
2081
|
}
|
|
2048
2082
|
interface TransactionHeaderConfig {
|
|
2049
2083
|
fee?: bigint;
|
|
@@ -2060,13 +2094,13 @@ interface TransactionHeaderConfig {
|
|
|
2060
2094
|
* - A Uint8Array directly
|
|
2061
2095
|
* - A function that takes an InstructionContext and returns a Uint8Array
|
|
2062
2096
|
*/
|
|
2063
|
-
type InstructionData = Uint8Array | ((context: InstructionContext) => Promise<Uint8Array>);
|
|
2097
|
+
type InstructionData = Uint8Array | string | ((context: InstructionContext) => Promise<Uint8Array>);
|
|
2064
2098
|
interface BuildTransactionOptions {
|
|
2065
2099
|
feePayer: TransactionFeePayerConfig;
|
|
2066
|
-
program:
|
|
2100
|
+
program: PubkeyInput;
|
|
2067
2101
|
header?: TransactionHeaderConfig;
|
|
2068
2102
|
accounts?: TransactionAccountsConfig;
|
|
2069
|
-
instructionData?: InstructionData
|
|
2103
|
+
instructionData?: InstructionData;
|
|
2070
2104
|
feePayerStateProof?: Uint8Array;
|
|
2071
2105
|
feePayerAccountMetaRaw?: Uint8Array;
|
|
2072
2106
|
}
|
|
@@ -2093,10 +2127,10 @@ interface TransactionList {
|
|
|
2093
2127
|
transactions: Transaction[];
|
|
2094
2128
|
page?: PageResponse;
|
|
2095
2129
|
}
|
|
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:
|
|
2130
|
+
declare function getTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: TransactionQueryOptions): Promise<Transaction>;
|
|
2131
|
+
declare function getRawTransaction(ctx: ThruClientContext, signature: SignatureInput, options?: RawTransactionQueryOptions): Promise<RawTransaction>;
|
|
2132
|
+
declare function getTransactionStatus(ctx: ThruClientContext, signature: SignatureInput): Promise<TransactionStatusSnapshot>;
|
|
2133
|
+
declare function listTransactionsForAccount(ctx: ThruClientContext, account: PubkeyInput, options?: ListTransactionsForAccountOptions): Promise<TransactionList>;
|
|
2100
2134
|
declare function buildTransaction(ctx: ThruClientContext, options: BuildTransactionOptions): Promise<Transaction>;
|
|
2101
2135
|
declare function buildAndSignTransaction(ctx: ThruClientContext, options: BuildAndSignTransactionOptions): Promise<SignedTransactionResult>;
|
|
2102
2136
|
declare function sendTransaction(ctx: ThruClientContext, transaction: Transaction | Uint8Array): Promise<string>;
|
|
@@ -2135,4 +2169,4 @@ declare class VersionInfo {
|
|
|
2135
2169
|
get(component: string): string | undefined;
|
|
2136
2170
|
}
|
|
2137
2171
|
|
|
2138
|
-
export { type
|
|
2172
|
+
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 };
|