@rialo/ts-cdk 0.2.0 → 0.3.0-alpha.1

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/index.d.ts CHANGED
@@ -93,13 +93,10 @@ declare const URL_TESTNET: string;
93
93
  declare const URL_DEVNET: string;
94
94
  /** Rialo localnet RPC URL */
95
95
  declare const URL_LOCALNET: string;
96
- /** Rialo shitnet RPC URL */
97
- declare const URL_SHITNET: string;
98
96
  declare const RIALO_MAINNET_CHAIN: ChainDefinition;
99
97
  declare const RIALO_TESTNET_CHAIN: ChainDefinition;
100
98
  declare const RIALO_DEVNET_CHAIN: ChainDefinition;
101
99
  declare const RIALO_LOCALNET_CHAIN: ChainDefinition;
102
- declare const RIALO_SHITNET_CHAIN: ChainDefinition;
103
100
  /** System program ID */
104
101
  declare const SYSTEM_PROGRAM_ID: string;
105
102
  /** Base derivation path for Rialo wallets (BIP44 coin type 756) */
@@ -158,7 +155,7 @@ declare class CryptoError extends Error {
158
155
  * const base58 = sig.toString();
159
156
  * ```
160
157
  */
161
- declare class Signature {
158
+ declare class Signature$1 {
162
159
  private readonly bytes;
163
160
  private constructor();
164
161
  /**
@@ -167,14 +164,14 @@ declare class Signature {
167
164
  * @param bytes - 64-byte Ed25519 signature
168
165
  * @throws {CryptoError} If bytes length is not 64
169
166
  */
170
- static fromBytes(bytes: Uint8Array): Signature;
167
+ static fromBytes(bytes: Uint8Array): Signature$1;
171
168
  /**
172
169
  * Creates a Signature from a base58-encoded string.
173
170
  *
174
171
  * @param str - Base58-encoded signature
175
172
  * @throws {CryptoError} If string is invalid or decodes to wrong length
176
173
  */
177
- static fromString(str: string): Signature;
174
+ static fromString(str: string): Signature$1;
178
175
  /**
179
176
  * Returns a copy of the raw bytes.
180
177
  */
@@ -335,7 +332,7 @@ declare class PublicKey {
335
332
  * const isValid = keypair.publicKey.verify(message, signature);
336
333
  * ```
337
334
  */
338
- verify(message: Uint8Array, signature: Signature): boolean;
335
+ verify(message: Uint8Array, signature: Signature$1): boolean;
339
336
  /**
340
337
  * Checks if the public key is on the Ed25519 curve.
341
338
  *
@@ -403,7 +400,7 @@ declare class Keypair {
403
400
  * @returns Ed25519 signature
404
401
  * @throws {CryptoError} If keypair has been disposed
405
402
  */
406
- sign(message: Uint8Array): Signature;
403
+ sign(message: Uint8Array): Signature$1;
407
404
  /**
408
405
  * Verifies a signature against a message using this keypair's public key.
409
406
  *
@@ -411,7 +408,7 @@ declare class Keypair {
411
408
  * @param signature - Signature to verify
412
409
  * @returns true if signature is valid
413
410
  */
414
- verify(message: Uint8Array, signature: Signature): boolean;
411
+ verify(message: Uint8Array, signature: Signature$1): boolean;
415
412
  /**
416
413
  * Exports the secret key for storage.
417
414
  *
@@ -734,335 +731,1693 @@ declare class RialoError extends Error {
734
731
  }
735
732
 
736
733
  /**
737
- * Base client with JSON-RPC protocol handling.
734
+ * Error codes for HPKE encryption operations.
735
+ */
736
+ declare enum HpkeErrorCode {
737
+ /** Key length does not match expected size */
738
+ INVALID_KEY_LENGTH = "INVALID_KEY_LENGTH",
739
+ /** Ciphertext is shorter than minimum required length */
740
+ CIPHERTEXT_TOO_SHORT = "CIPHERTEXT_TOO_SHORT",
741
+ /** HPKE encryption operation failed */
742
+ ENCRYPTION_FAILED = "ENCRYPTION_FAILED",
743
+ /** Failed to deserialize Borsh data */
744
+ BORSH_DESERIALIZE_FAILED = "BORSH_DESERIALIZE_FAILED",
745
+ /** RexValue has invalid variant byte */
746
+ INVALID_REX_VALUE = "INVALID_REX_VALUE"
747
+ }
748
+ /**
749
+ * Error class for HPKE encryption operations.
738
750
  *
739
- * All specific clients (QueryClient, TransactionClient) extend this.
751
+ * Provides detailed error information for encryption failures,
752
+ * including error codes and contextual details.
740
753
  */
741
- declare class BaseRpcClient {
742
- protected readonly transport: HttpTransport;
743
- private requestId;
744
- constructor(transport: HttpTransport);
754
+ declare class HpkeError extends Error {
755
+ readonly code: HpkeErrorCode;
756
+ readonly cause?: Error;
757
+ constructor(code: HpkeErrorCode, message: string, cause?: Error);
745
758
  /**
746
- * Makes a JSON-RPC 2.0 method call with type safety.
759
+ * Create an error for invalid key length.
747
760
  *
748
- * Handles request serialization, response validation, and error mapping.
761
+ * @param expected - Expected key length in bytes
762
+ * @param actual - Actual key length in bytes
763
+ * @param keyType - Description of the key type (e.g., "REX public key")
749
764
  */
750
- protected call<T>(method: string, params?: unknown[]): Promise<T>;
765
+ static invalidKeyLength(expected: number, actual: number, keyType: string): HpkeError;
751
766
  /**
752
- * Validate JSON-RPC response structure
767
+ * Create an error for ciphertext that is too short.
768
+ *
769
+ * @param minLength - Minimum required length
770
+ * @param actual - Actual length
753
771
  */
754
- private isValidJsonRpcResponse;
772
+ static ciphertextTooShort(minLength: number, actual: number): HpkeError;
755
773
  /**
756
- * Generates the next request ID with Overflow Protection.
757
- * @returns The next request ID.
774
+ * Create an error for encryption failure.
775
+ *
776
+ * @param cause - The underlying error
758
777
  */
759
- private nextRequestId;
778
+ static encryptionFailed(cause: Error): HpkeError;
760
779
  /**
761
- * Returns the configured RPC endpoint URL.
780
+ * Create an error for Borsh deserialization failure.
781
+ *
782
+ * @param cause - The underlying error
762
783
  */
763
- getUrl(): string;
784
+ static borshDeserializeFailed(cause: Error): HpkeError;
785
+ /**
786
+ * Create an error for invalid RexValue variant.
787
+ *
788
+ * @param variant - The invalid variant byte
789
+ */
790
+ static invalidRexValue(variant: number): HpkeError;
791
+ }
792
+
793
+ /**
794
+ * Constants for REX HPKE encryption.
795
+ *
796
+ * These constants MUST match the Rust implementation exactly:
797
+ * - `crates/tee/secret-sharing/src/constants.rs`
798
+ *
799
+ * @module
800
+ */
801
+ /**
802
+ * Additional Authenticated Data (AAD) prefix for user secrets.
803
+ *
804
+ * This 13-byte string is prepended to the sender's public key to form
805
+ * the complete AAD for HPKE encryption. It provides domain separation
806
+ * to prevent cross-protocol attacks.
807
+ *
808
+ * Format: `USER_SECRET_AAD || senderPubkey` = 45 bytes total AAD
809
+ *
810
+ * @remarks
811
+ * Must match Rust: `pub const USER_SECRET_AAD: &[u8] = b"rex-secret-v1";`
812
+ */
813
+ declare const USER_SECRET_AAD: Uint8Array<ArrayBuffer>;
814
+ /**
815
+ * HPKE info string for secret sharing context.
816
+ *
817
+ * This 32-byte string is used as the `info` parameter in HPKE encryption,
818
+ * providing domain separation for secret sharing operations.
819
+ *
820
+ * @remarks
821
+ * Must match Rust: `pub const SECRET_SHARING_HPKE_INFO: &[u8; 32] = b"rialo/tee/secret-sharing-hpke/v1";`
822
+ */
823
+ declare const SECRET_SHARING_HPKE_INFO: Uint8Array<ArrayBuffer>;
824
+ /**
825
+ * Length of an X25519 public key in bytes.
826
+ *
827
+ * Used for the REX encryption public key (secret sharing key).
828
+ */
829
+ declare const X25519_PUBLIC_KEY_LENGTH = 32;
830
+ /**
831
+ * Length of an Ed25519 public key in bytes.
832
+ *
833
+ * Used for sender identity binding in AAD construction.
834
+ */
835
+ declare const ED25519_PUBLIC_KEY_LENGTH = 32;
836
+ /**
837
+ * Length of the HPKE encapsulated key (enc) in bytes.
838
+ *
839
+ * For X25519, this is always 32 bytes.
840
+ */
841
+ declare const HPKE_ENC_LENGTH = 32;
842
+ /**
843
+ * Length of the ChaCha20-Poly1305 authentication tag in bytes.
844
+ */
845
+ declare const CHACHA20_POLY1305_TAG_LENGTH = 16;
846
+ /**
847
+ * Total overhead added by HPKE encryption.
848
+ *
849
+ * This is the additional bytes beyond the plaintext:
850
+ * - enc (32 bytes): Encapsulated ephemeral public key
851
+ * - tag (16 bytes): ChaCha20-Poly1305 authentication tag
852
+ *
853
+ * Ciphertext length = plaintext length + 48 bytes
854
+ */
855
+ declare const HPKE_OVERHEAD_LENGTH: number;
856
+
857
+ /**
858
+ * Variant discriminator for RexValue Borsh serialization.
859
+ */
860
+ declare enum RexValueVariant {
861
+ /** Plain (unencrypted) data variant */
862
+ Plain = 0,
863
+ /** Encrypted data variant */
864
+ Encrypted = 1
865
+ }
866
+ /**
867
+ * Represents an rex value that can be plain or encrypted.
868
+ *
869
+ * This class provides Borsh-compatible serialization that matches
870
+ * the Rust `RexValue` enum:
871
+ *
872
+ * ```rust
873
+ * pub enum RexValue {
874
+ * Plain(Vec<u8>),
875
+ * Encrypted(Vec<u8>),
876
+ * }
877
+ * ```
878
+ *
879
+ * ## Borsh Format
880
+ *
881
+ * - Plain: `[0x00] [length: u32 LE] [data bytes]`
882
+ * - Encrypted: `[0x01] [length: u32 LE] [ciphertext bytes]`
883
+ *
884
+ * @example
885
+ * ```typescript
886
+ * // Plain value (unencrypted)
887
+ * const plain = RexValue.plain(new TextEncoder().encode("hello"));
888
+ *
889
+ * // Encrypted value (via HPKE)
890
+ * const encrypted = RexValue.encrypted(ciphertextBytes);
891
+ *
892
+ * // Serialize to Borsh
893
+ * const borsh = plain.toBorsh();
894
+ *
895
+ * // Deserialize from Borsh
896
+ * const restored = RexValue.fromBorsh(borsh);
897
+ * ```
898
+ */
899
+ declare class RexValue {
900
+ private readonly variant;
901
+ private readonly data;
902
+ private constructor();
903
+ /**
904
+ * Create a plain (unencrypted) RexValue from raw bytes.
905
+ *
906
+ * @param data - The raw byte data
907
+ * @returns A new RexValue with Plain variant
908
+ */
909
+ static plain(data: Uint8Array): RexValue;
910
+ /**
911
+ * Create a plain (unencrypted) RexValue from a UTF-8 string.
912
+ *
913
+ * @param s - The string to encode
914
+ * @returns A new RexValue with Plain variant
915
+ */
916
+ static plainString(s: string): RexValue;
917
+ /**
918
+ * Create an encrypted RexValue from HPKE ciphertext.
919
+ *
920
+ * @param ciphertext - The HPKE-encrypted ciphertext (enc || ct || tag)
921
+ * @returns A new RexValue with Encrypted variant
922
+ */
923
+ static encrypted(ciphertext: Uint8Array): RexValue;
924
+ /**
925
+ * Check if this is a plain (unencrypted) value.
926
+ */
927
+ isPlain(): boolean;
928
+ /**
929
+ * Check if this is an encrypted value.
930
+ */
931
+ isEncrypted(): boolean;
932
+ /**
933
+ * Get the variant type.
934
+ */
935
+ getVariant(): RexValueVariant;
936
+ /**
937
+ * Get the raw bytes (plaintext or ciphertext).
938
+ *
939
+ * For Plain values, returns the plaintext.
940
+ * For Encrypted values, returns the ciphertext.
941
+ */
942
+ asBytes(): Uint8Array;
943
+ /**
944
+ * Try to decode the plain value as a UTF-8 string.
945
+ *
946
+ * @returns The decoded string, or null if encrypted or not valid UTF-8
947
+ */
948
+ asString(): string | null;
949
+ /**
950
+ * Serialize to Borsh format.
951
+ *
952
+ * Format: `[variant: u8] [length: u32 LE] [data bytes]`
953
+ *
954
+ * @returns The Borsh-serialized bytes
955
+ */
956
+ toBorsh(): Uint8Array;
957
+ /**
958
+ * Deserialize from Borsh format.
959
+ *
960
+ * @param data - The Borsh-serialized bytes
961
+ * @returns A new RexValue
962
+ * @throws {HpkeError} If deserialization fails
963
+ */
964
+ static fromBorsh(data: Uint8Array): RexValue;
764
965
  }
765
966
 
766
967
  /**
767
- * RPC type definitions for the Rialo blockchain.
968
+ * Encrypt data using HPKE for REX secret sharing.
969
+ *
970
+ * This function performs HPKE encryption using the Base mode with:
971
+ * - X25519 for key encapsulation
972
+ * - HKDF-SHA256 for key derivation
973
+ * - ChaCha20-Poly1305 for authenticated encryption
974
+ *
975
+ * The output format is: `enc (32 bytes) || ciphertext || tag (16 bytes)`
976
+ *
977
+ * @param rexPubkey - The REX X25519 public key (32 bytes)
978
+ * @param data - The plaintext data to encrypt
979
+ * @param senderPubkey - The sender's Ed25519 public key (32 bytes) for AAD construction
980
+ * @returns The encrypted ciphertext including enc and tag
981
+ * @throws {HpkeError} If key lengths are invalid or encryption fails
982
+ *
983
+ * @example
984
+ * ```typescript
985
+ * const rexPubkey = await client.getSecretSharingPubkey();
986
+ * const ciphertext = await hpkeEncrypt(
987
+ * rexPubkey,
988
+ * new TextEncoder().encode("secret data"),
989
+ * keypair.publicKey.toBytes()
990
+ * );
991
+ * ```
992
+ */
993
+ declare function hpkeEncrypt(rexPubkey: Uint8Array, data: Uint8Array, senderPubkey: Uint8Array): Promise<Uint8Array>;
994
+ /**
995
+ * Encrypt data for REX and wrap it in an RexValue.
996
+ *
997
+ * This is a convenience function that combines:
998
+ * 1. HPKE encryption using `hpkeEncrypt`
999
+ * 2. Wrapping the ciphertext in an `RexValue.encrypted`
1000
+ *
1001
+ * The resulting RexValue can be serialized to Borsh and sent to the network.
1002
+ *
1003
+ * @param rexPubkey - The REX X25519 public key (32 bytes)
1004
+ * @param data - The plaintext data to encrypt
1005
+ * @param senderPubkey - The sender's Ed25519 public key (32 bytes)
1006
+ * @returns An RexValue containing the encrypted ciphertext
1007
+ * @throws {HpkeError} If key lengths are invalid or encryption fails
1008
+ *
1009
+ * @example
1010
+ * ```typescript
1011
+ * import { RpcClient, Keypair } from "@rialo/ts-cdk";
1012
+ * import { encryptForRex, RexValue } from "@rialo/ts-cdk/rex";
1013
+ *
1014
+ * // Get REX public key from the network
1015
+ * const client = new RpcClient("https://rpc.rialo.xyz");
1016
+ * const rexPubkey = await client.getSecretSharingPubkey();
1017
+ *
1018
+ * // Create keypair for signing
1019
+ * const keypair = Keypair.generate();
1020
+ *
1021
+ * // Encrypt secret data
1022
+ * const rexValue = await encryptForRex(
1023
+ * rexPubkey,
1024
+ * new TextEncoder().encode("my secret API key"),
1025
+ * keypair.publicKey.toBytes()
1026
+ * );
1027
+ *
1028
+ * // The RexValue can now be serialized and used in transactions
1029
+ * const borshBytes = rexValue.toBorsh();
1030
+ * ```
1031
+ */
1032
+ declare function encryptForRex(rexPubkey: Uint8Array, data: Uint8Array, senderPubkey: Uint8Array): Promise<RexValue>;
1033
+ /**
1034
+ * Calculate the expected ciphertext length for a given plaintext length.
1035
+ *
1036
+ * The ciphertext consists of:
1037
+ * - enc (32 bytes): Encapsulated ephemeral public key
1038
+ * - ciphertext (plaintext.length bytes): Encrypted data
1039
+ * - tag (16 bytes): ChaCha20-Poly1305 authentication tag
1040
+ *
1041
+ * @param plaintextLength - Length of the plaintext in bytes
1042
+ * @returns Expected ciphertext length
1043
+ *
1044
+ * @example
1045
+ * ```typescript
1046
+ * const ciphertextLen = getCiphertextLength(100);
1047
+ * console.log(ciphertextLen); // 148 (32 + 100 + 16)
1048
+ * ```
1049
+ */
1050
+ declare function getCiphertextLength(plaintextLength: number): number;
1051
+ /**
1052
+ * Validate that a ciphertext has a valid length.
1053
+ *
1054
+ * A valid HPKE ciphertext must be at least 48 bytes (32 enc + 16 tag).
1055
+ *
1056
+ * @param ciphertext - The ciphertext to validate
1057
+ * @returns true if the ciphertext length is valid
1058
+ *
1059
+ * @example
1060
+ * ```typescript
1061
+ * if (!isValidCiphertextLength(ciphertext)) {
1062
+ * throw new Error("Ciphertext too short");
1063
+ * }
1064
+ * ```
768
1065
  */
1066
+ declare function isValidCiphertextLength(ciphertext: Uint8Array): boolean;
769
1067
 
1068
+ /** A 32-byte public key, base58-encoded on the wire. */
1069
+
1070
+ /** A 64-byte Ed25519 signature, base58-encoded on the wire. */
1071
+ type Signature = Uint8Array;
1072
+ /** A 32-byte hash, base58-encoded on the wire. */
1073
+ type Hash = Uint8Array;
1074
+ /** Smallest unit of the native token. */
1075
+ type Kelvin = bigint;
1076
+ /** First 64 bits of the config hash, used for replay protection. */
1077
+ type ConfigHashPrefix = bigint;
770
1078
  /**
771
- * Account information response.
1079
+ * Information about an on-chain account.
772
1080
  */
773
1081
  interface AccountInfo {
774
- /** Account balance in smallest denomination */
775
- balance: bigint;
776
- /** Owner program public key */
1082
+ /** Account balance in kelvins. */
1083
+ kelvin: Kelvin;
1084
+ /** Owner program public key. */
777
1085
  owner: PublicKey;
778
- /** Account data */
779
- data: Uint8Array;
780
- /** Whether the account is executable */
1086
+ /** Account data as encoded strings (typically [encoded_data, encoding_format]). */
1087
+ data: string[];
1088
+ /** Whether the account contains executable code. */
781
1089
  executable: boolean;
782
- /** Rent epoch */
1090
+ /** Rent epoch. */
783
1091
  rentEpoch: bigint;
1092
+ /** Account data size in bytes. */
1093
+ space: bigint;
784
1094
  }
785
1095
  /**
786
- * Transaction response.
1096
+ * A compiled instruction within a transaction message.
787
1097
  */
788
- interface TransactionResponse {
789
- /** Transaction signature */
790
- signature: string;
791
- /** Block height */
792
- blockHeight?: bigint;
793
- /** Error message if transaction failed */
1098
+ interface CompiledInstruction$1 {
1099
+ /** Index into the account keys array identifying the program. */
1100
+ programIdIndex: number;
1101
+ /** Indices into the account keys array for this instruction. */
1102
+ accounts: Uint8Array;
1103
+ /** Instruction data (base58-encoded on the wire). */
1104
+ data: string;
1105
+ }
1106
+ /**
1107
+ * Header of a transaction message.
1108
+ */
1109
+ interface MessageHeader$1 {
1110
+ /** Number of signatures required. */
1111
+ numRequiredSignatures: number;
1112
+ /** Number of read-only signed accounts. */
1113
+ numReadonlySignedAccounts: number;
1114
+ /** Number of read-only unsigned accounts. */
1115
+ numReadonlyUnsignedAccounts: number;
1116
+ }
1117
+ /**
1118
+ * The message portion of a transaction.
1119
+ */
1120
+ interface TransactionMessage {
1121
+ header: MessageHeader$1;
1122
+ accountKeys: PublicKey[];
1123
+ instructions: CompiledInstruction$1[];
1124
+ }
1125
+ /**
1126
+ * A full transaction (signatures + message).
1127
+ */
1128
+ interface TransactionData {
1129
+ signatures: Signature[];
1130
+ message: TransactionMessage;
1131
+ /** Timestamp from which the transaction is valid. */
1132
+ validFrom: bigint;
1133
+ }
1134
+ /**
1135
+ * Metadata about transaction execution.
1136
+ */
1137
+ interface TransactionStatusMetadata {
1138
+ /** Fee paid for the transaction in kelvins. */
1139
+ fee: bigint;
1140
+ /** Error message if the transaction failed, absent if successful. */
794
1141
  err?: string;
1142
+ /** Log messages emitted during execution (if available). */
1143
+ logMessages?: string[];
795
1144
  }
796
1145
  /**
797
- * Options for sending a transaction.
1146
+ * Full response for a transaction query.
798
1147
  */
799
- interface SendTransactionOptions {
800
- /** Skip preflight transaction checks */
801
- skipPreflight?: boolean;
802
- /** Maximum number of times to retry */
803
- maxRetries?: number;
1148
+ interface TransactionResponse {
1149
+ /** Block height where this transaction was processed. */
1150
+ blockHeight: bigint;
1151
+ /** Unix timestamp of the block (if available). */
1152
+ blockTime?: bigint;
1153
+ /** Execution metadata (fee, error). */
1154
+ meta: TransactionStatusMetadata;
1155
+ /** The full transaction content. */
1156
+ transaction: TransactionData;
1157
+ }
1158
+ /**
1159
+ * A transaction paired with its metadata (used in block responses).
1160
+ */
1161
+ interface TransactionWithMeta {
1162
+ /** The full transaction content. */
1163
+ transaction: TransactionData;
1164
+ /** Execution metadata (fee, error), absent if not available. */
1165
+ meta?: TransactionStatusMetadata;
1166
+ }
1167
+ /**
1168
+ * Status of a transaction signature.
1169
+ */
1170
+ interface SignatureStatus {
1171
+ /** Slot in which the transaction was processed. */
1172
+ slot: bigint;
1173
+ /** Whether the transaction has been executed. */
1174
+ executed: boolean;
1175
+ /** Error message if the transaction failed. */
1176
+ err?: string;
804
1177
  }
805
1178
  /**
806
- * Epoch information response.
1179
+ * Information about the current epoch.
807
1180
  */
808
- interface EpochInfoResponse {
809
- /** Current epoch */
1181
+ interface EpochInfo {
1182
+ /** Current epoch number. */
810
1183
  epoch: bigint;
811
- /** Current slot in the epoch */
1184
+ /** Current slot within the epoch. */
812
1185
  slotIndex: bigint;
813
- /** Total slots in the epoch */
1186
+ /** Total slots in the epoch. */
814
1187
  slotsInEpoch: bigint;
815
- /** Absolute slot number */
1188
+ /** Absolute slot number. */
816
1189
  absoluteSlot: bigint;
817
- /** Block height */
1190
+ /** Current block height. */
818
1191
  blockHeight: bigint;
819
- /** Transaction count */
1192
+ /** Total transaction count (if available). */
820
1193
  transactionCount?: bigint;
821
1194
  }
822
1195
  /**
823
- * Subscription kind.
1196
+ * Options for submitting a transaction.
1197
+ */
1198
+ interface SendTransactionOptions {
1199
+ /** Skip preflight simulation. */
1200
+ skipPreflight: boolean;
1201
+ /** Maximum retries by the RPC node. */
1202
+ maxRetries: number;
1203
+ /** Wait until the transaction has been executed before returning. */
1204
+ waitForExecution: boolean;
1205
+ }
1206
+ /**
1207
+ * Options for confirming a transaction.
1208
+ */
1209
+ interface ConfirmTransactionOptions {
1210
+ /** Maximum polling attempts (default: 30). */
1211
+ maxRetries: number;
1212
+ /** Delay between polls in milliseconds (default: 1000). */
1213
+ retryDelayMs: number;
1214
+ }
1215
+ /**
1216
+ * Combined options for send-and-confirm.
1217
+ */
1218
+ interface SendAndConfirmOptions {
1219
+ /** Send options. */
1220
+ skipPreflight: boolean;
1221
+ maxRetries: number;
1222
+ /** Confirm options. */
1223
+ confirmMaxRetries: number;
1224
+ confirmRetryDelayMs: number;
1225
+ }
1226
+ /**
1227
+ * Result of a confirmed transaction.
1228
+ */
1229
+ interface ConfirmedTransaction {
1230
+ /** Transaction signature (base58). */
1231
+ signature: string;
1232
+ /** Whether the transaction was executed. */
1233
+ executed: boolean;
1234
+ /** Error message if failed. */
1235
+ err?: string;
1236
+ }
1237
+ /**
1238
+ * Fee calculation response.
1239
+ */
1240
+ interface FeeResponse {
1241
+ /** The fee in kelvins, absent if message is invalid. */
1242
+ value?: bigint;
1243
+ }
1244
+ /**
1245
+ * Response from blockhash validation.
1246
+ */
1247
+ interface IsBlockhashValidResponse {
1248
+ /** Slot from the response context. */
1249
+ slot: bigint;
1250
+ /** Whether the blockhash is still valid. */
1251
+ isValid: boolean;
1252
+ }
1253
+ /**
1254
+ * Configuration for getSignaturesForAddress.
1255
+ */
1256
+ interface GetSignaturesForAddressConfig {
1257
+ /** Maximum number of signatures to return. */
1258
+ limit?: number;
1259
+ /** Search backwards from this signature (base58). */
1260
+ before?: string;
1261
+ /** Search forwards from this signature (base58). */
1262
+ until?: string;
1263
+ }
1264
+ /**
1265
+ * Information about a single signature.
1266
+ */
1267
+ interface SignatureInfo {
1268
+ /** Transaction signature (base58). */
1269
+ signature: string;
1270
+ /** Block height where the transaction was processed. */
1271
+ blockHeight: bigint;
1272
+ /** Unix timestamp of the block. */
1273
+ blockTime: bigint;
1274
+ /** Error message if the transaction failed. */
1275
+ err?: string;
1276
+ }
1277
+ /**
1278
+ * Kind of subscription.
824
1279
  */
825
1280
  type SubscriptionKind = "Persistent" | "OneShot";
826
1281
  /**
827
- * Subscription data.
1282
+ * Metadata about an account used in a subscription instruction.
1283
+ */
1284
+ interface SubscriptionAccountMeta {
1285
+ /** The account's public key (base58). */
1286
+ pubkey: string;
1287
+ /** Whether the account must sign the transaction. */
1288
+ isSigner: boolean;
1289
+ /** Whether the account can be written to during execution. */
1290
+ isWritable: boolean;
1291
+ }
1292
+ /**
1293
+ * A single instruction within a subscription.
1294
+ */
1295
+ interface SubscriptionInstruction {
1296
+ /** The program ID invoked (base58). */
1297
+ programId: string;
1298
+ /** Metadata for the accounts involved in the instruction. */
1299
+ accounts: SubscriptionAccountMeta[];
1300
+ /** Opaque binary data passed to the program. */
1301
+ data: Uint8Array;
1302
+ }
1303
+ /**
1304
+ * A subscription record.
828
1305
  */
829
1306
  interface Subscription {
830
- /** Type of subscription */
831
1307
  kind: SubscriptionKind;
832
- /** Topic for the subscription */
833
1308
  topic: string;
834
- /** Instructions to execute when triggered */
835
- instructions: unknown[];
836
- /** Subscriber public key (base58) */
1309
+ /** Instructions to be executed when triggered. */
1310
+ instructions: SubscriptionInstruction[];
837
1311
  subscriber: string;
838
- /** Event account public key (base58) */
1312
+ /** The account pubkey (base58) that stores the event data. */
839
1313
  eventAccount?: string;
840
- /** Timestamp range [start, end] */
1314
+ /** Timestamp range for triggering (start inclusive, end exclusive). */
841
1315
  timestampRange?: [bigint, bigint];
842
1316
  }
843
1317
  /**
844
- * Triggered transaction data.
1318
+ * A transaction triggered by a subscription.
845
1319
  */
846
1320
  interface TriggeredTransaction {
847
- /** Transaction signature (base58) */
1321
+ /** Transaction signature (base58). */
848
1322
  signature: string;
849
- /** Block number where the transaction was executed */
1323
+ /** Block number where executed. */
850
1324
  blockNumber: bigint;
851
1325
  }
852
- /**
853
- * Get workflow lineage request.
854
- */
855
- interface GetWorkflowLineageRequest {
856
- /** Root transaction signature (base58) */
857
- signature: string;
858
- /** Maximum depth to traverse (1-100, default 3) */
859
- maxDepth?: number;
860
- /** Whether to include event details */
861
- includeEvents?: boolean;
862
- }
863
1326
  /**
864
1327
  * Event data from a workflow trigger.
865
1328
  */
866
1329
  interface EventData {
867
- /** Event topic */
868
1330
  topic: string;
869
- /** Event attributes */
870
- attributes: Record<string, unknown>;
871
1331
  }
872
1332
  /**
873
1333
  * Timestamp range.
874
1334
  */
875
1335
  interface TimestampRange {
876
- /** Start timestamp (unix) */
877
- from: bigint;
878
- /** End timestamp (unix) */
879
- to: bigint;
1336
+ start: bigint;
1337
+ end: bigint;
880
1338
  }
881
1339
  /**
882
1340
  * Information about what triggered a workflow transaction.
883
1341
  */
884
1342
  interface TriggerInfo {
885
- /** Event that triggered the transaction */
886
1343
  event: EventData;
887
- /** Subscription public key (base58) */
888
1344
  subscriptionPubkey: string;
889
- /** Timestamp range for the trigger */
890
1345
  timestampRange?: TimestampRange;
891
- /** Event account public key (base58) */
892
1346
  eventAccount?: string;
893
1347
  }
894
1348
  /**
895
- * Transaction node data within a workflow.
1349
+ * Transaction data within a workflow node.
896
1350
  */
897
1351
  interface TransactionNodeData {
898
- /** Block height */
899
1352
  blockHeight: bigint;
900
- /** Timestamp (unix) */
901
1353
  timestamp: bigint;
902
- /** Whether the transaction succeeded */
903
1354
  success: boolean;
904
- /** Number of instructions */
905
1355
  instructionCount: number;
906
- /** Program IDs of instructions (base58) */
907
1356
  instructionProgramIds: string[];
908
1357
  }
909
1358
  /**
910
1359
  * A node in the workflow lineage tree.
911
1360
  */
912
1361
  interface WorkflowNode {
913
- /** Transaction signature (base58) */
1362
+ /** Transaction signature (base58). */
914
1363
  id: string;
915
- /** Distance from root transaction */
1364
+ /** Distance from the root transaction. */
916
1365
  depth: number;
917
- /** Transaction data */
1366
+ /** Transaction data. */
918
1367
  data: TransactionNodeData;
919
- /** Subscriptions on this transaction */
1368
+ /** Subscriptions associated with this transaction. */
920
1369
  subscriptions: Subscription[];
921
- /** What triggered this transaction */
1370
+ /** Trigger information if this node was triggered by a subscription event. */
922
1371
  triggeredBy?: TriggerInfo;
923
- /** Child transaction signatures (base58) */
1372
+ /** Child transaction signatures. */
924
1373
  workflowChildren: string[];
925
- /** Whether there are more children not shown */
1374
+ /** Whether more children exist beyond what is shown. */
926
1375
  hasMoreChildren: boolean;
927
1376
  }
928
1377
  /**
929
- * Workflow lineage tree.
1378
+ * Reason for truncating workflow traversal.
930
1379
  */
931
- interface WorkflowLineage {
932
- /** Nodes in the workflow tree */
933
- workflowNodes: WorkflowNode[];
1380
+ type TruncationReason = "maxDepth" | "maxNodes" | "none";
1381
+ /**
1382
+ * Workflow lineage request parameters.
1383
+ */
1384
+ interface GetWorkflowLineageRequest {
1385
+ /** Root transaction signature (base58). */
1386
+ signature: string;
1387
+ /** Maximum traversal depth (1-100, default 3). */
1388
+ maxDepth?: number;
1389
+ /** Whether to include event details. */
1390
+ includeEvents?: boolean;
934
1391
  }
935
1392
  /**
936
- * Reason for truncating workflow lineage traversal.
1393
+ * Workflow lineage response.
1394
+ * The lineage tree structure.
937
1395
  */
938
- type TruncationReason = "MaxDepth" | "MaxNodes" | "None";
1396
+ interface WorkflowLineage {
1397
+ /** All nodes (transactions) in the lineage tree. */
1398
+ workflowNodes: WorkflowNode[];
1399
+ }
939
1400
  /**
940
- * Get workflow lineage response.
1401
+ * Workflow lineage response.
941
1402
  */
942
1403
  interface GetWorkflowLineageResponse {
943
- /** Workflow lineage tree */
1404
+ /** The lineage graph data. */
944
1405
  lineage: WorkflowLineage;
945
- /** Leaf transaction signatures (base58) */
1406
+ /** Leaf transaction signatures (base58-encoded). */
946
1407
  leaves: string[];
947
- /** Whether traversal was truncated */
1408
+ /** Whether the traversal was truncated due to max-depth. */
948
1409
  truncated: boolean;
949
- /** Reason for truncation */
1410
+ /** The reason for truncation. */
950
1411
  truncationReason: TruncationReason;
951
- /** Hints for continuing traversal (base58 signatures) */
1412
+ /** Hints for continuation (base58-encoded). */
952
1413
  continuationHints: string[];
953
1414
  }
954
1415
  /**
955
- * Get signatures for address configuration.
1416
+ * Configuration for paginated transaction queries.
956
1417
  */
957
- interface GetSignaturesForAddressConfig {
958
- /** Maximum number of signatures to return */
1418
+ interface GetTransactionsConfig {
1419
+ /** Maximum number of transactions to return. */
959
1420
  limit?: number;
960
- /** Start searching backwards from this signature */
1421
+ /** Cursor for pagination. */
961
1422
  before?: string;
962
- /** Start searching forwards from this signature */
963
- until?: string;
964
1423
  }
965
1424
  /**
966
- * Signature information.
1425
+ * Brief info about a transaction in a paginated list.
967
1426
  */
968
- interface SignatureInfo {
1427
+ interface TransactionInfo {
1428
+ /** Transaction signature (base58). */
969
1429
  signature: string;
970
- blockHeight: bigint;
971
- blockTime: bigint;
1430
+ /** Slot where the transaction was processed. */
1431
+ slot: bigint;
1432
+ /** Block time (unix timestamp). */
1433
+ blockTime?: bigint;
1434
+ /** Error message if failed. */
972
1435
  err?: string;
1436
+ /** Transaction version. */
1437
+ version?: string;
973
1438
  }
974
1439
  /**
975
- * Get health response.
1440
+ * Filter for what kind of accounts to return.
976
1441
  */
977
- type GetHealthResponse = "ok" | string;
1442
+ type AccountFilter = "programAccounts" | "tokenAccounts";
978
1443
  /**
979
- * Get transactions response.
1444
+ * Configuration for getAccountsByOwner pagination.
980
1445
  */
981
- interface GetTransactionsResponse {
982
- /** Array of transaction data */
983
- transactions: Array<Record<string, unknown>>;
1446
+ interface GetAccountsByOwnerConfig {
1447
+ /** Maximum number of accounts to return. */
1448
+ limit?: number;
1449
+ /** Cursor for pagination: accounts after this pubkey (base58). */
1450
+ after?: string;
984
1451
  }
985
1452
  /**
986
- * Signature status from the RPC.
1453
+ * An account returned by getAccountsByOwner.
987
1454
  */
988
- interface SignatureStatus {
989
- /** Slot in which the transaction was processed */
990
- slot: bigint;
991
- /** Whether the transaction has been executed */
992
- executed: boolean;
993
- /** Error message if transaction failed */
994
- err?: string;
995
- }
996
- /**
997
- * Options for confirming a transaction.
1455
+ interface OwnerAccount {
1456
+ /** Account public key. */
1457
+ pubkey: PublicKey;
1458
+ /** Account information. */
1459
+ account: AccountInfo;
1460
+ }
1461
+ /**
1462
+ * Pagination metadata.
998
1463
  */
999
- interface ConfirmTransactionOptions {
1000
- /** Maximum number of retry attempts (default: 30) */
1001
- maxRetries?: number;
1002
- /** Delay between retries in milliseconds (default: 1000) */
1003
- retryDelay?: number;
1464
+ interface PaginationInfo {
1465
+ hasMore: boolean;
1466
+ nextCursor?: string;
1004
1467
  }
1468
+ /** A single entry in a getMultipleAccounts response.
1469
+ Absent if the account does not exist. */
1470
+ type OptionalAccountInfo = AccountInfo | undefined;
1005
1471
  /**
1006
- * Options for sending and confirming a transaction.
1472
+ * Validator health status.
1007
1473
  */
1008
- interface SendAndConfirmOptions extends SendTransactionOptions, ConfirmTransactionOptions {
1474
+ interface ValidatorHealth {
1475
+ status: string;
1009
1476
  }
1010
1477
  /**
1011
- * Result of a confirmed transaction.
1478
+ * Connected full node info.
1012
1479
  */
1013
- interface ConfirmedTransaction {
1014
- /** Transaction signature */
1015
- signature: string;
1016
- /** Whether the transaction was executed */
1017
- executed: boolean;
1018
- /** Error message if transaction failed */
1019
- err?: string;
1480
+ interface ConnectedNode {
1481
+ /** Network public key (hex or base58). */
1482
+ publicKey: string;
1483
+ /** Connection duration in milliseconds. */
1484
+ connectedMs: bigint;
1020
1485
  }
1021
1486
  /**
1022
- * Configuration for getAccountsByOwner.
1487
+ * The TEE's X25519 public key for HPKE encryption.
1023
1488
  */
1024
- interface GetAccountsByOwnerConfig {
1025
- /** Maximum number of accounts to return */
1026
- limit?: number;
1027
- /** Cursor for pagination (base58 pubkey) */
1028
- after?: string;
1489
+ interface SecretSharingPubkey {
1490
+ /** Hex-encoded public key. */
1491
+ publicKey: string;
1029
1492
  }
1030
1493
  /**
1031
- * Filter for getAccountsByOwner.
1032
- * Matches Rust serde serialization format.
1494
+ * Request to submit an epoch change (admin-only).
1495
+ * Validator information for epoch change requests.
1033
1496
  */
1034
- type AccountFilter = {
1035
- type: "programAccounts";
1036
- } | {
1037
- type: "tokenAccounts";
1038
- mint?: string;
1039
- };
1497
+ interface ValidatorInfoRequest {
1498
+ /** Validator stake amount. */
1499
+ stake: bigint;
1500
+ /** Consensus network address (Multiaddr string). */
1501
+ consensusAddress: string;
1502
+ /** State sync network address (Multiaddr string). */
1503
+ stateSyncAddress: string;
1504
+ /** Validator hostname. */
1505
+ hostname: string;
1506
+ /** Authority public key. */
1507
+ authorityKey: string;
1508
+ /** Protocol public key. */
1509
+ protocolKey: string;
1510
+ /** Network public key. */
1511
+ networkKey: string;
1512
+ /** Signing public key. */
1513
+ signingKey: string;
1514
+ }
1040
1515
  /**
1041
- * An account owned by a program or address.
1516
+ * Consensus configuration parameters for an epoch change.
1042
1517
  */
1043
- interface OwnerAccount {
1044
- /** Account public key */
1045
- pubkey: PublicKey;
1046
- /** Account information */
1518
+ interface EpochConsensusConfigRequest {
1519
+ /** Number of leaders per round. */
1520
+ numLeadersPerRound?: number;
1521
+ /** Maximum transaction bytes per block. */
1522
+ maxTransactionsInBlockBytes?: bigint;
1523
+ /** Maximum number of transactions per block. */
1524
+ maxNumTransactionsInBlock?: bigint;
1525
+ /** Maximum size of a single transaction in bytes. */
1526
+ maxTransactionSizeBytes?: bigint;
1527
+ /** Garbage collection depth. */
1528
+ gcDepth?: number;
1529
+ /** Whether to enable zstd compression. */
1530
+ zstdCompression?: boolean;
1531
+ }
1532
+ /**
1533
+ * Request to submit an epoch change (admin-only).
1534
+ */
1535
+ interface SubmitEpochChangeRequest {
1536
+ /** The new epoch number. */
1537
+ newEpoch: bigint;
1538
+ /** List of validators for the new epoch. */
1539
+ validators: ValidatorInfoRequest[];
1540
+ /** Optional consensus configuration overrides. */
1541
+ consensusConfig?: EpochConsensusConfigRequest;
1542
+ }
1543
+ /**
1544
+ * Response from submitting an epoch change.
1545
+ */
1546
+ interface SubmitEpochChangeResponse {
1547
+ /** Whether the submission was accepted. */
1548
+ success: boolean;
1549
+ }
1550
+ /**
1551
+ * Configuration for block queries.
1552
+ */
1553
+ interface GetBlockConfig {
1554
+ /** Transaction detail level: "full", "signatures", or "none".
1555
+ Default: "full". */
1556
+ transactionDetails?: string;
1557
+ }
1558
+ /**
1559
+ * Information about a block.
1560
+ */
1561
+ interface BlockInfo {
1562
+ /** The blockhash (base58). */
1563
+ blockhash: string;
1564
+ /** Block height. */
1565
+ blockHeight: bigint;
1566
+ /** Unix timestamp of the block. */
1567
+ blockTime: bigint;
1568
+ /** Full transactions with metadata (present when transaction-details = "full"). */
1569
+ transactions?: TransactionWithMeta[];
1570
+ /** Transaction signatures only (present when transaction-details = "signatures"). */
1571
+ signatures?: string[];
1572
+ }
1573
+ /**
1574
+ * Configuration for getAllAccounts.
1575
+ */
1576
+ interface GetAllAccountsConfig {
1577
+ /** Encoding for account data (e.g. "base64"). */
1578
+ encoding?: string;
1579
+ /** Whether to include account data in the response. */
1580
+ includeData?: boolean;
1581
+ }
1582
+ /**
1583
+ * An entry in the getAllAccounts response.
1584
+ */
1585
+ interface AllAccountsEntry {
1586
+ /** Account public key (base58). */
1587
+ pubkey: string;
1588
+ /** Account information. */
1047
1589
  account: AccountInfo;
1048
1590
  }
1049
1591
  /**
1050
- * Pagination information.
1592
+ * State of a stake account.
1051
1593
  */
1052
- interface PaginationInfo {
1053
- /** Whether there are more results */
1054
- hasMore: boolean;
1055
- /** Cursor for next page (base58 pubkey) */
1056
- nextCursor?: string;
1594
+ type StakeState = "inactive" | "activating" | "active" | "deactivating" | "unbonding";
1595
+ /**
1596
+ * Information about a stake account.
1597
+ */
1598
+ interface StakeAccountInfo {
1599
+ /** Current state of the stake account. */
1600
+ state: StakeState;
1601
+ /** Total kelvins in the account. */
1602
+ kelvins: bigint;
1603
+ /** Amount delegated to validator (0 when inactive). */
1604
+ delegatedBalance: bigint;
1605
+ /** Undelegated amount. */
1606
+ undelegatedBalance: bigint;
1607
+ /** Unix timestamp (ms) when ActivateStake was called. */
1608
+ activationRequested?: bigint;
1609
+ /** Unix timestamp (ms) when DeactivateStake was called. */
1610
+ deactivationRequested?: bigint;
1611
+ /** Validator info account (base58), absent if not delegated. */
1612
+ validator?: string;
1613
+ /** Admin authority (hot wallet, base58). */
1614
+ adminAuthority: string;
1615
+ /** Withdraw authority (cold wallet, base58). */
1616
+ withdrawAuthority: string;
1617
+ }
1618
+ /**
1619
+ * Request parameters for getValidatorAccounts.
1620
+ */
1621
+ interface GetValidatorAccountsRequest {
1622
+ /** If true, return from last frozen epoch; if false, return from pending. */
1623
+ useFrozen: boolean;
1624
+ }
1625
+ /**
1626
+ * Information about a validator account.
1627
+ */
1628
+ interface ValidatorAccountInfo {
1629
+ /** Accumulated commission (kelvins) in the validator account. */
1630
+ commission: bigint;
1631
+ /** Public key of the validator info account (base58). */
1632
+ pubkey: string;
1633
+ /** Node's public key / initial authorized withdrawer (base58). */
1634
+ nodeIdentity: string;
1635
+ /** Authority who can withdraw rewards (base58). */
1636
+ authorizedWithdrawer: string;
1637
+ /** Amount of token staked for next epoch. */
1638
+ stakeNext: bigint;
1639
+ /** Amount of token staked for current epoch (from last frozen snapshot). */
1640
+ stakeCurrent?: bigint;
1641
+ /** Network address for communicating with the validator. */
1642
+ address: string;
1643
+ }
1644
+ /**
1645
+ * SPL Token account balance information.
1646
+ */
1647
+ interface TokenBalance {
1648
+ /** Raw token amount as string. */
1649
+ amount: string;
1650
+ /** Number of decimals for the token. */
1651
+ decimals: number;
1652
+ /** Human-readable amount string. */
1653
+ uiAmountString: string;
1654
+ }
1655
+ /**
1656
+ * Information about a node in the cluster.
1657
+ */
1658
+ interface ClusterNodeInfo {
1659
+ /** Stake amount in kelvins. */
1660
+ stake: bigint;
1661
+ /** Network address. */
1662
+ address: string;
1663
+ /** Hostname of the node. */
1664
+ hostname: string;
1665
+ /** Authority public key (base58). */
1666
+ authorityPubkey: string;
1667
+ /** Protocol public key (base58). */
1668
+ protocolPubkey: string;
1669
+ /** Network public key (base58). */
1670
+ networkPubkey: string;
1671
+ /** Last committed consensus round (if available). */
1672
+ lastCommittedRound?: number;
1673
+ }
1674
+ /**
1675
+ * A single REX duty assignment.
1676
+ */
1677
+ interface RexDuty {
1678
+ /** Target timestamp for the duty. */
1679
+ targetTimestamp: string;
1680
+ /** Validators assigned to this duty (base58 pubkeys). */
1681
+ assignedValidators: string[];
1682
+ }
1683
+ /**
1684
+ * Information about a REX request and its duties.
1685
+ */
1686
+ interface RexInfoAndDuties {
1687
+ /** Pubkey of account that created the REX (base58). */
1688
+ creator: string;
1689
+ /** Hex representation of the REX's nonce. */
1690
+ nonce: string;
1691
+ /** Whether the REX is currently active. */
1692
+ isActive: boolean;
1693
+ /** Description of the REX request. */
1694
+ description: string;
1695
+ /** Update frequency. */
1696
+ updateFrequency: string;
1697
+ /** Starting timestamp. */
1698
+ startingTimestamp: string;
1699
+ /** Creation timestamp. */
1700
+ createdAt: string;
1701
+ /** Number of validators per duty. */
1702
+ validatorsPerDuty: number;
1703
+ /** Delay in milliseconds for REX request processing. */
1704
+ rexRequestDelayMs: bigint;
1705
+ /** List of duties expecting updates or commitment. */
1706
+ duties: RexDuty[];
1707
+ }
1708
+
1709
+ /**
1710
+ * Base client with JSON-RPC protocol handling.
1711
+ *
1712
+ * All specific clients (QueryClient, TransactionClient) extend this.
1713
+ */
1714
+ declare class BaseRpcClient {
1715
+ protected readonly transport: HttpTransport;
1716
+ private requestId;
1717
+ constructor(transport: HttpTransport);
1718
+ /**
1719
+ * Makes a JSON-RPC 2.0 method call with type safety.
1720
+ *
1721
+ * Handles request serialization, response validation, and error mapping.
1722
+ */
1723
+ call<T>(method: string, params?: unknown[]): Promise<T>;
1724
+ /**
1725
+ * Validate JSON-RPC response structure
1726
+ */
1727
+ private isValidJsonRpcResponse;
1728
+ /**
1729
+ * Generates the next request ID with Overflow Protection.
1730
+ * @returns The next request ID.
1731
+ */
1732
+ private nextRequestId;
1733
+ /**
1734
+ * Returns the configured RPC endpoint URL.
1735
+ */
1736
+ getUrl(): string;
1737
+ /**
1738
+ * Call an arbitrary RPC method with a JSON string body.
1739
+ *
1740
+ * Escape hatch for methods not yet in the typed interface.
1741
+ *
1742
+ * @param method - The RPC method name
1743
+ * @param params - JSON string of parameters
1744
+ * @returns JSON string of the result
1745
+ */
1746
+ callWithJson(method: string, params: string): Promise<string>;
1057
1747
  }
1748
+
1058
1749
  /**
1059
- * Get accounts by owner response.
1750
+ * RpcClient interface generated from spec.wit.
1751
+ *
1752
+ * Every method corresponds to a function in the `rpc-client` interface.
1060
1753
  */
1061
- interface GetAccountsByOwnerResponse {
1062
- /** Array of owned accounts */
1063
- value: OwnerAccount[];
1064
- /** Pagination information */
1065
- pagination?: PaginationInfo;
1754
+ declare abstract class RpcClient {
1755
+ /**
1756
+ * Gets the balance of an account in kelvins.
1757
+ *
1758
+ * # Parameters
1759
+ *
1760
+ * * `pubkey` - The public key (address) of the account to query.
1761
+ *
1762
+ * # Returns
1763
+ *
1764
+ * The account balance in the smallest denomination of the native token (kelvins).
1765
+ *
1766
+ * # Errors
1767
+ *
1768
+ * Returns an error if the RPC call fails or the account does not exist.
1769
+ */
1770
+ abstract getBalance(pubkey: PublicKey): Promise<Kelvin>;
1771
+ /**
1772
+ * Gets detailed information about an on-chain account.
1773
+ *
1774
+ * # Parameters
1775
+ *
1776
+ * * `pubkey` - The public key (address) of the account to query.
1777
+ *
1778
+ * # Returns
1779
+ *
1780
+ * Detailed account information including balance, owner, data, and executable flag.
1781
+ *
1782
+ * # Errors
1783
+ *
1784
+ * Returns an error if the RPC call fails or the account does not exist.
1785
+ */
1786
+ abstract getAccountInfo(pubkey: PublicKey): Promise<AccountInfo>;
1787
+ /**
1788
+ * Gets the current finalized block height from the blockchain.
1789
+ *
1790
+ * The block height represents the number of blocks produced since genesis.
1791
+ * Always returns the finalized block height for consistency.
1792
+ *
1793
+ * # Returns
1794
+ *
1795
+ * The current finalized block height.
1796
+ *
1797
+ * # Errors
1798
+ *
1799
+ * Returns an error if the RPC call fails.
1800
+ */
1801
+ abstract getBlockHeight(): Promise<bigint>;
1802
+ /**
1803
+ * Gets the current finalized block height with advanced configuration.
1804
+ *
1805
+ * Provides access to advanced parameters for block height retrieval,
1806
+ * specifically minimum context slot requirements.
1807
+ *
1808
+ * # Parameters
1809
+ *
1810
+ * * `min-context-slot` - The minimum context slot that the server must have
1811
+ * reached before responding. If absent, no minimum is required.
1812
+ *
1813
+ * # Returns
1814
+ *
1815
+ * The current finalized block height.
1816
+ *
1817
+ * # Errors
1818
+ *
1819
+ * Returns an error if the RPC call fails.
1820
+ */
1821
+ abstract getBlockHeightWithConfig(minContextSlot: bigint | undefined): Promise<bigint>;
1822
+ /**
1823
+ * Gets detailed information about a transaction by its signature.
1824
+ *
1825
+ * # Parameters
1826
+ *
1827
+ * * `sig` - The transaction signature to look up.
1828
+ *
1829
+ * # Returns
1830
+ *
1831
+ * Full transaction details including block height, block hash, timestamp,
1832
+ * execution metadata (fee, errors), and the transaction content.
1833
+ *
1834
+ * # Errors
1835
+ *
1836
+ * Returns an error if the RPC call fails or the transaction is not found.
1837
+ */
1838
+ abstract getTransaction(sig: Signature): Promise<TransactionResponse>;
1839
+ /**
1840
+ * Gets the total number of transactions processed since genesis.
1841
+ *
1842
+ * # Returns
1843
+ *
1844
+ * The total transaction count.
1845
+ *
1846
+ * # Errors
1847
+ *
1848
+ * Returns an error if the RPC call fails.
1849
+ */
1850
+ abstract getTransactionCount(): Promise<bigint>;
1851
+ /**
1852
+ * Calculates the minimum balance required for rent exemption.
1853
+ *
1854
+ * Accounts with at least this balance are exempt from paying rent.
1855
+ *
1856
+ * # Parameters
1857
+ *
1858
+ * * `data-size` - The size of the account data in bytes.
1859
+ *
1860
+ * # Returns
1861
+ *
1862
+ * The minimum balance (in kelvins) required for rent exemption.
1863
+ *
1864
+ * # Errors
1865
+ *
1866
+ * Returns an error if the RPC call fails.
1867
+ */
1868
+ abstract getMinimumBalanceForRentExemption(dataSize: bigint): Promise<bigint>;
1869
+ /**
1870
+ * Gets the status of multiple transaction signatures.
1871
+ *
1872
+ * # Parameters
1873
+ *
1874
+ * * `signatures` - A list of transaction signatures to query.
1875
+ *
1876
+ * # Returns
1877
+ *
1878
+ * A list of signature statuses (slot, executed, error) corresponding
1879
+ * to the input signatures.
1880
+ *
1881
+ * # Errors
1882
+ *
1883
+ * Returns an error if the RPC call fails.
1884
+ */
1885
+ abstract getSignatureStatuses(signatures: Signature[]): Promise<(SignatureStatus | undefined)[]>;
1886
+ /**
1887
+ * Gets signatures associated with an address, with optional pagination.
1888
+ *
1889
+ * # Parameters
1890
+ *
1891
+ * * `address` - The address to query signatures for.
1892
+ * * `config` - Optional configuration for pagination (limit, before, until).
1893
+ *
1894
+ * # Returns
1895
+ *
1896
+ * A list of signature info records for the given address.
1897
+ *
1898
+ * # Errors
1899
+ *
1900
+ * Returns an error if the RPC call fails.
1901
+ */
1902
+ abstract getSignaturesForAddress(address: PublicKey, config: GetSignaturesForAddressConfig | undefined): Promise<SignatureInfo[]>;
1903
+ /**
1904
+ * Gets current epoch information.
1905
+ *
1906
+ * # Returns
1907
+ *
1908
+ * Epoch information including epoch number, slot indices, block height,
1909
+ * and transaction count.
1910
+ *
1911
+ * # Errors
1912
+ *
1913
+ * Returns an error if the RPC call fails.
1914
+ */
1915
+ abstract getEpochInfo(): Promise<EpochInfo>;
1916
+ /**
1917
+ * Gets the fee for a given serialized message.
1918
+ *
1919
+ * # Parameters
1920
+ *
1921
+ * * `message` - The base64-encoded serialized message to calculate fees for.
1922
+ *
1923
+ * # Returns
1924
+ *
1925
+ * A fee response containing the fee in kelvins, or absent if the message
1926
+ * is invalid.
1927
+ *
1928
+ * # Errors
1929
+ *
1930
+ * Returns an error if the RPC call fails.
1931
+ */
1932
+ abstract getFeeForMessage(message: string): Promise<FeeResponse>;
1933
+ /**
1934
+ * Gets information for multiple accounts in a single request.
1935
+ *
1936
+ * # Parameters
1937
+ *
1938
+ * * `pubkeys` - A list of public keys to query.
1939
+ *
1940
+ * # Returns
1941
+ *
1942
+ * A list of optional account info records. Each entry is absent if that
1943
+ * account does not exist.
1944
+ *
1945
+ * # Errors
1946
+ *
1947
+ * Returns an error if the RPC call fails.
1948
+ */
1949
+ abstract getMultipleAccounts(pubkeys: PublicKey[]): Promise<OptionalAccountInfo[]>;
1950
+ /**
1951
+ * Gets accounts owned by a given program or address.
1952
+ *
1953
+ * Returns all accounts whose owner matches the specified public key,
1954
+ * along with optional pagination metadata.
1955
+ *
1956
+ * # Parameters
1957
+ *
1958
+ * * `owner` - The public key of the owner/program to query accounts for.
1959
+ * * `filter` - Optional filter to specify account type (program accounts
1960
+ * or token accounts). Defaults to program-accounts if absent.
1961
+ * * `config` - Optional pagination configuration (limit, after cursor).
1962
+ *
1963
+ * # Returns
1964
+ *
1965
+ * A tuple of (accounts list, optional pagination info).
1966
+ *
1967
+ * # Errors
1968
+ *
1969
+ * Returns an error if the RPC call fails.
1970
+ */
1971
+ abstract getAccountsByOwner(owner: PublicKey, filter: AccountFilter | undefined, config: GetAccountsByOwnerConfig | undefined): Promise<[OwnerAccount[], PaginationInfo | undefined]>;
1972
+ /**
1973
+ * Gets a subscription by subscriber public key and nonce.
1974
+ *
1975
+ * # Parameters
1976
+ *
1977
+ * * `subscriber` - The public key of the subscriber.
1978
+ * * `nonce` - The nonce identifying the specific subscription.
1979
+ *
1980
+ * # Returns
1981
+ *
1982
+ * The subscription record (kind, topic, subscriber, event-account).
1983
+ *
1984
+ * # Errors
1985
+ *
1986
+ * Returns an error if the RPC call fails or the subscription is not found.
1987
+ */
1988
+ abstract getSubscription(subscriber: PublicKey, nonce: string): Promise<Subscription>;
1989
+ /**
1990
+ * Gets transactions triggered by a subscription.
1991
+ *
1992
+ * Returns transactions that were automatically triggered in response to
1993
+ * subscription matches or other programmatic conditions.
1994
+ *
1995
+ * # Parameters
1996
+ *
1997
+ * * `subscription-account` - The public key of the subscription account.
1998
+ * * `limit` - Optional maximum number of transactions to return.
1999
+ *
2000
+ * # Returns
2001
+ *
2002
+ * A list of triggered transaction records (signature, block number).
2003
+ *
2004
+ * # Errors
2005
+ *
2006
+ * Returns an error if the RPC call fails.
2007
+ */
2008
+ abstract getTriggeredTransactions(subscriptionAccount: PublicKey, limit: number | undefined): Promise<TriggeredTransaction[]>;
2009
+ /**
2010
+ * Gets the workflow lineage tree for a transaction.
2011
+ *
2012
+ * Traverses the chain of workflow-triggered transactions starting from
2013
+ * a root transaction, building a tree of parent-child relationships.
2014
+ *
2015
+ * # Parameters
2016
+ *
2017
+ * * `request` - The lineage request including root signature, max depth,
2018
+ * and whether to include event details.
2019
+ *
2020
+ * # Returns
2021
+ *
2022
+ * The workflow lineage response with nodes, leaves, and truncation info.
2023
+ *
2024
+ * # Errors
2025
+ *
2026
+ * Returns an error if the RPC call fails or the root transaction is not found.
2027
+ */
2028
+ abstract getWorkflowLineage(request: GetWorkflowLineageRequest): Promise<GetWorkflowLineageResponse>;
2029
+ /**
2030
+ * Gets paginated transactions from the blockchain.
2031
+ *
2032
+ * Returns a list of transactions, optionally filtered and paginated.
2033
+ * Useful for transaction monitoring, analytics, and debugging.
2034
+ *
2035
+ * # Parameters
2036
+ *
2037
+ * * `config` - Optional configuration for pagination (limit, before cursor).
2038
+ * If absent, defaults apply (limit: 100).
2039
+ *
2040
+ * # Returns
2041
+ *
2042
+ * A list of transaction info records with signatures, slots, block times,
2043
+ * and error status.
2044
+ *
2045
+ * # Errors
2046
+ *
2047
+ * Returns an error if the RPC call fails.
2048
+ */
2049
+ abstract getTransactions(config: GetTransactionsConfig | undefined): Promise<TransactionInfo[]>;
2050
+ /**
2051
+ * Checks if a blockhash is still valid for transaction submission.
2052
+ *
2053
+ * # Parameters
2054
+ *
2055
+ * * `blockhash` - The blockhash to validate.
2056
+ *
2057
+ * # Returns
2058
+ *
2059
+ * `true` if the blockhash is still valid, `false` otherwise.
2060
+ *
2061
+ * # Errors
2062
+ *
2063
+ * Returns an error if the RPC call fails.
2064
+ */
2065
+ abstract isBlockhashValid(blockhash: Hash): Promise<IsBlockhashValidResponse>;
2066
+ /**
2067
+ * Gets the health status of the RPC node.
2068
+ *
2069
+ * # Returns
2070
+ *
2071
+ * A health status string, typically "ok" when the node is healthy.
2072
+ *
2073
+ * # Errors
2074
+ *
2075
+ * Returns an error if the RPC call fails or the node is unhealthy.
2076
+ */
2077
+ abstract getHealth(): Promise<string>;
2078
+ /**
2079
+ * Gets the health status of the validator.
2080
+ *
2081
+ * # Returns
2082
+ *
2083
+ * The validator health status record.
2084
+ *
2085
+ * # Errors
2086
+ *
2087
+ * Returns an error if the RPC call fails.
2088
+ */
2089
+ abstract getValidatorHealth(): Promise<ValidatorHealth>;
2090
+ /**
2091
+ * Gets the list of full nodes connected to the validator or full node.
2092
+ *
2093
+ * # Returns
2094
+ *
2095
+ * A list of connected nodes, each identified by a network public key
2096
+ * and connection duration in milliseconds.
2097
+ *
2098
+ * # Errors
2099
+ *
2100
+ * Returns an error if the RPC call fails.
2101
+ */
2102
+ abstract getConnectedFullNodes(): Promise<ConnectedNode[]>;
2103
+ /**
2104
+ * Gets the TEE's secret sharing public key for HPKE encryption.
2105
+ *
2106
+ * This public key is used to encrypt secrets that only the TEE cluster
2107
+ * can decrypt.
2108
+ *
2109
+ * # Returns
2110
+ *
2111
+ * The X25519 public key (hex-encoded) used for HPKE encryption.
2112
+ *
2113
+ * # Errors
2114
+ *
2115
+ * Returns an error if the RPC call fails, the TEE Registry state account
2116
+ * doesn't exist, or the secret sharing public key has not been registered.
2117
+ */
2118
+ abstract getSecretSharingPubkey(): Promise<SecretSharingPubkey>;
2119
+ /**
2120
+ * Gets the config hash prefix for protecting against replay attacks.
2121
+ *
2122
+ * Retrieves the first 64 bits of the config hash, which is used for
2123
+ * transaction replay protection across chains.
2124
+ *
2125
+ * # Returns
2126
+ *
2127
+ * The config hash prefix as a u64 value.
2128
+ *
2129
+ * # Errors
2130
+ *
2131
+ * Returns an error if the RPC call fails.
2132
+ */
2133
+ abstract getConfigHashPrefix(): Promise<ConfigHashPrefix>;
2134
+ /**
2135
+ * Gets all accounts in the system.
2136
+ *
2137
+ * **Warning:** This can be very expensive on large networks. Intended
2138
+ * primarily for testing and debugging on local/devnet.
2139
+ *
2140
+ * # Parameters
2141
+ *
2142
+ * * `config` - Optional configuration for encoding and data inclusion.
2143
+ *
2144
+ * # Returns
2145
+ *
2146
+ * A list of all account entries (pubkey + account info).
2147
+ *
2148
+ * # Errors
2149
+ *
2150
+ * Returns an error if the RPC call fails.
2151
+ */
2152
+ abstract getAllAccounts(config: GetAllAccountsConfig | undefined): Promise<AllAccountsEntry[]>;
2153
+ /**
2154
+ * Gets a block by its height.
2155
+ *
2156
+ * # Parameters
2157
+ *
2158
+ * * `block-height` - The block height to query.
2159
+ * * `config` - Optional configuration for transaction detail level
2160
+ * ("full", "signatures", or "none"). Defaults to "full".
2161
+ *
2162
+ * # Returns
2163
+ *
2164
+ * Block information including blockhash, timestamp, and transactions
2165
+ * (detail level depends on config).
2166
+ *
2167
+ * # Errors
2168
+ *
2169
+ * Returns an error if the RPC call fails or the block is not found.
2170
+ */
2171
+ abstract getBlock(blockHeight: bigint, config: GetBlockConfig | undefined): Promise<BlockInfo>;
2172
+ /**
2173
+ * Gets a list of confirmed block heights in a range (inclusive).
2174
+ *
2175
+ * # Parameters
2176
+ *
2177
+ * * `start-height` - The start of the block height range.
2178
+ * * `end-height` - The end of the range. If absent, returns up to the
2179
+ * latest confirmed block.
2180
+ *
2181
+ * # Returns
2182
+ *
2183
+ * A list of confirmed block height numbers.
2184
+ *
2185
+ * # Errors
2186
+ *
2187
+ * Returns an error if the RPC call fails.
2188
+ */
2189
+ abstract getBlocks(startHeight: bigint, endHeight: bigint | undefined): Promise<bigint[]>;
2190
+ /**
2191
+ * Gets detailed information about a stake account.
2192
+ *
2193
+ * # Parameters
2194
+ *
2195
+ * * `pubkey` - The public key of the stake account.
2196
+ *
2197
+ * # Returns
2198
+ *
2199
+ * The stake account info (state, balances, authorities), or absent if
2200
+ * the account is not a valid stake account.
2201
+ *
2202
+ * # Errors
2203
+ *
2204
+ * Returns an error if the RPC call fails.
2205
+ */
2206
+ abstract getStakeAccount(pubkey: PublicKey): Promise<StakeAccountInfo | undefined>;
2207
+ /**
2208
+ * Gets all registered validator accounts.
2209
+ *
2210
+ * # Parameters
2211
+ *
2212
+ * * `request` - Request parameters specifying whether to use the frozen
2213
+ * (last epoch) or pending (current) snapshot.
2214
+ *
2215
+ * # Returns
2216
+ *
2217
+ * A list of validator account info records.
2218
+ *
2219
+ * # Errors
2220
+ *
2221
+ * Returns an error if the RPC call fails.
2222
+ */
2223
+ abstract getValidatorAccounts(request: GetValidatorAccountsRequest): Promise<ValidatorAccountInfo[]>;
2224
+ /**
2225
+ * Gets the token balance of an SPL Token account.
2226
+ *
2227
+ * # Parameters
2228
+ *
2229
+ * * `pubkey` - The public key of the SPL Token account.
2230
+ *
2231
+ * # Returns
2232
+ *
2233
+ * Token balance information including raw amount, decimals, and
2234
+ * human-readable amount string.
2235
+ *
2236
+ * # Errors
2237
+ *
2238
+ * Returns an error if the RPC call fails or the account is not a valid
2239
+ * token account.
2240
+ */
2241
+ abstract getTokenAccountBalance(pubkey: PublicKey): Promise<TokenBalance>;
2242
+ /**
2243
+ * Gets registered REX requests for a creator.
2244
+ *
2245
+ * # Parameters
2246
+ *
2247
+ * * `creator` - The public key of the REX creator.
2248
+ * * `nonce` - Optional nonce to filter for a specific REX request.
2249
+ * If absent, returns all requests by the creator.
2250
+ *
2251
+ * # Returns
2252
+ *
2253
+ * A list of REX request records with their associated duties.
2254
+ *
2255
+ * # Errors
2256
+ *
2257
+ * Returns an error if the RPC call fails.
2258
+ */
2259
+ abstract getRexRequests(creator: PublicKey, nonce: string | undefined): Promise<RexInfoAndDuties[]>;
2260
+ /**
2261
+ * Gets missed REX duty proposal rounds for a specific REX request.
2262
+ *
2263
+ * # Parameters
2264
+ *
2265
+ * * `creator` - The public key of the REX creator.
2266
+ * * `nonce` - The nonce identifying the specific REX request.
2267
+ *
2268
+ * # Returns
2269
+ *
2270
+ * A list of proposal round numbers where duties were missed.
2271
+ *
2272
+ * # Errors
2273
+ *
2274
+ * Returns an error if the RPC call fails.
2275
+ */
2276
+ abstract getRexMissedDuties(creator: PublicKey, nonce: string): Promise<bigint[]>;
2277
+ /**
2278
+ * Gets information about all known cluster nodes.
2279
+ *
2280
+ * # Returns
2281
+ *
2282
+ * A list of cluster node info records including stake, addresses,
2283
+ * and public keys.
2284
+ *
2285
+ * # Errors
2286
+ *
2287
+ * Returns an error if the RPC call fails.
2288
+ */
2289
+ abstract getClusterNodes(): Promise<ClusterNodeInfo[]>;
2290
+ /**
2291
+ * Gets the list of validator indices this node is connected to.
2292
+ *
2293
+ * # Returns
2294
+ *
2295
+ * A list of validator indices (u32).
2296
+ *
2297
+ * # Errors
2298
+ *
2299
+ * Returns an error if the RPC call fails.
2300
+ */
2301
+ abstract getConnectedValidators(): Promise<number[]>;
2302
+ /**
2303
+ * Submits a signed transaction to the network.
2304
+ *
2305
+ * # Parameters
2306
+ *
2307
+ * * `transaction` - The serialized, signed transaction as a byte array.
2308
+ * * `options` - Optional send options (skip preflight, max retries).
2309
+ * If absent, default options are used.
2310
+ *
2311
+ * # Returns
2312
+ *
2313
+ * The transaction signature, which can be used to check its status.
2314
+ *
2315
+ * # Errors
2316
+ *
2317
+ * Returns an error if the RPC call fails or the transaction is rejected.
2318
+ */
2319
+ abstract sendTransaction(transaction: Uint8Array, options: SendTransactionOptions | undefined): Promise<Signature>;
2320
+ /**
2321
+ * Requests an airdrop of tokens to the specified account.
2322
+ *
2323
+ * This method is typically only available on test networks (localnet, devnet).
2324
+ *
2325
+ * # Parameters
2326
+ *
2327
+ * * `pubkey` - The public key of the recipient account.
2328
+ * * `amount` - The amount of kelvins to airdrop.
2329
+ *
2330
+ * # Returns
2331
+ *
2332
+ * The transaction signature of the airdrop transaction.
2333
+ *
2334
+ * # Errors
2335
+ *
2336
+ * Returns an error if the RPC call fails or airdrops are not supported.
2337
+ */
2338
+ abstract requestAirdrop(pubkey: PublicKey, amount: Kelvin): Promise<Signature>;
2339
+ /**
2340
+ * Polls until a transaction is confirmed or times out.
2341
+ *
2342
+ * This is a CDK compound method (not a single RPC call). It repeatedly
2343
+ * calls getSignatureStatuses until the transaction is confirmed or the
2344
+ * retry limit is reached.
2345
+ *
2346
+ * # Parameters
2347
+ *
2348
+ * * `sig` - The transaction signature (base58) to monitor.
2349
+ * * `options` - Optional confirmation options (max retries, retry delay).
2350
+ * Defaults: 30 retries, 1000ms delay.
2351
+ *
2352
+ * # Returns
2353
+ *
2354
+ * A confirmed transaction record with signature, executed status, and error.
2355
+ *
2356
+ * # Errors
2357
+ *
2358
+ * Returns an error if the transaction fails or confirmation times out.
2359
+ */
2360
+ abstract confirmTransaction(sig: string, options: ConfirmTransactionOptions | undefined): Promise<ConfirmedTransaction>;
2361
+ /**
2362
+ * Sends a transaction and waits for confirmation.
2363
+ *
2364
+ * This is a CDK compound method that combines send-transaction and
2365
+ * confirm-transaction into a single call.
2366
+ *
2367
+ * # Parameters
2368
+ *
2369
+ * * `transaction` - The serialized, signed transaction as a byte array.
2370
+ * * `options` - Optional combined send-and-confirm options.
2371
+ *
2372
+ * # Returns
2373
+ *
2374
+ * A confirmed transaction record with signature, executed status, and error.
2375
+ *
2376
+ * # Errors
2377
+ *
2378
+ * Returns an error if sending fails, the transaction is rejected,
2379
+ * or confirmation times out.
2380
+ */
2381
+ abstract sendAndConfirmTransaction(transaction: Uint8Array, options: SendAndConfirmOptions | undefined): Promise<ConfirmedTransaction>;
2382
+ /**
2383
+ * Requests an airdrop and waits for confirmation.
2384
+ *
2385
+ * This is a CDK compound method that combines request-airdrop and
2386
+ * confirm-transaction into a single call.
2387
+ *
2388
+ * # Parameters
2389
+ *
2390
+ * * `pubkey` - The public key of the recipient account.
2391
+ * * `amount` - The amount of kelvins to airdrop.
2392
+ *
2393
+ * # Returns
2394
+ *
2395
+ * A confirmed transaction record for the airdrop.
2396
+ *
2397
+ * # Errors
2398
+ *
2399
+ * Returns an error if the airdrop fails or confirmation times out.
2400
+ */
2401
+ abstract requestAirdropAndConfirm(pubkey: PublicKey, amount: Kelvin): Promise<ConfirmedTransaction>;
2402
+ /**
2403
+ * Submits an epoch change transaction (admin-only).
2404
+ *
2405
+ * This is a restricted admin method used for epoch management.
2406
+ * Only available to authorized admin accounts.
2407
+ *
2408
+ * # Parameters
2409
+ *
2410
+ * * `request` - The epoch change request containing serialized data.
2411
+ *
2412
+ * # Returns
2413
+ *
2414
+ * A response indicating whether the submission was accepted.
2415
+ *
2416
+ * # Errors
2417
+ *
2418
+ * Returns an error if the RPC call fails or the sender is not authorized.
2419
+ */
2420
+ abstract sendAdminTransaction(request: SubmitEpochChangeRequest): Promise<SubmitEpochChangeResponse>;
1066
2421
  }
1067
2422
 
1068
2423
  /**
@@ -1090,7 +2445,7 @@ interface GetAccountsByOwnerResponse {
1090
2445
  * const signature = await client.sendTransaction(signedTx);
1091
2446
  * ```
1092
2447
  */
1093
- declare class RialoClient {
2448
+ declare class RialoClient extends RpcClient {
1094
2449
  private readonly queryClient;
1095
2450
  private readonly transactionClient;
1096
2451
  private readonly transport;
@@ -1111,27 +2466,31 @@ declare class RialoClient {
1111
2466
  /**
1112
2467
  * Retrieves the balance of an account in kelvins (smallest unit).
1113
2468
  */
1114
- getBalance(pubkey: PublicKey): Promise<bigint>;
2469
+ getBalance(pubkey: PublicKey): Promise<Kelvin>;
1115
2470
  /**
1116
2471
  * Retrieves detailed information about an account.
1117
2472
  *
1118
2473
  * @returns Account info or null if account doesn't exist
1119
2474
  */
1120
- getAccountInfo(pubkey: PublicKey): Promise<AccountInfo | null>;
2475
+ getAccountInfo(pubkey: PublicKey): Promise<AccountInfo>;
1121
2476
  /**
1122
2477
  * Retrieves the current block height.
1123
2478
  */
1124
2479
  getBlockHeight(): Promise<bigint>;
2480
+ /**
2481
+ * Retrieves the current block height with advanced configuration.
2482
+ */
2483
+ getBlockHeightWithConfig(minContextSlot: bigint | undefined): Promise<bigint>;
1125
2484
  /**
1126
2485
  * Retrieves the signatures for an address.
1127
2486
  */
1128
- getSignaturesForAddress(address: PublicKey, config?: GetSignaturesForAddressConfig): Promise<SignatureInfo[]>;
2487
+ getSignaturesForAddress(address: PublicKey, config: GetSignaturesForAddressConfig | undefined): Promise<SignatureInfo[]>;
1129
2488
  /**
1130
2489
  * Retrieves detailed information about a transaction.
1131
2490
  *
1132
- * @returns Transaction info or null if transaction not found
2491
+ * @returns Full transaction response
1133
2492
  */
1134
- getTransaction(signature: string): Promise<TransactionResponse | null>;
2493
+ getTransaction(sig: Signature): Promise<TransactionResponse>;
1135
2494
  /**
1136
2495
  * Retrieves the total number of transactions processed since genesis.
1137
2496
  */
@@ -1139,17 +2498,17 @@ declare class RialoClient {
1139
2498
  /**
1140
2499
  * Retrieves the status of multiple transaction signatures.
1141
2500
  */
1142
- getSignatureStatuses(signatures: string[]): Promise<(SignatureStatus | null)[]>;
2501
+ getSignatureStatuses(signatures: Signature[]): Promise<(SignatureStatus | undefined)[]>;
1143
2502
  /**
1144
2503
  * Retrieves current epoch information.
1145
2504
  */
1146
- getEpochInfo(): Promise<EpochInfoResponse>;
2505
+ getEpochInfo(): Promise<EpochInfo>;
1147
2506
  /**
1148
2507
  * Checks the health status of the RPC node.
1149
2508
  *
1150
2509
  * @returns "ok" if healthy, error message otherwise
1151
2510
  */
1152
- getHealth(): Promise<"ok" | string>;
2511
+ getHealth(): Promise<string>;
1153
2512
  /**
1154
2513
  * Submits a signed transaction to the blockchain.
1155
2514
  *
@@ -1157,7 +2516,7 @@ declare class RialoClient {
1157
2516
  * @param options - Transaction submission options
1158
2517
  * @returns Transaction signature
1159
2518
  */
1160
- sendTransaction(transaction: Uint8Array, options?: SendTransactionOptions): Promise<string>;
2519
+ sendTransaction(transaction: Uint8Array, options?: Partial<SendTransactionOptions>): Promise<Signature>;
1161
2520
  /**
1162
2521
  * Requests an airdrop of tokens to an account.
1163
2522
  *
@@ -1167,7 +2526,7 @@ declare class RialoClient {
1167
2526
  * @param amount - Amount in kelvins (smallest unit)
1168
2527
  * @returns Transaction signature
1169
2528
  */
1170
- requestAirdrop(pubkey: PublicKey, amount: bigint): Promise<string>;
2529
+ requestAirdrop(pubkey: PublicKey, amount: Kelvin): Promise<Signature>;
1171
2530
  /**
1172
2531
  * Submits a signed transaction and waits for confirmation.
1173
2532
  *
@@ -1183,7 +2542,7 @@ declare class RialoClient {
1183
2542
  * console.log(`Confirmed in slot ${result.slot}`);
1184
2543
  * ```
1185
2544
  */
1186
- sendAndConfirmTransaction(transaction: Uint8Array, options?: SendAndConfirmOptions): Promise<ConfirmedTransaction>;
2545
+ sendAndConfirmTransaction(transaction: Uint8Array, options?: Partial<SendAndConfirmOptions>): Promise<ConfirmedTransaction>;
1187
2546
  /**
1188
2547
  * Waits for a transaction to be confirmed.
1189
2548
  *
@@ -1191,43 +2550,43 @@ declare class RialoClient {
1191
2550
  * @param options - Confirmation options
1192
2551
  * @returns Confirmed transaction details
1193
2552
  */
1194
- confirmTransaction(signature: string, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
2553
+ confirmTransaction(sig: string, options?: Partial<ConfirmTransactionOptions>): Promise<ConfirmedTransaction>;
1195
2554
  /**
1196
2555
  * Requests an airdrop and waits for confirmation.
1197
2556
  *
1198
2557
  * **Note**: Only available on devnet and testnet.
1199
2558
  */
1200
- requestAirdropAndConfirm(pubkey: PublicKey, amount: bigint, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
2559
+ requestAirdropAndConfirm(pubkey: PublicKey, amount: Kelvin): Promise<ConfirmedTransaction>;
1201
2560
  /**
1202
2561
  * Calculate the minimum balance required for an account to be rent-exempt.
1203
2562
  *
1204
2563
  * @param accountDataSize - The size of the account data in bytes
1205
2564
  * @returns The minimum balance in kelvins required for rent exemption
1206
2565
  */
1207
- getMinimumBalanceForRentExemption(accountDataSize: number): Promise<bigint>;
2566
+ getMinimumBalanceForRentExemption(dataSize: bigint): Promise<bigint>;
1208
2567
  /**
1209
2568
  * Get the fee required to process a specific message.
1210
2569
  *
1211
2570
  * @param message - Base64-encoded serialized versioned message
1212
- * @returns Fee in kelvins, or null if message is invalid
2571
+ * @returns Fee response with value in kelvins
1213
2572
  */
1214
- getFeeForMessage(message: string): Promise<bigint | null>;
2573
+ getFeeForMessage(message: string): Promise<FeeResponse>;
1215
2574
  /**
1216
2575
  * Get information for multiple accounts in a single request.
1217
2576
  *
1218
2577
  * @param pubkeys - Array of public keys to query (1-100)
1219
2578
  * @returns Account information for each address
1220
2579
  */
1221
- getMultipleAccounts(pubkeys: PublicKey[]): Promise<Array<AccountInfo | null>>;
2580
+ getMultipleAccounts(pubkeys: PublicKey[]): Promise<OptionalAccountInfo[]>;
1222
2581
  /**
1223
2582
  * Get all accounts owned by a specific program or address.
1224
2583
  *
1225
2584
  * @param owner - Program ID or owner public key
1226
- * @param filter - Filter type (ProgramAccounts or TokenAccounts)
2585
+ * @param filter - Filter type (programAccounts or tokenAccounts)
1227
2586
  * @param config - Optional configuration for pagination and encoding
1228
- * @returns Accounts owned by the specified owner
2587
+ * @returns Tuple of accounts and optional pagination info
1229
2588
  */
1230
- getAccountsByOwner(owner: PublicKey, filter?: AccountFilter, config?: GetAccountsByOwnerConfig): Promise<GetAccountsByOwnerResponse>;
2589
+ getAccountsByOwner(owner: PublicKey, filter: AccountFilter | undefined, config: GetAccountsByOwnerConfig | undefined): Promise<[OwnerAccount[], PaginationInfo | undefined]>;
1231
2590
  /**
1232
2591
  * Get workflow lineage information for tracking execution history.
1233
2592
  *
@@ -1250,13 +2609,92 @@ declare class RialoClient {
1250
2609
  * @param limit - Optional limit on transactions returned
1251
2610
  * @returns Triggered transactions for the subscription
1252
2611
  */
1253
- getTriggeredTransactions(subscriptionAccount: PublicKey, limit?: number): Promise<TriggeredTransaction[]>;
2612
+ getTriggeredTransactions(subscriptionAccount: PublicKey, limit: number | undefined): Promise<TriggeredTransaction[]>;
2613
+ /**
2614
+ * Gets paginated transactions from the blockchain.
2615
+ */
2616
+ getTransactions(config: GetTransactionsConfig | undefined): Promise<TransactionInfo[]>;
2617
+ /**
2618
+ * Checks if a blockhash is still valid for transaction submission.
2619
+ */
2620
+ isBlockhashValid(blockhash: Hash): Promise<IsBlockhashValidResponse>;
2621
+ /**
2622
+ * Gets the health status of the validator.
2623
+ */
2624
+ getValidatorHealth(): Promise<ValidatorHealth>;
2625
+ /**
2626
+ * Gets the list of full nodes connected to the validator or full node.
2627
+ */
2628
+ getConnectedFullNodes(): Promise<ConnectedNode[]>;
2629
+ /**
2630
+ * Gets the TEE's secret sharing public key for HPKE encryption.
2631
+ */
2632
+ getSecretSharingPubkey(): Promise<SecretSharingPubkey>;
2633
+ /**
2634
+ * Gets the config hash prefix for protecting against replay attacks.
2635
+ */
2636
+ getConfigHashPrefix(): Promise<ConfigHashPrefix>;
2637
+ /**
2638
+ * Submits an epoch change transaction (admin-only).
2639
+ */
2640
+ sendAdminTransaction(request: SubmitEpochChangeRequest): Promise<SubmitEpochChangeResponse>;
2641
+ /**
2642
+ * Gets all accounts in the system.
2643
+ */
2644
+ getAllAccounts(config: GetAllAccountsConfig | undefined): Promise<AllAccountsEntry[]>;
2645
+ /**
2646
+ * Gets a block by its height.
2647
+ */
2648
+ getBlock(blockHeight: bigint, config: GetBlockConfig | undefined): Promise<BlockInfo>;
2649
+ /**
2650
+ * Gets a list of confirmed block heights in a range.
2651
+ */
2652
+ getBlocks(startHeight: bigint, endHeight: bigint | undefined): Promise<bigint[]>;
2653
+ /**
2654
+ * Gets detailed information about a stake account.
2655
+ */
2656
+ getStakeAccount(pubkey: PublicKey): Promise<StakeAccountInfo | undefined>;
2657
+ /**
2658
+ * Gets all registered validator accounts.
2659
+ */
2660
+ getValidatorAccounts(request: GetValidatorAccountsRequest): Promise<ValidatorAccountInfo[]>;
2661
+ /**
2662
+ * Gets the token balance of an SPL Token account.
2663
+ */
2664
+ getTokenAccountBalance(pubkey: PublicKey): Promise<TokenBalance>;
2665
+ /**
2666
+ * Gets registered REX requests for a creator.
2667
+ */
2668
+ getRexRequests(creator: PublicKey, nonce: string | undefined): Promise<RexInfoAndDuties[]>;
2669
+ /**
2670
+ * Gets missed REX duty proposal rounds for a specific REX request.
2671
+ */
2672
+ getRexMissedDuties(creator: PublicKey, nonce: string): Promise<bigint[]>;
2673
+ /**
2674
+ * Gets information about all known cluster nodes.
2675
+ */
2676
+ getClusterNodes(): Promise<ClusterNodeInfo[]>;
2677
+ /**
2678
+ * Gets the list of validator indices this node is connected to.
2679
+ */
2680
+ getConnectedValidators(): Promise<number[]>;
2681
+ /**
2682
+ * Calls an arbitrary RPC method with a JSON string body.
2683
+ * Utility method for methods not yet in the generated interface.
2684
+ */
2685
+ callWithJson(method: string, params: string): Promise<string>;
1254
2686
  }
1255
2687
 
1256
2688
  /**
1257
- * Query client for read-only RPC operations.
2689
+ * Filter for what kind of accounts to return from getAccountsByOwner.
2690
+ * Uses the serde-compatible discriminated union format expected by the RPC.
1258
2691
  */
1259
-
2692
+ type AccountFilterParam = {
2693
+ type: "programAccounts";
2694
+ } | {
2695
+ type: "tokenAccounts";
2696
+ mint?: string;
2697
+ };
1260
2698
  /**
1261
2699
  * Client for querying blockchain state.
1262
2700
  *
@@ -1331,27 +2769,6 @@ declare class QueryRpcClient extends BaseRpcClient {
1331
2769
  * ```
1332
2770
  */
1333
2771
  getSignaturesForAddress(address: PublicKey, config?: GetSignaturesForAddressConfig): Promise<SignatureInfo[]>;
1334
- /**
1335
- * Retrieve detailed information about a confirmed transaction.
1336
- *
1337
- * Returns transaction metadata including the block height it was
1338
- * confirmed in and any execution errors.
1339
- *
1340
- * @param signature - The transaction signature to query
1341
- * @returns Transaction information, or null if the transaction is not found
1342
- *
1343
- * @example
1344
- * ```typescript
1345
- * const tx = await client.getTransaction(signature);
1346
- * if (tx) {
1347
- * console.log(`Confirmed in block: ${tx.blockHeight}`);
1348
- * if (tx.err) {
1349
- * console.log(`Transaction failed: ${tx.err}`);
1350
- * }
1351
- * }
1352
- * ```
1353
- */
1354
- getTransaction(signature: string): Promise<TransactionResponse | null>;
1355
2772
  /**
1356
2773
  * Retrieve the total number of transactions processed since genesis.
1357
2774
  *
@@ -1402,7 +2819,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1402
2819
  * console.log(`Block height: ${info.blockHeight}`);
1403
2820
  * ```
1404
2821
  */
1405
- getEpochInfo(): Promise<EpochInfoResponse>;
2822
+ getEpochInfo(): Promise<EpochInfo>;
1406
2823
  /**
1407
2824
  * Check the health status of the RPC node.
1408
2825
  *
@@ -1490,7 +2907,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1490
2907
  * });
1491
2908
  * ```
1492
2909
  */
1493
- getAccountsByOwner(owner: PublicKey, filter?: AccountFilter, config?: GetAccountsByOwnerConfig): Promise<GetAccountsByOwnerResponse>;
2910
+ getAccountsByOwner(owner: PublicKey, filter?: AccountFilterParam, config?: GetAccountsByOwnerConfig): Promise<[OwnerAccount[], PaginationInfo | undefined]>;
1494
2911
  /**
1495
2912
  * Get workflow lineage information for tracking execution history.
1496
2913
  *
@@ -1545,6 +2962,171 @@ declare class QueryRpcClient extends BaseRpcClient {
1545
2962
  * ```
1546
2963
  */
1547
2964
  getTriggeredTransactions(subscriptionAccount: PublicKey, limit?: number): Promise<TriggeredTransaction[]>;
2965
+ /**
2966
+ * Retrieve the REX X25519 public key for secret sharing encryption.
2967
+ *
2968
+ * This key is used for HPKE encryption when sending encrypted data
2969
+ * that should only be decryptable within the REX execution environment.
2970
+ *
2971
+ * @returns The REX X25519 public key as a 32-byte Uint8Array
2972
+ *
2973
+ * @example
2974
+ * ```typescript
2975
+ * import { encryptForREX } from "@rialo/ts-cdk";
2976
+ *
2977
+ * // Get the REX public key
2978
+ * const rexPubkey = await client.getSecretSharingPubkey();
2979
+ *
2980
+ * // Use it for HPKE encryption
2981
+ * const encrypted = await encryptForRex(
2982
+ * rexPubkey,
2983
+ * new TextEncoder().encode("secret data"),
2984
+ * keypair.publicKey.toBytes()
2985
+ * );
2986
+ * ```
2987
+ */
2988
+ getSecretSharingPubkey(): Promise<Uint8Array>;
2989
+ /**
2990
+ * Get the config hash prefix for replay protection.
2991
+ *
2992
+ * Returns the first 64 bits of the config hash, which is used
2993
+ * for transaction replay protection across chains.
2994
+ *
2995
+ * @returns The config hash prefix as a bigint
2996
+ *
2997
+ * @example
2998
+ * ```typescript
2999
+ * const configHashPrefix = await client.getConfigHashPrefix();
3000
+ * const tx = TransactionBuilder.create()
3001
+ * .setPayer(payer)
3002
+ * .setValidFrom(validFrom)
3003
+ * .setConfigHashPrefix(configHashPrefix)
3004
+ * .addInstruction(instruction)
3005
+ * .build();
3006
+ * ```
3007
+ */
3008
+ getConfigHashPrefix(): Promise<bigint>;
3009
+ /**
3010
+ * Retrieve the current block height with an optional minimum context slot.
3011
+ *
3012
+ * When minContextSlot is provided, the RPC will only return a result
3013
+ * if the node has processed at least that slot.
3014
+ *
3015
+ * @param minContextSlot - Minimum slot the node must have processed
3016
+ * @returns The current block height
3017
+ */
3018
+ getBlockHeightWithConfig(minContextSlot: bigint | undefined): Promise<bigint>;
3019
+ /**
3020
+ * Retrieve full transaction details by signature.
3021
+ *
3022
+ * Returns the complete transaction including metadata (fee, errors, logs),
3023
+ * the transaction body (signatures, message, instructions), and block context.
3024
+ *
3025
+ * @param sig - Transaction signature (Uint8Array)
3026
+ * @returns Full transaction response with block height, metadata, and body
3027
+ */
3028
+ getTransactionDetails(sig: Signature): Promise<TransactionResponse>;
3029
+ /**
3030
+ * Retrieve a paginated list of recent transactions.
3031
+ *
3032
+ * @param config - Optional pagination config (limit, before cursor)
3033
+ * @returns Array of transaction summaries with signature, slot, time, and error status
3034
+ */
3035
+ getTransactions(config: GetTransactionsConfig | undefined): Promise<TransactionInfo[]>;
3036
+ /**
3037
+ * Check whether a blockhash is still valid for transaction submission.
3038
+ *
3039
+ * @param blockhash - The blockhash to check (Uint8Array)
3040
+ * @returns Slot context and validity boolean
3041
+ */
3042
+ isBlockhashValid(blockhash: Hash): Promise<IsBlockhashValidResponse>;
3043
+ /**
3044
+ * Get the health status of the validator node.
3045
+ *
3046
+ * @returns Validator health details
3047
+ */
3048
+ getValidatorHealth(): Promise<ValidatorHealth>;
3049
+ /**
3050
+ * Get the list of full nodes connected to the validator or full node.
3051
+ *
3052
+ * @returns Array of connected nodes with their public key and connection duration
3053
+ */
3054
+ getConnectedFullNodes(): Promise<ConnectedNode[]>;
3055
+ /**
3056
+ * Get all accounts in the system.
3057
+ *
3058
+ * @param config - Optional filtering/pagination config
3059
+ * @returns Array of all account entries with pubkey and account data
3060
+ */
3061
+ getAllAccounts(config: GetAllAccountsConfig | undefined): Promise<AllAccountsEntry[]>;
3062
+ /**
3063
+ * Get a block by its height.
3064
+ *
3065
+ * @param blockHeight - The height of the block to retrieve
3066
+ * @param config - Optional config to control transaction detail level
3067
+ * @returns Block info including hash, height, time, and optional signatures
3068
+ */
3069
+ getBlock(blockHeight: bigint, config: GetBlockConfig | undefined): Promise<BlockInfo>;
3070
+ /**
3071
+ * Get a list of confirmed block heights in a range.
3072
+ *
3073
+ * @param startHeight - Start of the range (inclusive)
3074
+ * @param endHeight - End of the range (inclusive), or undefined for open-ended
3075
+ * @returns Array of confirmed block heights
3076
+ */
3077
+ getBlocks(startHeight: bigint, endHeight: bigint | undefined): Promise<bigint[]>;
3078
+ /**
3079
+ * Get detailed information about a stake account.
3080
+ *
3081
+ * @param pubkey - The public key of the stake account
3082
+ * @returns Stake account info, or undefined if the account doesn't exist
3083
+ */
3084
+ getStakeAccount(pubkey: PublicKey): Promise<StakeAccountInfo | undefined>;
3085
+ /**
3086
+ * Get all registered validator accounts.
3087
+ *
3088
+ * @param request - Request config (e.g. whether to use frozen state)
3089
+ * @returns Array of validator account info
3090
+ */
3091
+ getValidatorAccounts(request: GetValidatorAccountsRequest): Promise<ValidatorAccountInfo[]>;
3092
+ /**
3093
+ * Get the token balance of an SPL Token account.
3094
+ *
3095
+ * @param pubkey - The public key of the token account
3096
+ * @returns Token balance with amount, decimals, and UI-formatted string
3097
+ */
3098
+ getTokenAccountBalance(pubkey: PublicKey): Promise<TokenBalance>;
3099
+ /**
3100
+ * Get registered REX requests for a creator.
3101
+ *
3102
+ * REX (Remote EXecution) requests are scheduled jobs that validators
3103
+ * execute on behalf of a creator.
3104
+ *
3105
+ * @param creator - The creator's public key
3106
+ * @param nonce - Optional nonce to filter a specific request
3107
+ * @returns Array of REX request info with their assigned duties
3108
+ */
3109
+ getRexRequests(creator: PublicKey, nonce: string | undefined): Promise<RexInfoAndDuties[]>;
3110
+ /**
3111
+ * Get missed REX duty proposal rounds for a specific REX request.
3112
+ *
3113
+ * @param creator - The creator's public key
3114
+ * @param nonce - The nonce identifying the REX request
3115
+ * @returns Array of proposal round numbers where duties were missed
3116
+ */
3117
+ getRexMissedDuties(creator: PublicKey, nonce: string): Promise<bigint[]>;
3118
+ /**
3119
+ * Get information about all known cluster nodes.
3120
+ *
3121
+ * @returns Array of cluster node info with stake, addresses, and keys
3122
+ */
3123
+ getClusterNodes(): Promise<ClusterNodeInfo[]>;
3124
+ /**
3125
+ * Get the list of validator indices this node is connected to.
3126
+ *
3127
+ * @returns Array of validator indices
3128
+ */
3129
+ getConnectedValidators(): Promise<number[]>;
1548
3130
  }
1549
3131
 
1550
3132
  /**
@@ -1581,7 +3163,7 @@ declare class TransactionRpcClient extends BaseRpcClient {
1581
3163
  * });
1582
3164
  * ```
1583
3165
  */
1584
- sendTransaction(transaction: Uint8Array, options?: SendTransactionOptions): Promise<string>;
3166
+ sendTransaction(transaction: Uint8Array, options?: Partial<SendTransactionOptions>): Promise<string>;
1585
3167
  /**
1586
3168
  * Wait for a transaction to be confirmed.
1587
3169
  *
@@ -1594,7 +3176,7 @@ declare class TransactionRpcClient extends BaseRpcClient {
1594
3176
  * @throws {TransactionFailedError} If the transaction fails on-chain
1595
3177
  * @throws {TransactionConfirmationTimeoutError} If confirmation times out
1596
3178
  */
1597
- confirmTransaction(signature: string, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
3179
+ confirmTransaction(signature: string, options?: Partial<ConfirmTransactionOptions>): Promise<ConfirmedTransaction>;
1598
3180
  /**
1599
3181
  * Submit a signed transaction and wait for confirmation.
1600
3182
  *
@@ -1615,11 +3197,12 @@ declare class TransactionRpcClient extends BaseRpcClient {
1615
3197
  * // With custom retry settings
1616
3198
  * const result = await client.sendAndConfirmTransaction(signedTx, {
1617
3199
  * maxRetries: 3,
1618
- * retryDelay: 500,
3200
+ * confirmMaxRetries: 10,
3201
+ * confirmRetryDelayMs: 500,
1619
3202
  * });
1620
3203
  * ```
1621
3204
  */
1622
- sendAndConfirmTransaction(transaction: Uint8Array, options?: SendAndConfirmOptions): Promise<ConfirmedTransaction>;
3205
+ sendAndConfirmTransaction(transaction: Uint8Array, options?: Partial<SendAndConfirmOptions>): Promise<ConfirmedTransaction>;
1623
3206
  /**
1624
3207
  * Request an airdrop of tokens to an account.
1625
3208
  *
@@ -1661,7 +3244,14 @@ declare class TransactionRpcClient extends BaseRpcClient {
1661
3244
  * }
1662
3245
  * ```
1663
3246
  */
1664
- requestAirdropAndConfirm(pubkey: PublicKey, amount: bigint, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
3247
+ requestAirdropAndConfirm(pubkey: PublicKey, amount: bigint, options?: Partial<ConfirmTransactionOptions>): Promise<ConfirmedTransaction>;
3248
+ /**
3249
+ * Submit an epoch change transaction (admin-only).
3250
+ *
3251
+ * @param request - The epoch change request payload
3252
+ * @returns Response from the epoch change submission
3253
+ */
3254
+ sendAdminTransaction(request: SubmitEpochChangeRequest): Promise<SubmitEpochChangeResponse>;
1665
3255
  private getTransaction;
1666
3256
  /**
1667
3257
  * Sleeps for a given number of milliseconds.
@@ -2220,7 +3810,7 @@ interface Signer {
2220
3810
  * @param message - Message bytes to sign
2221
3811
  * @returns Ed25519 signature over the message
2222
3812
  */
2223
- signMessage(message: Uint8Array): Promise<Signature>;
3813
+ signMessage(message: Uint8Array): Promise<Signature$1>;
2224
3814
  }
2225
3815
 
2226
3816
  /**
@@ -2257,7 +3847,7 @@ declare class KeypairSigner implements Signer {
2257
3847
  /**
2258
3848
  * Signs a message using the keypair's private key.
2259
3849
  */
2260
- signMessage(message: Uint8Array): Promise<Signature>;
3850
+ signMessage(message: Uint8Array): Promise<Signature$1>;
2261
3851
  }
2262
3852
 
2263
3853
  /**
@@ -2561,11 +4151,15 @@ declare class Message {
2561
4151
  readonly accountKeys: readonly PublicKey[];
2562
4152
  /** Transaction valid from (milliseconds since Unix epoch) */
2563
4153
  validFrom?: bigint;
4154
+ /** Config hash prefix for replay protection across chains */
4155
+ readonly configHashPrefix: bigint;
4156
+ /** Whether the transaction should use OCC (optimistic concurrency control) scheduling */
4157
+ readonly occ: boolean;
2564
4158
  /** Compiled instructions with account indices */
2565
4159
  readonly instructions: readonly CompiledInstruction[];
2566
4160
  /** Cached serialized bytes */
2567
4161
  private serializedCache?;
2568
- constructor(header: MessageHeader, accountKeys: readonly PublicKey[], validFrom: bigint, instructions: readonly CompiledInstruction[]);
4162
+ constructor(header: MessageHeader, accountKeys: readonly PublicKey[], validFrom: bigint, configHashPrefix: bigint, occ: boolean, instructions: readonly CompiledInstruction[]);
2569
4163
  /**
2570
4164
  * Serialize message to bytes for signing.
2571
4165
  * Result is cached for performance.
@@ -2703,14 +4297,14 @@ declare class Transaction {
2703
4297
  *
2704
4298
  * Most users should use sign() or signAll() instead.
2705
4299
  */
2706
- addSignature(index: number, signature: Signature | Uint8Array): Transaction;
4300
+ addSignature(index: number, signature: Signature$1 | Uint8Array): Transaction;
2707
4301
  /**
2708
4302
  * Add a signature for a specific public key.
2709
4303
  * Returns a NEW Transaction instance.
2710
4304
  *
2711
4305
  * Most users should use sign() or signAll() instead.
2712
4306
  */
2713
- addSignatureForPubkey(pubkey: PublicKey, signature: Signature | Uint8Array): Transaction;
4307
+ addSignatureForPubkey(pubkey: PublicKey, signature: Signature$1 | Uint8Array): Transaction;
2714
4308
  /**
2715
4309
  * Check if transaction is fully signed (all signatures present).
2716
4310
  */
@@ -2795,6 +4389,8 @@ declare class Transaction {
2795
4389
  declare class TransactionBuilder {
2796
4390
  private payer?;
2797
4391
  private validFrom?;
4392
+ private configHashPrefix?;
4393
+ private occ;
2798
4394
  private readonly instructions;
2799
4395
  private constructor();
2800
4396
  /**
@@ -2819,6 +4415,21 @@ declare class TransactionBuilder {
2819
4415
  * @param validFrom - Transaction valid from in milliseconds since Unix epoch
2820
4416
  */
2821
4417
  setValidFrom(validFrom: bigint): this;
4418
+ /**
4419
+ * Set the config hash prefix for replay protection.
4420
+ *
4421
+ * This is the first 64 bits of the config hash, used to ensure
4422
+ * transactions cannot be replayed on different chains.
4423
+ *
4424
+ * @param configHashPrefix - config hash prefix as a u64
4425
+ */
4426
+ setConfigHashPrefix(configHashPrefix: bigint): this;
4427
+ /**
4428
+ * Enable OCC (optimistic concurrency control) scheduling for this transaction.
4429
+ *
4430
+ * @param occ - Whether to use OCC scheduling (default: false)
4431
+ */
4432
+ setOcc(occ: boolean): this;
2822
4433
  /**
2823
4434
  * Add an instruction to the transaction.
2824
4435
  *
@@ -2892,4 +4503,4 @@ declare function getMainnetUrl(): string;
2892
4503
  */
2893
4504
  declare function getLocalnetUrl(): string;
2894
4505
 
2895
- export { type AccountFilter, type AccountInfo, type AccountMeta, AccountMetaTable, BASE_DERIVATION_PATH, BaseRpcClient, BincodeReader, type BincodeSchema, BincodeWriter, type Bump, type ChainDefinition, type CompiledInstruction, type ConfirmTransactionOptions, type ConfirmedTransaction, CryptoError, CryptoErrorCode, DEFAULT_NUM_ACCOUNTS, type EnumVariant, type EpochInfoResponse, type EventData, type GetAccountsByOwnerConfig, type GetAccountsByOwnerResponse, type GetHealthResponse, type GetSignaturesForAddressConfig, type GetTransactionsResponse, type GetWorkflowLineageRequest, type GetWorkflowLineageResponse, HttpTransport, type HttpTransportConfig, type IdentifierString, type InferSchema, type Instruction, KELVIN_PER_RLO, Keypair, KeypairSigner, Message, type MessageHeader, Mnemonic, type MnemonicStrength, type OwnerAccount, type PDA, PUBLIC_KEY_LENGTH, type PaginationInfo, PublicKey, QueryRpcClient, RIALO_DEVNET_CHAIN, RIALO_LOCALNET_CHAIN, RIALO_MAINNET_CHAIN, RIALO_SHITNET_CHAIN, RIALO_TESTNET_CHAIN, RialoClient, type RialoClientConfig, RialoError, RialoErrorType, type RialoNetwork, RpcError, RpcErrorCode, type RpcErrorDetails$1 as RpcErrorDetails, SECRET_KEY_LENGTH, SIGNATURE_LENGTH, SYSTEM_PROGRAM_ID, Schema, type Seed, type SendAndConfirmOptions, type SendTransactionOptions, Signature, type SignatureInfo, type SignatureStatus, type Signer, type StructField, type Subscription, type SubscriptionKind, SystemInstruction, type TimestampRange, Transaction, TransactionBuilder, TransactionError, TransactionErrorCode, type TransactionNodeData, type TransactionResponse, TransactionRpcClient, type TriggerInfo, type TriggeredTransaction, type TruncationReason, URL_DEVNET, URL_LOCALNET, URL_MAINNET, URL_SHITNET, URL_TESTNET, type WorkflowLineage, type WorkflowNode, allocateInstruction, assignInstruction, calculateBackoff, concatBytes, createAccount, createBorshInstruction, createRialoClient, deserialize, deserializeBorsh, deserializeCompactU16, deserializeStrict, encodeBorshData, fromBase64, getDefaultRialoClientConfig, getDevnetUrl, getLocalnetUrl, getMainnetUrl, getTestnetUrl, isOnCurve, seedToBytes, serialize, serializeBorsh, serializeCompactU16, sleep, toBase64, transferInstruction, writeCompactU16 };
4506
+ export { type AccountFilter, type AccountFilterParam, type AccountInfo, type AccountMeta, AccountMetaTable, type AllAccountsEntry, BASE_DERIVATION_PATH, BaseRpcClient, BincodeReader, type BincodeSchema, BincodeWriter, type BlockInfo, type Bump, CHACHA20_POLY1305_TAG_LENGTH, type ChainDefinition, type ClusterNodeInfo, type CompiledInstruction, type ConfigHashPrefix, type ConfirmTransactionOptions, type ConfirmedTransaction, type ConnectedNode, CryptoError, CryptoErrorCode, DEFAULT_NUM_ACCOUNTS, ED25519_PUBLIC_KEY_LENGTH, type EnumVariant, type EpochConsensusConfigRequest, type EpochInfo, type EventData, type FeeResponse, type GetAccountsByOwnerConfig, type GetAllAccountsConfig, type GetBlockConfig, type GetSignaturesForAddressConfig, type GetTransactionsConfig, type GetValidatorAccountsRequest, type GetWorkflowLineageRequest, type GetWorkflowLineageResponse, HPKE_ENC_LENGTH, HPKE_OVERHEAD_LENGTH, HpkeError, HpkeErrorCode, HttpTransport, type HttpTransportConfig, type IdentifierString, type InferSchema, type Instruction, type IsBlockhashValidResponse, KELVIN_PER_RLO, type Kelvin, Keypair, KeypairSigner, Message, type MessageHeader, Mnemonic, type MnemonicStrength, type OptionalAccountInfo, type OwnerAccount, type PDA, PUBLIC_KEY_LENGTH, type PaginationInfo, PublicKey, QueryRpcClient, RIALO_DEVNET_CHAIN, RIALO_LOCALNET_CHAIN, RIALO_MAINNET_CHAIN, RIALO_TESTNET_CHAIN, type RexDuty, type RexInfoAndDuties, RexValue, RexValueVariant, RialoClient, type RialoClientConfig, RialoError, RialoErrorType, type RialoNetwork, RpcError, RpcErrorCode, type RpcErrorDetails$1 as RpcErrorDetails, SECRET_KEY_LENGTH, SECRET_SHARING_HPKE_INFO, SIGNATURE_LENGTH, SYSTEM_PROGRAM_ID, Schema, type SecretSharingPubkey, type Seed, type SendAndConfirmOptions, type SendTransactionOptions, Signature$1 as Signature, type SignatureInfo, type SignatureStatus, type Signer, type StakeAccountInfo, type StakeState, type StructField, type SubmitEpochChangeRequest, type SubmitEpochChangeResponse, type Subscription, type SubscriptionAccountMeta, type SubscriptionInstruction, type SubscriptionKind, SystemInstruction, type TimestampRange, type TokenBalance, Transaction, TransactionBuilder, type TransactionData, TransactionError, TransactionErrorCode, type TransactionInfo, type TransactionMessage, type TransactionNodeData, type TransactionResponse, TransactionRpcClient, type TransactionStatusMetadata, type TransactionWithMeta, type TriggerInfo, type TriggeredTransaction, type TruncationReason, URL_DEVNET, URL_LOCALNET, URL_MAINNET, URL_TESTNET, USER_SECRET_AAD, type ValidatorAccountInfo, type ValidatorHealth, type ValidatorInfoRequest, type WorkflowLineage, type WorkflowNode, X25519_PUBLIC_KEY_LENGTH, allocateInstruction, assignInstruction, calculateBackoff, concatBytes, createAccount, createBorshInstruction, createRialoClient, deserialize, deserializeBorsh, deserializeCompactU16, deserializeStrict, encodeBorshData, encryptForRex, fromBase64, getCiphertextLength, getDefaultRialoClientConfig, getDevnetUrl, getLocalnetUrl, getMainnetUrl, getTestnetUrl, hpkeEncrypt, isOnCurve, isValidCiphertextLength, seedToBytes, serialize, serializeBorsh, serializeCompactU16, sleep, toBase64, transferInstruction, writeCompactU16 };