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

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
  *
@@ -733,6 +730,341 @@ declare class RialoError extends Error {
733
730
  static serialization(message: string): RialoError;
734
731
  }
735
732
 
733
+ /**
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.
750
+ *
751
+ * Provides detailed error information for encryption failures,
752
+ * including error codes and contextual details.
753
+ */
754
+ declare class HpkeError extends Error {
755
+ readonly code: HpkeErrorCode;
756
+ readonly cause?: Error;
757
+ constructor(code: HpkeErrorCode, message: string, cause?: Error);
758
+ /**
759
+ * Create an error for invalid key length.
760
+ *
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")
764
+ */
765
+ static invalidKeyLength(expected: number, actual: number, keyType: string): HpkeError;
766
+ /**
767
+ * Create an error for ciphertext that is too short.
768
+ *
769
+ * @param minLength - Minimum required length
770
+ * @param actual - Actual length
771
+ */
772
+ static ciphertextTooShort(minLength: number, actual: number): HpkeError;
773
+ /**
774
+ * Create an error for encryption failure.
775
+ *
776
+ * @param cause - The underlying error
777
+ */
778
+ static encryptionFailed(cause: Error): HpkeError;
779
+ /**
780
+ * Create an error for Borsh deserialization failure.
781
+ *
782
+ * @param cause - The underlying error
783
+ */
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;
965
+ }
966
+
967
+ /**
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
+ * ```
1065
+ */
1066
+ declare function isValidCiphertextLength(ciphertext: Uint8Array): boolean;
1067
+
736
1068
  /**
737
1069
  * Base client with JSON-RPC protocol handling.
738
1070
  *
@@ -747,7 +1079,7 @@ declare class BaseRpcClient {
747
1079
  *
748
1080
  * Handles request serialization, response validation, and error mapping.
749
1081
  */
750
- protected call<T>(method: string, params?: unknown[]): Promise<T>;
1082
+ call<T>(method: string, params?: unknown[]): Promise<T>;
751
1083
  /**
752
1084
  * Validate JSON-RPC response structure
753
1085
  */
@@ -763,306 +1095,1319 @@ declare class BaseRpcClient {
763
1095
  getUrl(): string;
764
1096
  }
765
1097
 
766
- /**
767
- * RPC type definitions for the Rialo blockchain.
768
- */
1098
+ /** A 32-byte public key, base58-encoded on the wire. */
769
1099
 
1100
+ /** A 64-byte Ed25519 signature, base58-encoded on the wire. */
1101
+ type Signature = Uint8Array;
1102
+ /** A 32-byte hash, base58-encoded on the wire. */
1103
+ type Hash = Uint8Array;
1104
+ /** Smallest unit of the native token. */
1105
+ type Kelvin = bigint;
1106
+ /** First 64 bits of the config hash, used for replay protection. */
1107
+ type ConfigHashPrefix = bigint;
770
1108
  /**
771
- * Account information response.
1109
+ * Information about an on-chain account.
772
1110
  */
773
- interface AccountInfo {
774
- /** Account balance in smallest denomination */
775
- balance: bigint;
776
- /** Owner program public key */
1111
+ interface AccountInfo$1 {
1112
+ /** Account balance in kelvins. */
1113
+ kelvin: Kelvin;
1114
+ /** Owner program public key. */
777
1115
  owner: PublicKey;
778
- /** Account data */
779
- data: Uint8Array;
780
- /** Whether the account is executable */
1116
+ /** Account data as encoded strings (typically [encoded_data, encoding_format]). */
1117
+ data: string[];
1118
+ /** Whether the account contains executable code. */
781
1119
  executable: boolean;
782
- /** Rent epoch */
1120
+ /** Rent epoch. */
783
1121
  rentEpoch: bigint;
1122
+ /** Account data size in bytes. */
1123
+ space: bigint;
784
1124
  }
785
1125
  /**
786
- * Transaction response.
1126
+ * A compiled instruction within a transaction message.
787
1127
  */
788
- interface TransactionResponse {
789
- /** Transaction signature */
790
- signature: string;
791
- /** Block height */
792
- blockHeight?: bigint;
793
- /** Error message if transaction failed */
1128
+ interface CompiledInstruction$1 {
1129
+ /** Index into the account keys array identifying the program. */
1130
+ programIdIndex: number;
1131
+ /** Indices into the account keys array for this instruction. */
1132
+ accounts: Uint8Array;
1133
+ /** Instruction data (base58-encoded on the wire). */
1134
+ data: string;
1135
+ }
1136
+ /**
1137
+ * Header of a transaction message.
1138
+ */
1139
+ interface MessageHeader$1 {
1140
+ /** Number of signatures required. */
1141
+ numRequiredSignatures: number;
1142
+ /** Number of read-only signed accounts. */
1143
+ numReadonlySignedAccounts: number;
1144
+ /** Number of read-only unsigned accounts. */
1145
+ numReadonlyUnsignedAccounts: number;
1146
+ }
1147
+ /**
1148
+ * The message portion of a transaction.
1149
+ */
1150
+ interface TransactionMessage {
1151
+ header: MessageHeader$1;
1152
+ accountKeys: PublicKey[];
1153
+ instructions: CompiledInstruction$1[];
1154
+ }
1155
+ /**
1156
+ * A full transaction (signatures + message).
1157
+ */
1158
+ interface TransactionData {
1159
+ signatures: Signature[];
1160
+ message: TransactionMessage;
1161
+ /** Timestamp from which the transaction is valid. */
1162
+ validFrom: bigint;
1163
+ }
1164
+ /**
1165
+ * Metadata about transaction execution.
1166
+ */
1167
+ interface TransactionStatusMetadata {
1168
+ /** Fee paid for the transaction in kelvins. */
1169
+ fee: bigint;
1170
+ /** Error message if the transaction failed, absent if successful. */
794
1171
  err?: string;
1172
+ /** Log messages emitted during execution (if available). */
1173
+ logMessages?: string[];
795
1174
  }
796
1175
  /**
797
- * Options for sending a transaction.
1176
+ * Full response for a transaction query.
798
1177
  */
799
- interface SendTransactionOptions {
800
- /** Skip preflight transaction checks */
801
- skipPreflight?: boolean;
802
- /** Maximum number of times to retry */
803
- maxRetries?: number;
1178
+ interface TransactionResponse$1 {
1179
+ /** Block height where this transaction was processed. */
1180
+ blockHeight: bigint;
1181
+ /** Unix timestamp of the block (if available). */
1182
+ blockTime?: bigint;
1183
+ /** Execution metadata (fee, error). */
1184
+ meta: TransactionStatusMetadata;
1185
+ /** The full transaction content. */
1186
+ transaction: TransactionData;
804
1187
  }
805
1188
  /**
806
- * Epoch information response.
1189
+ * A transaction paired with its metadata (used in block responses).
807
1190
  */
808
- interface EpochInfoResponse {
809
- /** Current epoch */
1191
+ interface TransactionWithMeta {
1192
+ /** The full transaction content. */
1193
+ transaction: TransactionData;
1194
+ /** Execution metadata (fee, error), absent if not available. */
1195
+ meta?: TransactionStatusMetadata;
1196
+ }
1197
+ /**
1198
+ * Status of a transaction signature.
1199
+ */
1200
+ interface SignatureStatus$1 {
1201
+ /** Slot in which the transaction was processed. */
1202
+ slot: bigint;
1203
+ /** Whether the transaction has been executed. */
1204
+ executed: boolean;
1205
+ /** Error message if the transaction failed. */
1206
+ err?: string;
1207
+ }
1208
+ /**
1209
+ * Information about the current epoch.
1210
+ */
1211
+ interface EpochInfo {
1212
+ /** Current epoch number. */
810
1213
  epoch: bigint;
811
- /** Current slot in the epoch */
1214
+ /** Current slot within the epoch. */
812
1215
  slotIndex: bigint;
813
- /** Total slots in the epoch */
1216
+ /** Total slots in the epoch. */
814
1217
  slotsInEpoch: bigint;
815
- /** Absolute slot number */
1218
+ /** Absolute slot number. */
816
1219
  absoluteSlot: bigint;
817
- /** Block height */
1220
+ /** Current block height. */
818
1221
  blockHeight: bigint;
819
- /** Transaction count */
1222
+ /** Total transaction count (if available). */
820
1223
  transactionCount?: bigint;
821
1224
  }
822
1225
  /**
823
- * Subscription kind.
1226
+ * Options for submitting a transaction.
824
1227
  */
825
- type SubscriptionKind = "Persistent" | "OneShot";
1228
+ interface SendTransactionOptions$1 {
1229
+ /** Skip preflight simulation. */
1230
+ skipPreflight: boolean;
1231
+ /** Maximum retries by the RPC node. */
1232
+ maxRetries: number;
1233
+ /** Wait until the transaction has been executed before returning. */
1234
+ waitForExecution: boolean;
1235
+ }
826
1236
  /**
827
- * Subscription data.
1237
+ * Options for confirming a transaction.
828
1238
  */
829
- interface Subscription {
830
- /** Type of subscription */
831
- kind: SubscriptionKind;
832
- /** Topic for the subscription */
833
- topic: string;
834
- /** Instructions to execute when triggered */
835
- instructions: unknown[];
836
- /** Subscriber public key (base58) */
837
- subscriber: string;
838
- /** Event account public key (base58) */
839
- eventAccount?: string;
840
- /** Timestamp range [start, end] */
841
- timestampRange?: [bigint, bigint];
1239
+ interface ConfirmTransactionOptions$1 {
1240
+ /** Maximum polling attempts (default: 30). */
1241
+ maxRetries: number;
1242
+ /** Delay between polls in milliseconds (default: 1000). */
1243
+ retryDelayMs: number;
842
1244
  }
843
1245
  /**
844
- * Triggered transaction data.
1246
+ * Combined options for send-and-confirm.
845
1247
  */
846
- interface TriggeredTransaction {
847
- /** Transaction signature (base58) */
848
- signature: string;
849
- /** Block number where the transaction was executed */
850
- blockNumber: bigint;
1248
+ interface SendAndConfirmOptions$1 {
1249
+ /** Send options. */
1250
+ skipPreflight: boolean;
1251
+ maxRetries: number;
1252
+ /** Confirm options. */
1253
+ confirmMaxRetries: number;
1254
+ confirmRetryDelayMs: number;
851
1255
  }
852
1256
  /**
853
- * Get workflow lineage request.
1257
+ * Result of a confirmed transaction.
854
1258
  */
855
- interface GetWorkflowLineageRequest {
856
- /** Root transaction signature (base58) */
1259
+ interface ConfirmedTransaction$1 {
1260
+ /** Transaction signature (base58). */
857
1261
  signature: string;
858
- /** Maximum depth to traverse (1-100, default 3) */
859
- maxDepth?: number;
860
- /** Whether to include event details */
861
- includeEvents?: boolean;
1262
+ /** Whether the transaction was executed. */
1263
+ executed: boolean;
1264
+ /** Error message if failed. */
1265
+ err?: string;
862
1266
  }
863
1267
  /**
864
- * Event data from a workflow trigger.
1268
+ * Fee calculation response.
865
1269
  */
866
- interface EventData {
867
- /** Event topic */
868
- topic: string;
869
- /** Event attributes */
870
- attributes: Record<string, unknown>;
1270
+ interface FeeResponse {
1271
+ /** The fee in kelvins, absent if message is invalid. */
1272
+ value?: bigint;
871
1273
  }
872
1274
  /**
873
- * Timestamp range.
1275
+ * Response from blockhash validation.
874
1276
  */
875
- interface TimestampRange {
876
- /** Start timestamp (unix) */
877
- from: bigint;
878
- /** End timestamp (unix) */
879
- to: bigint;
1277
+ interface IsBlockhashValidResponse {
1278
+ /** Slot from the response context. */
1279
+ slot: bigint;
1280
+ /** Whether the blockhash is still valid. */
1281
+ isValid: boolean;
880
1282
  }
881
1283
  /**
882
- * Information about what triggered a workflow transaction.
1284
+ * Configuration for getSignaturesForAddress.
883
1285
  */
884
- interface TriggerInfo {
885
- /** Event that triggered the transaction */
886
- event: EventData;
887
- /** Subscription public key (base58) */
888
- subscriptionPubkey: string;
889
- /** Timestamp range for the trigger */
890
- timestampRange?: TimestampRange;
891
- /** Event account public key (base58) */
892
- eventAccount?: string;
1286
+ interface GetSignaturesForAddressConfig$1 {
1287
+ /** Maximum number of signatures to return. */
1288
+ limit?: number;
1289
+ /** Search backwards from this signature (base58). */
1290
+ before?: string;
1291
+ /** Search forwards from this signature (base58). */
1292
+ until?: string;
893
1293
  }
894
1294
  /**
895
- * Transaction node data within a workflow.
1295
+ * Information about a single signature.
896
1296
  */
897
- interface TransactionNodeData {
898
- /** Block height */
1297
+ interface SignatureInfo$1 {
1298
+ /** Transaction signature (base58). */
1299
+ signature: string;
1300
+ /** Block height where the transaction was processed. */
1301
+ blockHeight: bigint;
1302
+ /** Unix timestamp of the block. */
1303
+ blockTime: bigint;
1304
+ /** Error message if the transaction failed. */
1305
+ err?: string;
1306
+ }
1307
+ /**
1308
+ * Kind of subscription.
1309
+ */
1310
+ type SubscriptionKind$1 = "Persistent" | "OneShot";
1311
+ /**
1312
+ * Metadata about an account used in a subscription instruction.
1313
+ */
1314
+ interface SubscriptionAccountMeta {
1315
+ /** The account's public key (base58). */
1316
+ pubkey: string;
1317
+ /** Whether the account must sign the transaction. */
1318
+ isSigner: boolean;
1319
+ /** Whether the account can be written to during execution. */
1320
+ isWritable: boolean;
1321
+ }
1322
+ /**
1323
+ * A single instruction within a subscription.
1324
+ */
1325
+ interface SubscriptionInstruction {
1326
+ /** The program ID invoked (base58). */
1327
+ programId: string;
1328
+ /** Metadata for the accounts involved in the instruction. */
1329
+ accounts: SubscriptionAccountMeta[];
1330
+ /** Opaque binary data passed to the program. */
1331
+ data: Uint8Array;
1332
+ }
1333
+ /**
1334
+ * A subscription record.
1335
+ */
1336
+ interface Subscription$1 {
1337
+ kind: SubscriptionKind$1;
1338
+ topic: string;
1339
+ /** Instructions to be executed when triggered. */
1340
+ instructions: SubscriptionInstruction[];
1341
+ subscriber: string;
1342
+ /** The account pubkey (base58) that stores the event data. */
1343
+ eventAccount?: string;
1344
+ /** Timestamp range for triggering (start inclusive, end exclusive). */
1345
+ timestampRange?: [bigint, bigint];
1346
+ }
1347
+ /**
1348
+ * A transaction triggered by a subscription.
1349
+ */
1350
+ interface TriggeredTransaction$1 {
1351
+ /** Transaction signature (base58). */
1352
+ signature: string;
1353
+ /** Block number where executed. */
1354
+ blockNumber: bigint;
1355
+ }
1356
+ /**
1357
+ * Event data from a workflow trigger.
1358
+ */
1359
+ interface EventData$1 {
1360
+ topic: string;
1361
+ }
1362
+ /**
1363
+ * Timestamp range.
1364
+ */
1365
+ interface TimestampRange$1 {
1366
+ start: bigint;
1367
+ end: bigint;
1368
+ }
1369
+ /**
1370
+ * Information about what triggered a workflow transaction.
1371
+ */
1372
+ interface TriggerInfo$1 {
1373
+ event: EventData$1;
1374
+ subscriptionPubkey: string;
1375
+ timestampRange?: TimestampRange$1;
1376
+ eventAccount?: string;
1377
+ }
1378
+ /**
1379
+ * Transaction data within a workflow node.
1380
+ */
1381
+ interface TransactionNodeData$1 {
899
1382
  blockHeight: bigint;
900
- /** Timestamp (unix) */
901
1383
  timestamp: bigint;
902
- /** Whether the transaction succeeded */
903
1384
  success: boolean;
904
- /** Number of instructions */
905
1385
  instructionCount: number;
906
- /** Program IDs of instructions (base58) */
907
1386
  instructionProgramIds: string[];
908
1387
  }
909
1388
  /**
910
1389
  * A node in the workflow lineage tree.
911
1390
  */
912
- interface WorkflowNode {
913
- /** Transaction signature (base58) */
1391
+ interface WorkflowNode$1 {
1392
+ /** Transaction signature (base58). */
914
1393
  id: string;
915
- /** Distance from root transaction */
1394
+ /** Distance from the root transaction. */
916
1395
  depth: number;
917
- /** Transaction data */
918
- data: TransactionNodeData;
919
- /** Subscriptions on this transaction */
920
- subscriptions: Subscription[];
921
- /** What triggered this transaction */
922
- triggeredBy?: TriggerInfo;
923
- /** Child transaction signatures (base58) */
1396
+ /** Transaction data. */
1397
+ data: TransactionNodeData$1;
1398
+ /** Subscriptions associated with this transaction. */
1399
+ subscriptions: Subscription$1[];
1400
+ /** Trigger information if this node was triggered by a subscription event. */
1401
+ triggeredBy?: TriggerInfo$1;
1402
+ /** Child transaction signatures. */
924
1403
  workflowChildren: string[];
925
- /** Whether there are more children not shown */
1404
+ /** Whether more children exist beyond what is shown. */
926
1405
  hasMoreChildren: boolean;
927
1406
  }
928
1407
  /**
929
- * Workflow lineage tree.
1408
+ * Reason for truncating workflow traversal.
930
1409
  */
931
- interface WorkflowLineage {
932
- /** Nodes in the workflow tree */
933
- workflowNodes: WorkflowNode[];
1410
+ type TruncationReason$1 = "maxDepth" | "maxNodes" | "none";
1411
+ /**
1412
+ * Workflow lineage request parameters.
1413
+ */
1414
+ interface GetWorkflowLineageRequest$1 {
1415
+ /** Root transaction signature (base58). */
1416
+ signature: string;
1417
+ /** Maximum traversal depth (1-100, default 3). */
1418
+ maxDepth?: number;
1419
+ /** Whether to include event details. */
1420
+ includeEvents?: boolean;
934
1421
  }
935
1422
  /**
936
- * Reason for truncating workflow lineage traversal.
1423
+ * Workflow lineage response.
1424
+ * The lineage tree structure.
937
1425
  */
938
- type TruncationReason = "MaxDepth" | "MaxNodes" | "None";
1426
+ interface WorkflowLineage$1 {
1427
+ /** All nodes (transactions) in the lineage tree. */
1428
+ workflowNodes: WorkflowNode$1[];
1429
+ }
939
1430
  /**
940
- * Get workflow lineage response.
1431
+ * Workflow lineage response.
941
1432
  */
942
- interface GetWorkflowLineageResponse {
943
- /** Workflow lineage tree */
944
- lineage: WorkflowLineage;
945
- /** Leaf transaction signatures (base58) */
1433
+ interface GetWorkflowLineageResponse$1 {
1434
+ /** The lineage graph data. */
1435
+ lineage: WorkflowLineage$1;
1436
+ /** Leaf transaction signatures (base58-encoded). */
946
1437
  leaves: string[];
947
- /** Whether traversal was truncated */
1438
+ /** Whether the traversal was truncated due to max-depth. */
948
1439
  truncated: boolean;
949
- /** Reason for truncation */
950
- truncationReason: TruncationReason;
951
- /** Hints for continuing traversal (base58 signatures) */
1440
+ /** The reason for truncation. */
1441
+ truncationReason: TruncationReason$1;
1442
+ /** Hints for continuation (base58-encoded). */
952
1443
  continuationHints: string[];
953
1444
  }
954
1445
  /**
955
- * Get signatures for address configuration.
1446
+ * Configuration for paginated transaction queries.
956
1447
  */
957
- interface GetSignaturesForAddressConfig {
958
- /** Maximum number of signatures to return */
1448
+ interface GetTransactionsConfig {
1449
+ /** Maximum number of transactions to return. */
959
1450
  limit?: number;
960
- /** Start searching backwards from this signature */
1451
+ /** Cursor for pagination. */
961
1452
  before?: string;
962
- /** Start searching forwards from this signature */
963
- until?: string;
964
1453
  }
965
1454
  /**
966
- * Signature information.
1455
+ * Brief info about a transaction in a paginated list.
967
1456
  */
968
- interface SignatureInfo {
1457
+ interface TransactionInfo {
1458
+ /** Transaction signature (base58). */
969
1459
  signature: string;
970
- blockHeight: bigint;
971
- blockTime: bigint;
1460
+ /** Slot where the transaction was processed. */
1461
+ slot: bigint;
1462
+ /** Block time (unix timestamp). */
1463
+ blockTime?: bigint;
1464
+ /** Error message if failed. */
972
1465
  err?: string;
1466
+ /** Transaction version. */
1467
+ version?: string;
973
1468
  }
974
1469
  /**
975
- * Get health response.
1470
+ * Filter for what kind of accounts to return.
976
1471
  */
977
- type GetHealthResponse = "ok" | string;
1472
+ type AccountFilter$1 = "programAccounts" | "tokenAccounts";
978
1473
  /**
979
- * Get transactions response.
1474
+ * Configuration for getAccountsByOwner pagination.
980
1475
  */
981
- interface GetTransactionsResponse {
982
- /** Array of transaction data */
983
- transactions: Array<Record<string, unknown>>;
1476
+ interface GetAccountsByOwnerConfig$1 {
1477
+ /** Maximum number of accounts to return. */
1478
+ limit?: number;
1479
+ /** Cursor for pagination: accounts after this pubkey (base58). */
1480
+ after?: string;
984
1481
  }
985
1482
  /**
986
- * Signature status from the RPC.
1483
+ * An account returned by getAccountsByOwner.
987
1484
  */
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;
1485
+ interface OwnerAccount$1 {
1486
+ /** Account public key. */
1487
+ pubkey: PublicKey;
1488
+ /** Account information. */
1489
+ account: AccountInfo$1;
995
1490
  }
996
1491
  /**
997
- * Options for confirming a transaction.
1492
+ * Pagination metadata.
998
1493
  */
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;
1494
+ interface PaginationInfo$1 {
1495
+ hasMore: boolean;
1496
+ nextCursor?: string;
1004
1497
  }
1498
+ /** A single entry in a getMultipleAccounts response.
1499
+ Absent if the account does not exist. */
1500
+ type OptionalAccountInfo = AccountInfo$1 | undefined;
1005
1501
  /**
1006
- * Options for sending and confirming a transaction.
1502
+ * Validator health status.
1007
1503
  */
1008
- interface SendAndConfirmOptions extends SendTransactionOptions, ConfirmTransactionOptions {
1504
+ interface ValidatorHealth {
1505
+ status: string;
1009
1506
  }
1010
1507
  /**
1011
- * Result of a confirmed transaction.
1508
+ * Connected full node info.
1012
1509
  */
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;
1510
+ interface ConnectedNode {
1511
+ /** Network public key (hex or base58). */
1512
+ publicKey: string;
1513
+ /** Connection duration in milliseconds. */
1514
+ connectedMs: bigint;
1020
1515
  }
1021
1516
  /**
1022
- * Configuration for getAccountsByOwner.
1517
+ * The TEE's X25519 public key for HPKE encryption.
1023
1518
  */
1024
- interface GetAccountsByOwnerConfig {
1025
- /** Maximum number of accounts to return */
1026
- limit?: number;
1027
- /** Cursor for pagination (base58 pubkey) */
1028
- after?: string;
1519
+ interface SecretSharingPubkey {
1520
+ /** Hex-encoded public key. */
1521
+ publicKey: string;
1029
1522
  }
1030
1523
  /**
1031
- * Filter for getAccountsByOwner.
1032
- * Matches Rust serde serialization format.
1524
+ * Request to submit an epoch change (admin-only).
1525
+ * Validator information for epoch change requests.
1033
1526
  */
1034
- type AccountFilter = {
1035
- type: "programAccounts";
1036
- } | {
1037
- type: "tokenAccounts";
1038
- mint?: string;
1039
- };
1527
+ interface ValidatorInfoRequest {
1528
+ /** Validator stake amount. */
1529
+ stake: bigint;
1530
+ /** Consensus network address (Multiaddr string). */
1531
+ consensusAddress: string;
1532
+ /** State sync network address (Multiaddr string). */
1533
+ stateSyncAddress: string;
1534
+ /** Validator hostname. */
1535
+ hostname: string;
1536
+ /** Authority public key. */
1537
+ authorityKey: string;
1538
+ /** Protocol public key. */
1539
+ protocolKey: string;
1540
+ /** Network public key. */
1541
+ networkKey: string;
1542
+ /** Signing public key. */
1543
+ signingKey: string;
1544
+ }
1040
1545
  /**
1041
- * An account owned by a program or address.
1546
+ * Consensus configuration parameters for an epoch change.
1042
1547
  */
1043
- interface OwnerAccount {
1044
- /** Account public key */
1045
- pubkey: PublicKey;
1046
- /** Account information */
1047
- account: AccountInfo;
1548
+ interface EpochConsensusConfigRequest {
1549
+ /** Number of leaders per round. */
1550
+ numLeadersPerRound?: number;
1551
+ /** Maximum transaction bytes per block. */
1552
+ maxTransactionsInBlockBytes?: bigint;
1553
+ /** Maximum number of transactions per block. */
1554
+ maxNumTransactionsInBlock?: bigint;
1555
+ /** Maximum size of a single transaction in bytes. */
1556
+ maxTransactionSizeBytes?: bigint;
1557
+ /** Garbage collection depth. */
1558
+ gcDepth?: number;
1559
+ /** Whether to enable zstd compression. */
1560
+ zstdCompression?: boolean;
1048
1561
  }
1049
1562
  /**
1050
- * Pagination information.
1563
+ * Request to submit an epoch change (admin-only).
1051
1564
  */
1052
- interface PaginationInfo {
1053
- /** Whether there are more results */
1054
- hasMore: boolean;
1055
- /** Cursor for next page (base58 pubkey) */
1056
- nextCursor?: string;
1565
+ interface SubmitEpochChangeRequest {
1566
+ /** The new epoch number. */
1567
+ newEpoch: bigint;
1568
+ /** List of validators for the new epoch. */
1569
+ validators: ValidatorInfoRequest[];
1570
+ /** Optional consensus configuration overrides. */
1571
+ consensusConfig?: EpochConsensusConfigRequest;
1057
1572
  }
1058
1573
  /**
1059
- * Get accounts by owner response.
1574
+ * Response from submitting an epoch change.
1060
1575
  */
1061
- interface GetAccountsByOwnerResponse {
1062
- /** Array of owned accounts */
1063
- value: OwnerAccount[];
1064
- /** Pagination information */
1065
- pagination?: PaginationInfo;
1576
+ interface SubmitEpochChangeResponse {
1577
+ /** Whether the submission was accepted. */
1578
+ success: boolean;
1579
+ }
1580
+ /**
1581
+ * Configuration for block queries.
1582
+ */
1583
+ interface GetBlockConfig {
1584
+ /** Transaction detail level: "full", "signatures", or "none".
1585
+ Default: "full". */
1586
+ transactionDetails?: string;
1587
+ }
1588
+ /**
1589
+ * Information about a block.
1590
+ */
1591
+ interface BlockInfo {
1592
+ /** The blockhash (base58). */
1593
+ blockhash: string;
1594
+ /** Block height. */
1595
+ blockHeight: bigint;
1596
+ /** Unix timestamp of the block. */
1597
+ blockTime: bigint;
1598
+ /** Full transactions with metadata (present when transaction-details = "full"). */
1599
+ transactions?: TransactionWithMeta[];
1600
+ /** Transaction signatures only (present when transaction-details = "signatures"). */
1601
+ signatures?: string[];
1602
+ }
1603
+ /**
1604
+ * Configuration for getAllAccounts.
1605
+ */
1606
+ interface GetAllAccountsConfig {
1607
+ /** Encoding for account data (e.g. "base64"). */
1608
+ encoding?: string;
1609
+ /** Whether to include account data in the response. */
1610
+ includeData?: boolean;
1611
+ }
1612
+ /**
1613
+ * An entry in the getAllAccounts response.
1614
+ */
1615
+ interface AllAccountsEntry {
1616
+ /** Account public key (base58). */
1617
+ pubkey: string;
1618
+ /** Account information. */
1619
+ account: AccountInfo$1;
1620
+ }
1621
+ /**
1622
+ * State of a stake account.
1623
+ */
1624
+ type StakeState = "inactive" | "activating" | "active" | "deactivating" | "unbonding";
1625
+ /**
1626
+ * Information about a stake account.
1627
+ */
1628
+ interface StakeAccountInfo {
1629
+ /** Current state of the stake account. */
1630
+ state: StakeState;
1631
+ /** Total kelvins in the account. */
1632
+ kelvins: bigint;
1633
+ /** Amount delegated to validator (0 when inactive). */
1634
+ delegatedBalance: bigint;
1635
+ /** Undelegated amount. */
1636
+ undelegatedBalance: bigint;
1637
+ /** Unix timestamp (ms) when ActivateStake was called. */
1638
+ activationRequested?: bigint;
1639
+ /** Unix timestamp (ms) when DeactivateStake was called. */
1640
+ deactivationRequested?: bigint;
1641
+ /** Validator info account (base58), absent if not delegated. */
1642
+ validator?: string;
1643
+ /** Admin authority (hot wallet, base58). */
1644
+ adminAuthority: string;
1645
+ /** Withdraw authority (cold wallet, base58). */
1646
+ withdrawAuthority: string;
1647
+ }
1648
+ /**
1649
+ * Request parameters for getValidatorAccounts.
1650
+ */
1651
+ interface GetValidatorAccountsRequest {
1652
+ /** If true, return from last frozen epoch; if false, return from pending. */
1653
+ useFrozen: boolean;
1654
+ }
1655
+ /**
1656
+ * Information about a validator account.
1657
+ */
1658
+ interface ValidatorAccountInfo {
1659
+ /** Accumulated commission (kelvins) in the validator account. */
1660
+ commission: bigint;
1661
+ /** Public key of the validator info account (base58). */
1662
+ pubkey: string;
1663
+ /** Node's public key / initial authorized withdrawer (base58). */
1664
+ nodeIdentity: string;
1665
+ /** Authority who can withdraw rewards (base58). */
1666
+ authorizedWithdrawer: string;
1667
+ /** Amount of token staked for next epoch. */
1668
+ stakeNext: bigint;
1669
+ /** Amount of token staked for current epoch (from last frozen snapshot). */
1670
+ stakeCurrent?: bigint;
1671
+ /** Network address for communicating with the validator. */
1672
+ address: string;
1673
+ }
1674
+ /**
1675
+ * SPL Token account balance information.
1676
+ */
1677
+ interface TokenBalance {
1678
+ /** Raw token amount as string. */
1679
+ amount: string;
1680
+ /** Number of decimals for the token. */
1681
+ decimals: number;
1682
+ /** Human-readable amount string. */
1683
+ uiAmountString: string;
1684
+ }
1685
+ /**
1686
+ * Information about a node in the cluster.
1687
+ */
1688
+ interface ClusterNodeInfo {
1689
+ /** Stake amount in kelvins. */
1690
+ stake: bigint;
1691
+ /** Network address. */
1692
+ address: string;
1693
+ /** Hostname of the node. */
1694
+ hostname: string;
1695
+ /** Authority public key (base58). */
1696
+ authorityPubkey: string;
1697
+ /** Protocol public key (base58). */
1698
+ protocolPubkey: string;
1699
+ /** Network public key (base58). */
1700
+ networkPubkey: string;
1701
+ /** Last committed consensus round (if available). */
1702
+ lastCommittedRound?: number;
1703
+ }
1704
+ /**
1705
+ * A single REX duty assignment.
1706
+ */
1707
+ interface RexDuty {
1708
+ /** Target timestamp for the duty. */
1709
+ targetTimestamp: string;
1710
+ /** Validators assigned to this duty (base58 pubkeys). */
1711
+ assignedValidators: string[];
1712
+ }
1713
+ /**
1714
+ * Information about a REX request and its duties.
1715
+ */
1716
+ interface RexInfoAndDuties {
1717
+ /** Pubkey of account that created the REX (base58). */
1718
+ creator: string;
1719
+ /** Hex representation of the REX's nonce. */
1720
+ nonce: string;
1721
+ /** Whether the REX is currently active. */
1722
+ isActive: boolean;
1723
+ /** Description of the REX request. */
1724
+ description: string;
1725
+ /** Update frequency. */
1726
+ updateFrequency: string;
1727
+ /** Starting timestamp. */
1728
+ startingTimestamp: string;
1729
+ /** Creation timestamp. */
1730
+ createdAt: string;
1731
+ /** Number of validators per duty. */
1732
+ validatorsPerDuty: number;
1733
+ /** Delay in milliseconds for REX request processing. */
1734
+ rexRequestDelayMs: bigint;
1735
+ /** List of duties expecting updates or commitment. */
1736
+ duties: RexDuty[];
1737
+ }
1738
+
1739
+ /**
1740
+ * RpcClient interface — generated from spec.wit.
1741
+ *
1742
+ * Every method corresponds to a function in the `rpc-client` interface.
1743
+ */
1744
+ declare abstract class RpcClient {
1745
+ /**
1746
+ * Gets the balance of an account in kelvins.
1747
+ *
1748
+ * # Parameters
1749
+ *
1750
+ * * `pubkey` - The public key (address) of the account to query.
1751
+ *
1752
+ * # Returns
1753
+ *
1754
+ * The account balance in the smallest denomination of the native token (kelvins).
1755
+ *
1756
+ * # Errors
1757
+ *
1758
+ * Returns an error if the RPC call fails or the account does not exist.
1759
+ */
1760
+ abstract getBalance(pubkey: PublicKey): Promise<Kelvin>;
1761
+ /**
1762
+ * Gets detailed information about an on-chain account.
1763
+ *
1764
+ * # Parameters
1765
+ *
1766
+ * * `pubkey` - The public key (address) of the account to query.
1767
+ *
1768
+ * # Returns
1769
+ *
1770
+ * Detailed account information including balance, owner, data, and executable flag.
1771
+ *
1772
+ * # Errors
1773
+ *
1774
+ * Returns an error if the RPC call fails or the account does not exist.
1775
+ */
1776
+ abstract getAccountInfo(pubkey: PublicKey): Promise<AccountInfo$1>;
1777
+ /**
1778
+ * Gets the current finalized block height from the blockchain.
1779
+ *
1780
+ * The block height represents the number of blocks produced since genesis.
1781
+ * Always returns the finalized block height for consistency.
1782
+ *
1783
+ * # Returns
1784
+ *
1785
+ * The current finalized block height.
1786
+ *
1787
+ * # Errors
1788
+ *
1789
+ * Returns an error if the RPC call fails.
1790
+ */
1791
+ abstract getBlockHeight(): Promise<bigint>;
1792
+ /**
1793
+ * Gets the current finalized block height with advanced configuration.
1794
+ *
1795
+ * Provides access to advanced parameters for block height retrieval,
1796
+ * specifically minimum context slot requirements.
1797
+ *
1798
+ * # Parameters
1799
+ *
1800
+ * * `min-context-slot` - The minimum context slot that the server must have
1801
+ * reached before responding. If absent, no minimum is required.
1802
+ *
1803
+ * # Returns
1804
+ *
1805
+ * The current finalized block height.
1806
+ *
1807
+ * # Errors
1808
+ *
1809
+ * Returns an error if the RPC call fails.
1810
+ */
1811
+ abstract getBlockHeightWithConfig(minContextSlot: bigint | undefined): Promise<bigint>;
1812
+ /**
1813
+ * Gets detailed information about a transaction by its signature.
1814
+ *
1815
+ * # Parameters
1816
+ *
1817
+ * * `sig` - The transaction signature to look up.
1818
+ *
1819
+ * # Returns
1820
+ *
1821
+ * Full transaction details including block height, block hash, timestamp,
1822
+ * execution metadata (fee, errors), and the transaction content.
1823
+ *
1824
+ * # Errors
1825
+ *
1826
+ * Returns an error if the RPC call fails or the transaction is not found.
1827
+ */
1828
+ abstract getTransaction(sig: Signature): Promise<TransactionResponse$1>;
1829
+ /**
1830
+ * Gets the total number of transactions processed since genesis.
1831
+ *
1832
+ * # Returns
1833
+ *
1834
+ * The total transaction count.
1835
+ *
1836
+ * # Errors
1837
+ *
1838
+ * Returns an error if the RPC call fails.
1839
+ */
1840
+ abstract getTransactionCount(): Promise<bigint>;
1841
+ /**
1842
+ * Calculates the minimum balance required for rent exemption.
1843
+ *
1844
+ * Accounts with at least this balance are exempt from paying rent.
1845
+ *
1846
+ * # Parameters
1847
+ *
1848
+ * * `data-size` - The size of the account data in bytes.
1849
+ *
1850
+ * # Returns
1851
+ *
1852
+ * The minimum balance (in kelvins) required for rent exemption.
1853
+ *
1854
+ * # Errors
1855
+ *
1856
+ * Returns an error if the RPC call fails.
1857
+ */
1858
+ abstract getMinimumBalanceForRentExemption(dataSize: bigint): Promise<bigint>;
1859
+ /**
1860
+ * Gets the status of multiple transaction signatures.
1861
+ *
1862
+ * # Parameters
1863
+ *
1864
+ * * `signatures` - A list of transaction signatures to query.
1865
+ *
1866
+ * # Returns
1867
+ *
1868
+ * A list of signature statuses (slot, executed, error) corresponding
1869
+ * to the input signatures.
1870
+ *
1871
+ * # Errors
1872
+ *
1873
+ * Returns an error if the RPC call fails.
1874
+ */
1875
+ abstract getSignatureStatuses(signatures: Signature[]): Promise<(SignatureStatus$1 | undefined)[]>;
1876
+ /**
1877
+ * Gets signatures associated with an address, with optional pagination.
1878
+ *
1879
+ * # Parameters
1880
+ *
1881
+ * * `address` - The address to query signatures for.
1882
+ * * `config` - Optional configuration for pagination (limit, before, until).
1883
+ *
1884
+ * # Returns
1885
+ *
1886
+ * A list of signature info records for the given address.
1887
+ *
1888
+ * # Errors
1889
+ *
1890
+ * Returns an error if the RPC call fails.
1891
+ */
1892
+ abstract getSignaturesForAddress(address: PublicKey, config: GetSignaturesForAddressConfig$1 | undefined): Promise<SignatureInfo$1[]>;
1893
+ /**
1894
+ * Gets current epoch information.
1895
+ *
1896
+ * # Returns
1897
+ *
1898
+ * Epoch information including epoch number, slot indices, block height,
1899
+ * and transaction count.
1900
+ *
1901
+ * # Errors
1902
+ *
1903
+ * Returns an error if the RPC call fails.
1904
+ */
1905
+ abstract getEpochInfo(): Promise<EpochInfo>;
1906
+ /**
1907
+ * Gets the fee for a given serialized message.
1908
+ *
1909
+ * # Parameters
1910
+ *
1911
+ * * `message` - The base64-encoded serialized message to calculate fees for.
1912
+ *
1913
+ * # Returns
1914
+ *
1915
+ * A fee response containing the fee in kelvins, or absent if the message
1916
+ * is invalid.
1917
+ *
1918
+ * # Errors
1919
+ *
1920
+ * Returns an error if the RPC call fails.
1921
+ */
1922
+ abstract getFeeForMessage(message: string): Promise<FeeResponse>;
1923
+ /**
1924
+ * Gets information for multiple accounts in a single request.
1925
+ *
1926
+ * # Parameters
1927
+ *
1928
+ * * `pubkeys` - A list of public keys to query.
1929
+ *
1930
+ * # Returns
1931
+ *
1932
+ * A list of optional account info records. Each entry is absent if that
1933
+ * account does not exist.
1934
+ *
1935
+ * # Errors
1936
+ *
1937
+ * Returns an error if the RPC call fails.
1938
+ */
1939
+ abstract getMultipleAccounts(pubkeys: PublicKey[]): Promise<OptionalAccountInfo[]>;
1940
+ /**
1941
+ * Gets accounts owned by a given program or address.
1942
+ *
1943
+ * Returns all accounts whose owner matches the specified public key,
1944
+ * along with optional pagination metadata.
1945
+ *
1946
+ * # Parameters
1947
+ *
1948
+ * * `owner` - The public key of the owner/program to query accounts for.
1949
+ * * `filter` - Optional filter to specify account type (program accounts
1950
+ * or token accounts). Defaults to program-accounts if absent.
1951
+ * * `config` - Optional pagination configuration (limit, after cursor).
1952
+ *
1953
+ * # Returns
1954
+ *
1955
+ * A tuple of (accounts list, optional pagination info).
1956
+ *
1957
+ * # Errors
1958
+ *
1959
+ * Returns an error if the RPC call fails.
1960
+ */
1961
+ abstract getAccountsByOwner(owner: PublicKey, filter: AccountFilter$1 | undefined, config: GetAccountsByOwnerConfig$1 | undefined): Promise<[OwnerAccount$1[], PaginationInfo$1 | undefined]>;
1962
+ /**
1963
+ * Gets a subscription by subscriber public key and nonce.
1964
+ *
1965
+ * # Parameters
1966
+ *
1967
+ * * `subscriber` - The public key of the subscriber.
1968
+ * * `nonce` - The nonce identifying the specific subscription.
1969
+ *
1970
+ * # Returns
1971
+ *
1972
+ * The subscription record (kind, topic, subscriber, event-account).
1973
+ *
1974
+ * # Errors
1975
+ *
1976
+ * Returns an error if the RPC call fails or the subscription is not found.
1977
+ */
1978
+ abstract getSubscription(subscriber: PublicKey, nonce: string): Promise<Subscription$1>;
1979
+ /**
1980
+ * Gets transactions triggered by a subscription.
1981
+ *
1982
+ * Returns transactions that were automatically triggered in response to
1983
+ * subscription matches or other programmatic conditions.
1984
+ *
1985
+ * # Parameters
1986
+ *
1987
+ * * `subscription-account` - The public key of the subscription account.
1988
+ * * `limit` - Optional maximum number of transactions to return.
1989
+ *
1990
+ * # Returns
1991
+ *
1992
+ * A list of triggered transaction records (signature, block number).
1993
+ *
1994
+ * # Errors
1995
+ *
1996
+ * Returns an error if the RPC call fails.
1997
+ */
1998
+ abstract getTriggeredTransactions(subscriptionAccount: PublicKey, limit: number | undefined): Promise<TriggeredTransaction$1[]>;
1999
+ /**
2000
+ * Gets the workflow lineage tree for a transaction.
2001
+ *
2002
+ * Traverses the chain of workflow-triggered transactions starting from
2003
+ * a root transaction, building a tree of parent-child relationships.
2004
+ *
2005
+ * # Parameters
2006
+ *
2007
+ * * `request` - The lineage request including root signature, max depth,
2008
+ * and whether to include event details.
2009
+ *
2010
+ * # Returns
2011
+ *
2012
+ * The workflow lineage response with nodes, leaves, and truncation info.
2013
+ *
2014
+ * # Errors
2015
+ *
2016
+ * Returns an error if the RPC call fails or the root transaction is not found.
2017
+ */
2018
+ abstract getWorkflowLineage(request: GetWorkflowLineageRequest$1): Promise<GetWorkflowLineageResponse$1>;
2019
+ /**
2020
+ * Gets paginated transactions from the blockchain.
2021
+ *
2022
+ * Returns a list of transactions, optionally filtered and paginated.
2023
+ * Useful for transaction monitoring, analytics, and debugging.
2024
+ *
2025
+ * # Parameters
2026
+ *
2027
+ * * `config` - Optional configuration for pagination (limit, before cursor).
2028
+ * If absent, defaults apply (limit: 100).
2029
+ *
2030
+ * # Returns
2031
+ *
2032
+ * A list of transaction info records with signatures, slots, block times,
2033
+ * and error status.
2034
+ *
2035
+ * # Errors
2036
+ *
2037
+ * Returns an error if the RPC call fails.
2038
+ */
2039
+ abstract getTransactions(config: GetTransactionsConfig | undefined): Promise<TransactionInfo[]>;
2040
+ /**
2041
+ * Checks if a blockhash is still valid for transaction submission.
2042
+ *
2043
+ * # Parameters
2044
+ *
2045
+ * * `blockhash` - The blockhash to validate.
2046
+ *
2047
+ * # Returns
2048
+ *
2049
+ * `true` if the blockhash is still valid, `false` otherwise.
2050
+ *
2051
+ * # Errors
2052
+ *
2053
+ * Returns an error if the RPC call fails.
2054
+ */
2055
+ abstract isBlockhashValid(blockhash: Hash): Promise<IsBlockhashValidResponse>;
2056
+ /**
2057
+ * Gets the health status of the RPC node.
2058
+ *
2059
+ * # Returns
2060
+ *
2061
+ * A health status string, typically "ok" when the node is healthy.
2062
+ *
2063
+ * # Errors
2064
+ *
2065
+ * Returns an error if the RPC call fails or the node is unhealthy.
2066
+ */
2067
+ abstract getHealth(): Promise<string>;
2068
+ /**
2069
+ * Gets the health status of the validator.
2070
+ *
2071
+ * # Returns
2072
+ *
2073
+ * The validator health status record.
2074
+ *
2075
+ * # Errors
2076
+ *
2077
+ * Returns an error if the RPC call fails.
2078
+ */
2079
+ abstract getValidatorHealth(): Promise<ValidatorHealth>;
2080
+ /**
2081
+ * Gets the list of full nodes connected to the validator or full node.
2082
+ *
2083
+ * # Returns
2084
+ *
2085
+ * A list of connected nodes, each identified by a network public key
2086
+ * and connection duration in milliseconds.
2087
+ *
2088
+ * # Errors
2089
+ *
2090
+ * Returns an error if the RPC call fails.
2091
+ */
2092
+ abstract getConnectedFullNodes(): Promise<ConnectedNode[]>;
2093
+ /**
2094
+ * Gets the TEE's secret sharing public key for HPKE encryption.
2095
+ *
2096
+ * This public key is used to encrypt secrets that only the TEE cluster
2097
+ * can decrypt.
2098
+ *
2099
+ * # Returns
2100
+ *
2101
+ * The X25519 public key (hex-encoded) used for HPKE encryption.
2102
+ *
2103
+ * # Errors
2104
+ *
2105
+ * Returns an error if the RPC call fails, the TEE Registry state account
2106
+ * doesn't exist, or the secret sharing public key has not been registered.
2107
+ */
2108
+ abstract getSecretSharingPubkey(): Promise<SecretSharingPubkey>;
2109
+ /**
2110
+ * Gets the config hash prefix for protecting against replay attacks.
2111
+ *
2112
+ * Retrieves the first 64 bits of the config hash, which is used for
2113
+ * transaction replay protection across chains.
2114
+ *
2115
+ * # Returns
2116
+ *
2117
+ * The config hash prefix as a u64 value.
2118
+ *
2119
+ * # Errors
2120
+ *
2121
+ * Returns an error if the RPC call fails.
2122
+ */
2123
+ abstract getConfigHashPrefix(): Promise<ConfigHashPrefix>;
2124
+ /**
2125
+ * Gets all accounts in the system.
2126
+ *
2127
+ * **Warning:** This can be very expensive on large networks. Intended
2128
+ * primarily for testing and debugging on local/devnet.
2129
+ *
2130
+ * # Parameters
2131
+ *
2132
+ * * `config` - Optional configuration for encoding and data inclusion.
2133
+ *
2134
+ * # Returns
2135
+ *
2136
+ * A list of all account entries (pubkey + account info).
2137
+ *
2138
+ * # Errors
2139
+ *
2140
+ * Returns an error if the RPC call fails.
2141
+ */
2142
+ abstract getAllAccounts(config: GetAllAccountsConfig | undefined): Promise<AllAccountsEntry[]>;
2143
+ /**
2144
+ * Gets a block by its height.
2145
+ *
2146
+ * # Parameters
2147
+ *
2148
+ * * `block-height` - The block height to query.
2149
+ * * `config` - Optional configuration for transaction detail level
2150
+ * ("full", "signatures", or "none"). Defaults to "full".
2151
+ *
2152
+ * # Returns
2153
+ *
2154
+ * Block information including blockhash, timestamp, and transactions
2155
+ * (detail level depends on config).
2156
+ *
2157
+ * # Errors
2158
+ *
2159
+ * Returns an error if the RPC call fails or the block is not found.
2160
+ */
2161
+ abstract getBlock(blockHeight: bigint, config: GetBlockConfig | undefined): Promise<BlockInfo>;
2162
+ /**
2163
+ * Gets a list of confirmed block heights in a range (inclusive).
2164
+ *
2165
+ * # Parameters
2166
+ *
2167
+ * * `start-height` - The start of the block height range.
2168
+ * * `end-height` - The end of the range. If absent, returns up to the
2169
+ * latest confirmed block.
2170
+ *
2171
+ * # Returns
2172
+ *
2173
+ * A list of confirmed block height numbers.
2174
+ *
2175
+ * # Errors
2176
+ *
2177
+ * Returns an error if the RPC call fails.
2178
+ */
2179
+ abstract getBlocks(startHeight: bigint, endHeight: bigint | undefined): Promise<bigint[]>;
2180
+ /**
2181
+ * Gets detailed information about a stake account.
2182
+ *
2183
+ * # Parameters
2184
+ *
2185
+ * * `pubkey` - The public key of the stake account.
2186
+ *
2187
+ * # Returns
2188
+ *
2189
+ * The stake account info (state, balances, authorities), or absent if
2190
+ * the account is not a valid stake account.
2191
+ *
2192
+ * # Errors
2193
+ *
2194
+ * Returns an error if the RPC call fails.
2195
+ */
2196
+ abstract getStakeAccount(pubkey: PublicKey): Promise<StakeAccountInfo | undefined>;
2197
+ /**
2198
+ * Gets all registered validator accounts.
2199
+ *
2200
+ * # Parameters
2201
+ *
2202
+ * * `request` - Request parameters specifying whether to use the frozen
2203
+ * (last epoch) or pending (current) snapshot.
2204
+ *
2205
+ * # Returns
2206
+ *
2207
+ * A list of validator account info records.
2208
+ *
2209
+ * # Errors
2210
+ *
2211
+ * Returns an error if the RPC call fails.
2212
+ */
2213
+ abstract getValidatorAccounts(request: GetValidatorAccountsRequest): Promise<ValidatorAccountInfo[]>;
2214
+ /**
2215
+ * Gets the token balance of an SPL Token account.
2216
+ *
2217
+ * # Parameters
2218
+ *
2219
+ * * `pubkey` - The public key of the SPL Token account.
2220
+ *
2221
+ * # Returns
2222
+ *
2223
+ * Token balance information including raw amount, decimals, and
2224
+ * human-readable amount string.
2225
+ *
2226
+ * # Errors
2227
+ *
2228
+ * Returns an error if the RPC call fails or the account is not a valid
2229
+ * token account.
2230
+ */
2231
+ abstract getTokenAccountBalance(pubkey: PublicKey): Promise<TokenBalance>;
2232
+ /**
2233
+ * Gets registered REX requests for a creator.
2234
+ *
2235
+ * # Parameters
2236
+ *
2237
+ * * `creator` - The public key of the REX creator.
2238
+ * * `nonce` - Optional nonce to filter for a specific REX request.
2239
+ * If absent, returns all requests by the creator.
2240
+ *
2241
+ * # Returns
2242
+ *
2243
+ * A list of REX request records with their associated duties.
2244
+ *
2245
+ * # Errors
2246
+ *
2247
+ * Returns an error if the RPC call fails.
2248
+ */
2249
+ abstract getRexRequests(creator: PublicKey, nonce: string | undefined): Promise<RexInfoAndDuties[]>;
2250
+ /**
2251
+ * Gets missed REX duty proposal rounds for a specific REX request.
2252
+ *
2253
+ * # Parameters
2254
+ *
2255
+ * * `creator` - The public key of the REX creator.
2256
+ * * `nonce` - The nonce identifying the specific REX request.
2257
+ *
2258
+ * # Returns
2259
+ *
2260
+ * A list of proposal round numbers where duties were missed.
2261
+ *
2262
+ * # Errors
2263
+ *
2264
+ * Returns an error if the RPC call fails.
2265
+ */
2266
+ abstract getRexMissedDuties(creator: PublicKey, nonce: string): Promise<bigint[]>;
2267
+ /**
2268
+ * Gets information about all known cluster nodes.
2269
+ *
2270
+ * # Returns
2271
+ *
2272
+ * A list of cluster node info records including stake, addresses,
2273
+ * and public keys.
2274
+ *
2275
+ * # Errors
2276
+ *
2277
+ * Returns an error if the RPC call fails.
2278
+ */
2279
+ abstract getClusterNodes(): Promise<ClusterNodeInfo[]>;
2280
+ /**
2281
+ * Gets the list of validator indices this node is connected to.
2282
+ *
2283
+ * # Returns
2284
+ *
2285
+ * A list of validator indices (u32).
2286
+ *
2287
+ * # Errors
2288
+ *
2289
+ * Returns an error if the RPC call fails.
2290
+ */
2291
+ abstract getConnectedValidators(): Promise<number[]>;
2292
+ /**
2293
+ * Submits a signed transaction to the network.
2294
+ *
2295
+ * # Parameters
2296
+ *
2297
+ * * `transaction` - The serialized, signed transaction as a byte array.
2298
+ * * `options` - Optional send options (skip preflight, max retries).
2299
+ * If absent, default options are used.
2300
+ *
2301
+ * # Returns
2302
+ *
2303
+ * The transaction signature, which can be used to check its status.
2304
+ *
2305
+ * # Errors
2306
+ *
2307
+ * Returns an error if the RPC call fails or the transaction is rejected.
2308
+ */
2309
+ abstract sendTransaction(transaction: Uint8Array, options: SendTransactionOptions$1 | undefined): Promise<Signature>;
2310
+ /**
2311
+ * Requests an airdrop of tokens to the specified account.
2312
+ *
2313
+ * This method is typically only available on test networks (localnet, devnet).
2314
+ *
2315
+ * # Parameters
2316
+ *
2317
+ * * `pubkey` - The public key of the recipient account.
2318
+ * * `amount` - The amount of kelvins to airdrop.
2319
+ *
2320
+ * # Returns
2321
+ *
2322
+ * The transaction signature of the airdrop transaction.
2323
+ *
2324
+ * # Errors
2325
+ *
2326
+ * Returns an error if the RPC call fails or airdrops are not supported.
2327
+ */
2328
+ abstract requestAirdrop(pubkey: PublicKey, amount: Kelvin): Promise<Signature>;
2329
+ /**
2330
+ * Polls until a transaction is confirmed or times out.
2331
+ *
2332
+ * This is a CDK compound method (not a single RPC call). It repeatedly
2333
+ * calls getSignatureStatuses until the transaction is confirmed or the
2334
+ * retry limit is reached.
2335
+ *
2336
+ * # Parameters
2337
+ *
2338
+ * * `sig` - The transaction signature (base58) to monitor.
2339
+ * * `options` - Optional confirmation options (max retries, retry delay).
2340
+ * Defaults: 30 retries, 1000ms delay.
2341
+ *
2342
+ * # Returns
2343
+ *
2344
+ * A confirmed transaction record with signature, executed status, and error.
2345
+ *
2346
+ * # Errors
2347
+ *
2348
+ * Returns an error if the transaction fails or confirmation times out.
2349
+ */
2350
+ abstract confirmTransaction(sig: string, options: ConfirmTransactionOptions$1 | undefined): Promise<ConfirmedTransaction$1>;
2351
+ /**
2352
+ * Sends a transaction and waits for confirmation.
2353
+ *
2354
+ * This is a CDK compound method that combines send-transaction and
2355
+ * confirm-transaction into a single call.
2356
+ *
2357
+ * # Parameters
2358
+ *
2359
+ * * `transaction` - The serialized, signed transaction as a byte array.
2360
+ * * `options` - Optional combined send-and-confirm options.
2361
+ *
2362
+ * # Returns
2363
+ *
2364
+ * A confirmed transaction record with signature, executed status, and error.
2365
+ *
2366
+ * # Errors
2367
+ *
2368
+ * Returns an error if sending fails, the transaction is rejected,
2369
+ * or confirmation times out.
2370
+ */
2371
+ abstract sendAndConfirmTransaction(transaction: Uint8Array, options: SendAndConfirmOptions$1 | undefined): Promise<ConfirmedTransaction$1>;
2372
+ /**
2373
+ * Requests an airdrop and waits for confirmation.
2374
+ *
2375
+ * This is a CDK compound method that combines request-airdrop and
2376
+ * confirm-transaction into a single call.
2377
+ *
2378
+ * # Parameters
2379
+ *
2380
+ * * `pubkey` - The public key of the recipient account.
2381
+ * * `amount` - The amount of kelvins to airdrop.
2382
+ *
2383
+ * # Returns
2384
+ *
2385
+ * A confirmed transaction record for the airdrop.
2386
+ *
2387
+ * # Errors
2388
+ *
2389
+ * Returns an error if the airdrop fails or confirmation times out.
2390
+ */
2391
+ abstract requestAirdropAndConfirm(pubkey: PublicKey, amount: Kelvin): Promise<ConfirmedTransaction$1>;
2392
+ /**
2393
+ * Submits an epoch change transaction (admin-only).
2394
+ *
2395
+ * This is a restricted admin method used for epoch management.
2396
+ * Only available to authorized admin accounts.
2397
+ *
2398
+ * # Parameters
2399
+ *
2400
+ * * `request` - The epoch change request containing serialized data.
2401
+ *
2402
+ * # Returns
2403
+ *
2404
+ * A response indicating whether the submission was accepted.
2405
+ *
2406
+ * # Errors
2407
+ *
2408
+ * Returns an error if the RPC call fails or the sender is not authorized.
2409
+ */
2410
+ abstract sendAdminTransaction(request: SubmitEpochChangeRequest): Promise<SubmitEpochChangeResponse>;
1066
2411
  }
1067
2412
 
1068
2413
  /**
@@ -1090,11 +2435,12 @@ interface GetAccountsByOwnerResponse {
1090
2435
  * const signature = await client.sendTransaction(signedTx);
1091
2436
  * ```
1092
2437
  */
1093
- declare class RialoClient {
2438
+ declare class RialoClient extends RpcClient {
1094
2439
  private readonly queryClient;
1095
2440
  private readonly transactionClient;
1096
2441
  private readonly transport;
1097
2442
  private readonly chain;
2443
+ private readonly rpcHelper;
1098
2444
  constructor(transport: HttpTransport, chain: ChainDefinition);
1099
2445
  /**
1100
2446
  * Returns the configured RPC endpoint URL.
@@ -1111,27 +2457,31 @@ declare class RialoClient {
1111
2457
  /**
1112
2458
  * Retrieves the balance of an account in kelvins (smallest unit).
1113
2459
  */
1114
- getBalance(pubkey: PublicKey): Promise<bigint>;
2460
+ getBalance(pubkey: PublicKey): Promise<Kelvin>;
1115
2461
  /**
1116
2462
  * Retrieves detailed information about an account.
1117
2463
  *
1118
2464
  * @returns Account info or null if account doesn't exist
1119
2465
  */
1120
- getAccountInfo(pubkey: PublicKey): Promise<AccountInfo | null>;
2466
+ getAccountInfo(pubkey: PublicKey): Promise<AccountInfo$1>;
1121
2467
  /**
1122
2468
  * Retrieves the current block height.
1123
2469
  */
1124
2470
  getBlockHeight(): Promise<bigint>;
2471
+ /**
2472
+ * Retrieves the current block height with advanced configuration.
2473
+ */
2474
+ getBlockHeightWithConfig(minContextSlot: bigint | undefined): Promise<bigint>;
1125
2475
  /**
1126
2476
  * Retrieves the signatures for an address.
1127
2477
  */
1128
- getSignaturesForAddress(address: PublicKey, config?: GetSignaturesForAddressConfig): Promise<SignatureInfo[]>;
2478
+ getSignaturesForAddress(address: PublicKey, config: GetSignaturesForAddressConfig$1 | undefined): Promise<SignatureInfo$1[]>;
1129
2479
  /**
1130
2480
  * Retrieves detailed information about a transaction.
1131
2481
  *
1132
- * @returns Transaction info or null if transaction not found
2482
+ * @returns Full transaction response
1133
2483
  */
1134
- getTransaction(signature: string): Promise<TransactionResponse | null>;
2484
+ getTransaction(sig: Signature): Promise<TransactionResponse$1>;
1135
2485
  /**
1136
2486
  * Retrieves the total number of transactions processed since genesis.
1137
2487
  */
@@ -1139,17 +2489,17 @@ declare class RialoClient {
1139
2489
  /**
1140
2490
  * Retrieves the status of multiple transaction signatures.
1141
2491
  */
1142
- getSignatureStatuses(signatures: string[]): Promise<(SignatureStatus | null)[]>;
2492
+ getSignatureStatuses(signatures: Signature[]): Promise<(SignatureStatus$1 | undefined)[]>;
1143
2493
  /**
1144
2494
  * Retrieves current epoch information.
1145
2495
  */
1146
- getEpochInfo(): Promise<EpochInfoResponse>;
2496
+ getEpochInfo(): Promise<EpochInfo>;
1147
2497
  /**
1148
2498
  * Checks the health status of the RPC node.
1149
2499
  *
1150
2500
  * @returns "ok" if healthy, error message otherwise
1151
2501
  */
1152
- getHealth(): Promise<"ok" | string>;
2502
+ getHealth(): Promise<string>;
1153
2503
  /**
1154
2504
  * Submits a signed transaction to the blockchain.
1155
2505
  *
@@ -1157,7 +2507,7 @@ declare class RialoClient {
1157
2507
  * @param options - Transaction submission options
1158
2508
  * @returns Transaction signature
1159
2509
  */
1160
- sendTransaction(transaction: Uint8Array, options?: SendTransactionOptions): Promise<string>;
2510
+ sendTransaction(transaction: Uint8Array, options?: Partial<SendTransactionOptions$1>): Promise<Signature>;
1161
2511
  /**
1162
2512
  * Requests an airdrop of tokens to an account.
1163
2513
  *
@@ -1167,7 +2517,7 @@ declare class RialoClient {
1167
2517
  * @param amount - Amount in kelvins (smallest unit)
1168
2518
  * @returns Transaction signature
1169
2519
  */
1170
- requestAirdrop(pubkey: PublicKey, amount: bigint): Promise<string>;
2520
+ requestAirdrop(pubkey: PublicKey, amount: Kelvin): Promise<Signature>;
1171
2521
  /**
1172
2522
  * Submits a signed transaction and waits for confirmation.
1173
2523
  *
@@ -1183,7 +2533,7 @@ declare class RialoClient {
1183
2533
  * console.log(`Confirmed in slot ${result.slot}`);
1184
2534
  * ```
1185
2535
  */
1186
- sendAndConfirmTransaction(transaction: Uint8Array, options?: SendAndConfirmOptions): Promise<ConfirmedTransaction>;
2536
+ sendAndConfirmTransaction(transaction: Uint8Array, options?: Partial<SendAndConfirmOptions$1>): Promise<ConfirmedTransaction$1>;
1187
2537
  /**
1188
2538
  * Waits for a transaction to be confirmed.
1189
2539
  *
@@ -1191,50 +2541,50 @@ declare class RialoClient {
1191
2541
  * @param options - Confirmation options
1192
2542
  * @returns Confirmed transaction details
1193
2543
  */
1194
- confirmTransaction(signature: string, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
2544
+ confirmTransaction(sig: string, options?: Partial<ConfirmTransactionOptions$1>): Promise<ConfirmedTransaction$1>;
1195
2545
  /**
1196
2546
  * Requests an airdrop and waits for confirmation.
1197
2547
  *
1198
2548
  * **Note**: Only available on devnet and testnet.
1199
2549
  */
1200
- requestAirdropAndConfirm(pubkey: PublicKey, amount: bigint, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
2550
+ requestAirdropAndConfirm(pubkey: PublicKey, amount: Kelvin): Promise<ConfirmedTransaction$1>;
1201
2551
  /**
1202
2552
  * Calculate the minimum balance required for an account to be rent-exempt.
1203
2553
  *
1204
2554
  * @param accountDataSize - The size of the account data in bytes
1205
2555
  * @returns The minimum balance in kelvins required for rent exemption
1206
2556
  */
1207
- getMinimumBalanceForRentExemption(accountDataSize: number): Promise<bigint>;
2557
+ getMinimumBalanceForRentExemption(dataSize: bigint): Promise<bigint>;
1208
2558
  /**
1209
2559
  * Get the fee required to process a specific message.
1210
2560
  *
1211
2561
  * @param message - Base64-encoded serialized versioned message
1212
- * @returns Fee in kelvins, or null if message is invalid
2562
+ * @returns Fee response with value in kelvins
1213
2563
  */
1214
- getFeeForMessage(message: string): Promise<bigint | null>;
2564
+ getFeeForMessage(message: string): Promise<FeeResponse>;
1215
2565
  /**
1216
2566
  * Get information for multiple accounts in a single request.
1217
2567
  *
1218
2568
  * @param pubkeys - Array of public keys to query (1-100)
1219
2569
  * @returns Account information for each address
1220
2570
  */
1221
- getMultipleAccounts(pubkeys: PublicKey[]): Promise<Array<AccountInfo | null>>;
2571
+ getMultipleAccounts(pubkeys: PublicKey[]): Promise<OptionalAccountInfo[]>;
1222
2572
  /**
1223
2573
  * Get all accounts owned by a specific program or address.
1224
2574
  *
1225
2575
  * @param owner - Program ID or owner public key
1226
- * @param filter - Filter type (ProgramAccounts or TokenAccounts)
2576
+ * @param filter - Filter type (programAccounts or tokenAccounts)
1227
2577
  * @param config - Optional configuration for pagination and encoding
1228
- * @returns Accounts owned by the specified owner
2578
+ * @returns Tuple of accounts and optional pagination info
1229
2579
  */
1230
- getAccountsByOwner(owner: PublicKey, filter?: AccountFilter, config?: GetAccountsByOwnerConfig): Promise<GetAccountsByOwnerResponse>;
2580
+ getAccountsByOwner(owner: PublicKey, filter: AccountFilter$1 | undefined, config: GetAccountsByOwnerConfig$1 | undefined): Promise<[OwnerAccount$1[], PaginationInfo$1 | undefined]>;
1231
2581
  /**
1232
2582
  * Get workflow lineage information for tracking execution history.
1233
2583
  *
1234
2584
  * @param request - Workflow lineage request with signature and options
1235
2585
  * @returns Workflow lineage tree with nodes and metadata
1236
2586
  */
1237
- getWorkflowLineage(request: GetWorkflowLineageRequest): Promise<GetWorkflowLineageResponse>;
2587
+ getWorkflowLineage(request: GetWorkflowLineageRequest$1): Promise<GetWorkflowLineageResponse$1>;
1238
2588
  /**
1239
2589
  * Get subscription for a given subscriber address and nonce.
1240
2590
  *
@@ -1242,7 +2592,7 @@ declare class RialoClient {
1242
2592
  * @param nonce - The nonce identifying the subscription
1243
2593
  * @returns The subscription for the subscriber and nonce
1244
2594
  */
1245
- getSubscription(subscriber: PublicKey, nonce: string): Promise<Subscription>;
2595
+ getSubscription(subscriber: PublicKey, nonce: string): Promise<Subscription$1>;
1246
2596
  /**
1247
2597
  * Get transactions triggered by a subscription account.
1248
2598
  *
@@ -1250,13 +2600,96 @@ declare class RialoClient {
1250
2600
  * @param limit - Optional limit on transactions returned
1251
2601
  * @returns Triggered transactions for the subscription
1252
2602
  */
1253
- getTriggeredTransactions(subscriptionAccount: PublicKey, limit?: number): Promise<TriggeredTransaction[]>;
2603
+ getTriggeredTransactions(subscriptionAccount: PublicKey, limit: number | undefined): Promise<TriggeredTransaction$1[]>;
2604
+ /**
2605
+ * Gets paginated transactions from the blockchain.
2606
+ */
2607
+ getTransactions(config: GetTransactionsConfig | undefined): Promise<TransactionInfo[]>;
2608
+ /**
2609
+ * Checks if a blockhash is still valid for transaction submission.
2610
+ */
2611
+ isBlockhashValid(blockhash: Hash): Promise<IsBlockhashValidResponse>;
2612
+ /**
2613
+ * Gets the health status of the validator.
2614
+ */
2615
+ getValidatorHealth(): Promise<ValidatorHealth>;
2616
+ /**
2617
+ * Gets the list of full nodes connected to the validator or full node.
2618
+ */
2619
+ getConnectedFullNodes(): Promise<ConnectedNode[]>;
2620
+ /**
2621
+ * Gets the TEE's secret sharing public key for HPKE encryption.
2622
+ */
2623
+ getSecretSharingPubkey(): Promise<SecretSharingPubkey>;
2624
+ /**
2625
+ * Gets the config hash prefix for protecting against replay attacks.
2626
+ */
2627
+ getConfigHashPrefix(): Promise<ConfigHashPrefix>;
2628
+ /**
2629
+ * Submits an epoch change transaction (admin-only).
2630
+ */
2631
+ sendAdminTransaction(request: SubmitEpochChangeRequest): Promise<SubmitEpochChangeResponse>;
2632
+ /**
2633
+ * Gets all accounts in the system.
2634
+ */
2635
+ getAllAccounts(config: GetAllAccountsConfig | undefined): Promise<AllAccountsEntry[]>;
2636
+ /**
2637
+ * Gets a block by its height.
2638
+ */
2639
+ getBlock(blockHeight: bigint, config: GetBlockConfig | undefined): Promise<BlockInfo>;
2640
+ /**
2641
+ * Gets a list of confirmed block heights in a range.
2642
+ */
2643
+ getBlocks(startHeight: bigint, endHeight: bigint | undefined): Promise<bigint[]>;
2644
+ /**
2645
+ * Gets detailed information about a stake account.
2646
+ */
2647
+ getStakeAccount(pubkey: PublicKey): Promise<StakeAccountInfo | undefined>;
2648
+ /**
2649
+ * Gets all registered validator accounts.
2650
+ */
2651
+ getValidatorAccounts(request: GetValidatorAccountsRequest): Promise<ValidatorAccountInfo[]>;
2652
+ /**
2653
+ * Gets the token balance of an SPL Token account.
2654
+ */
2655
+ getTokenAccountBalance(pubkey: PublicKey): Promise<TokenBalance>;
2656
+ /**
2657
+ * Gets registered REX requests for a creator.
2658
+ */
2659
+ getRexRequests(creator: PublicKey, nonce: string | undefined): Promise<RexInfoAndDuties[]>;
2660
+ /**
2661
+ * Gets missed REX duty proposal rounds for a specific REX request.
2662
+ */
2663
+ getRexMissedDuties(creator: PublicKey, nonce: string): Promise<bigint[]>;
2664
+ /**
2665
+ * Gets information about all known cluster nodes.
2666
+ */
2667
+ getClusterNodes(): Promise<ClusterNodeInfo[]>;
2668
+ /**
2669
+ * Gets the list of validator indices this node is connected to.
2670
+ */
2671
+ getConnectedValidators(): Promise<number[]>;
2672
+ /**
2673
+ * Calls an arbitrary RPC method with a JSON string body.
2674
+ * Utility method for methods not yet in the generated interface.
2675
+ */
2676
+ callWithJson(method: string, params: string): Promise<string>;
1254
2677
  }
1255
2678
 
1256
2679
  /**
1257
2680
  * Query client for read-only RPC operations.
1258
2681
  */
1259
2682
 
2683
+ /**
2684
+ * Filter for what kind of accounts to return from getAccountsByOwner.
2685
+ * Uses the serde-compatible discriminated union format expected by the RPC.
2686
+ */
2687
+ type AccountFilterParam = {
2688
+ type: "programAccounts";
2689
+ } | {
2690
+ type: "tokenAccounts";
2691
+ mint?: string;
2692
+ };
1260
2693
  /**
1261
2694
  * Client for querying blockchain state.
1262
2695
  *
@@ -1295,7 +2728,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1295
2728
  * }
1296
2729
  * ```
1297
2730
  */
1298
- getAccountInfo(pubkey: PublicKey): Promise<AccountInfo | null>;
2731
+ getAccountInfo(pubkey: PublicKey): Promise<AccountInfo$1 | null>;
1299
2732
  /**
1300
2733
  * Retrieve the current block height of the blockchain.
1301
2734
  *
@@ -1330,28 +2763,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1330
2763
  * });
1331
2764
  * ```
1332
2765
  */
1333
- 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>;
2766
+ getSignaturesForAddress(address: PublicKey, config?: GetSignaturesForAddressConfig$1): Promise<SignatureInfo$1[]>;
1355
2767
  /**
1356
2768
  * Retrieve the total number of transactions processed since genesis.
1357
2769
  *
@@ -1385,7 +2797,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1385
2797
  * });
1386
2798
  * ```
1387
2799
  */
1388
- getSignatureStatuses(signatures: string[]): Promise<(SignatureStatus | null)[]>;
2800
+ getSignatureStatuses(signatures: string[]): Promise<(SignatureStatus$1 | null)[]>;
1389
2801
  /**
1390
2802
  * Retrieve information about the current epoch.
1391
2803
  *
@@ -1402,7 +2814,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1402
2814
  * console.log(`Block height: ${info.blockHeight}`);
1403
2815
  * ```
1404
2816
  */
1405
- getEpochInfo(): Promise<EpochInfoResponse>;
2817
+ getEpochInfo(): Promise<EpochInfo>;
1406
2818
  /**
1407
2819
  * Check the health status of the RPC node.
1408
2820
  *
@@ -1470,7 +2882,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1470
2882
  * });
1471
2883
  * ```
1472
2884
  */
1473
- getMultipleAccounts(pubkeys: PublicKey[]): Promise<Array<AccountInfo | null>>;
2885
+ getMultipleAccounts(pubkeys: PublicKey[]): Promise<Array<AccountInfo$1 | null>>;
1474
2886
  /**
1475
2887
  * Get all accounts owned by a specific program or address.
1476
2888
  *
@@ -1490,7 +2902,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1490
2902
  * });
1491
2903
  * ```
1492
2904
  */
1493
- getAccountsByOwner(owner: PublicKey, filter?: AccountFilter, config?: GetAccountsByOwnerConfig): Promise<GetAccountsByOwnerResponse>;
2905
+ getAccountsByOwner(owner: PublicKey, filter?: AccountFilterParam, config?: GetAccountsByOwnerConfig$1): Promise<[OwnerAccount$1[], PaginationInfo$1 | undefined]>;
1494
2906
  /**
1495
2907
  * Get workflow lineage information for tracking execution history.
1496
2908
  *
@@ -1509,7 +2921,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1509
2921
  * console.log(`Found ${lineage.lineage.workflowNodes.length} nodes`);
1510
2922
  * ```
1511
2923
  */
1512
- getWorkflowLineage(request: GetWorkflowLineageRequest): Promise<GetWorkflowLineageResponse>;
2924
+ getWorkflowLineage(request: GetWorkflowLineageRequest$1): Promise<GetWorkflowLineageResponse$1>;
1513
2925
  /**
1514
2926
  * Get subscriptions for a given subscriber address.
1515
2927
  *
@@ -1525,7 +2937,7 @@ declare class QueryRpcClient extends BaseRpcClient {
1525
2937
  * console.log(`Topic: ${subscription.topic}, Kind: ${subscription.kind}`);
1526
2938
  * ```
1527
2939
  */
1528
- getSubscription(subscriber: PublicKey, nonce: string): Promise<Subscription>;
2940
+ getSubscription(subscriber: PublicKey, nonce: string): Promise<Subscription$1>;
1529
2941
  /**
1530
2942
  * Get transactions triggered by a subscription account.
1531
2943
  *
@@ -1544,7 +2956,362 @@ declare class QueryRpcClient extends BaseRpcClient {
1544
2956
  * });
1545
2957
  * ```
1546
2958
  */
1547
- getTriggeredTransactions(subscriptionAccount: PublicKey, limit?: number): Promise<TriggeredTransaction[]>;
2959
+ getTriggeredTransactions(subscriptionAccount: PublicKey, limit?: number): Promise<TriggeredTransaction$1[]>;
2960
+ /**
2961
+ * Retrieve the REX X25519 public key for secret sharing encryption.
2962
+ *
2963
+ * This key is used for HPKE encryption when sending encrypted data
2964
+ * that should only be decryptable within the REX execution environment.
2965
+ *
2966
+ * @returns The REX X25519 public key as a 32-byte Uint8Array
2967
+ *
2968
+ * @example
2969
+ * ```typescript
2970
+ * import { encryptForREX } from "@rialo/ts-cdk";
2971
+ *
2972
+ * // Get the REX public key
2973
+ * const rexPubkey = await client.getSecretSharingPubkey();
2974
+ *
2975
+ * // Use it for HPKE encryption
2976
+ * const encrypted = await encryptForRex(
2977
+ * rexPubkey,
2978
+ * new TextEncoder().encode("secret data"),
2979
+ * keypair.publicKey.toBytes()
2980
+ * );
2981
+ * ```
2982
+ */
2983
+ getSecretSharingPubkey(): Promise<Uint8Array>;
2984
+ /**
2985
+ * Get the config hash prefix for replay protection.
2986
+ *
2987
+ * Returns the first 64 bits of the config hash, which is used
2988
+ * for transaction replay protection across chains.
2989
+ *
2990
+ * @returns The config hash prefix as a bigint
2991
+ *
2992
+ * @example
2993
+ * ```typescript
2994
+ * const configHashPrefix = await client.getConfigHashPrefix();
2995
+ * const tx = TransactionBuilder.create()
2996
+ * .setPayer(payer)
2997
+ * .setValidFrom(validFrom)
2998
+ * .setConfigHashPrefix(configHashPrefix)
2999
+ * .addInstruction(instruction)
3000
+ * .build();
3001
+ * ```
3002
+ */
3003
+ getConfigHashPrefix(): Promise<bigint>;
3004
+ }
3005
+
3006
+ /**
3007
+ * RPC type definitions for the Rialo blockchain.
3008
+ */
3009
+
3010
+ /**
3011
+ * Account information response.
3012
+ */
3013
+ interface AccountInfo {
3014
+ /** Account balance in smallest denomination */
3015
+ balance: bigint;
3016
+ /** Owner program public key */
3017
+ owner: PublicKey;
3018
+ /** Account data */
3019
+ data: Uint8Array;
3020
+ /** Whether the account is executable */
3021
+ executable: boolean;
3022
+ /** Rent epoch */
3023
+ rentEpoch: bigint;
3024
+ }
3025
+ /**
3026
+ * Transaction response.
3027
+ */
3028
+ interface TransactionResponse {
3029
+ /** Transaction signature */
3030
+ signature: string;
3031
+ /** Block height */
3032
+ blockHeight?: bigint;
3033
+ /** Error message if transaction failed */
3034
+ err?: string;
3035
+ }
3036
+ /**
3037
+ * Options for sending a transaction.
3038
+ */
3039
+ interface SendTransactionOptions {
3040
+ /** Skip preflight transaction checks */
3041
+ skipPreflight?: boolean;
3042
+ /** Maximum number of times to retry */
3043
+ maxRetries?: number;
3044
+ }
3045
+ /**
3046
+ * Epoch information response.
3047
+ */
3048
+ interface EpochInfoResponse {
3049
+ /** Current epoch */
3050
+ epoch: bigint;
3051
+ /** Current slot in the epoch */
3052
+ slotIndex: bigint;
3053
+ /** Total slots in the epoch */
3054
+ slotsInEpoch: bigint;
3055
+ /** Absolute slot number */
3056
+ absoluteSlot: bigint;
3057
+ /** Block height */
3058
+ blockHeight: bigint;
3059
+ /** Transaction count */
3060
+ transactionCount?: bigint;
3061
+ }
3062
+ /**
3063
+ * Subscription kind.
3064
+ */
3065
+ type SubscriptionKind = "Persistent" | "OneShot";
3066
+ /**
3067
+ * Subscription data.
3068
+ */
3069
+ interface Subscription {
3070
+ /** Type of subscription */
3071
+ kind: SubscriptionKind;
3072
+ /** Topic for the subscription */
3073
+ topic: string;
3074
+ /** Instructions to execute when triggered */
3075
+ instructions: unknown[];
3076
+ /** Subscriber public key (base58) */
3077
+ subscriber: string;
3078
+ /** Event account public key (base58) */
3079
+ eventAccount?: string;
3080
+ /** Timestamp range [start, end] */
3081
+ timestampRange?: [bigint, bigint];
3082
+ }
3083
+ /**
3084
+ * Triggered transaction data.
3085
+ */
3086
+ interface TriggeredTransaction {
3087
+ /** Transaction signature (base58) */
3088
+ signature: string;
3089
+ /** Block number where the transaction was executed */
3090
+ blockNumber: bigint;
3091
+ }
3092
+ /**
3093
+ * Get workflow lineage request.
3094
+ */
3095
+ interface GetWorkflowLineageRequest {
3096
+ /** Root transaction signature (base58) */
3097
+ signature: string;
3098
+ /** Maximum depth to traverse (1-100, default 3) */
3099
+ maxDepth?: number;
3100
+ /** Whether to include event details */
3101
+ includeEvents?: boolean;
3102
+ }
3103
+ /**
3104
+ * Event data from a workflow trigger.
3105
+ */
3106
+ interface EventData {
3107
+ /** Event topic */
3108
+ topic: string;
3109
+ /** Event attributes */
3110
+ attributes: Record<string, unknown>;
3111
+ }
3112
+ /**
3113
+ * Timestamp range.
3114
+ */
3115
+ interface TimestampRange {
3116
+ /** Start timestamp (unix) */
3117
+ from: bigint;
3118
+ /** End timestamp (unix) */
3119
+ to: bigint;
3120
+ }
3121
+ /**
3122
+ * Information about what triggered a workflow transaction.
3123
+ */
3124
+ interface TriggerInfo {
3125
+ /** Event that triggered the transaction */
3126
+ event: EventData;
3127
+ /** Subscription public key (base58) */
3128
+ subscriptionPubkey: string;
3129
+ /** Timestamp range for the trigger */
3130
+ timestampRange?: TimestampRange;
3131
+ /** Event account public key (base58) */
3132
+ eventAccount?: string;
3133
+ }
3134
+ /**
3135
+ * Transaction node data within a workflow.
3136
+ */
3137
+ interface TransactionNodeData {
3138
+ /** Block height */
3139
+ blockHeight: bigint;
3140
+ /** Timestamp (unix) */
3141
+ timestamp: bigint;
3142
+ /** Whether the transaction succeeded */
3143
+ success: boolean;
3144
+ /** Number of instructions */
3145
+ instructionCount: number;
3146
+ /** Program IDs of instructions (base58) */
3147
+ instructionProgramIds: string[];
3148
+ }
3149
+ /**
3150
+ * A node in the workflow lineage tree.
3151
+ */
3152
+ interface WorkflowNode {
3153
+ /** Transaction signature (base58) */
3154
+ id: string;
3155
+ /** Distance from root transaction */
3156
+ depth: number;
3157
+ /** Transaction data */
3158
+ data: TransactionNodeData;
3159
+ /** Subscriptions on this transaction */
3160
+ subscriptions: Subscription[];
3161
+ /** What triggered this transaction */
3162
+ triggeredBy?: TriggerInfo;
3163
+ /** Child transaction signatures (base58) */
3164
+ workflowChildren: string[];
3165
+ /** Whether there are more children not shown */
3166
+ hasMoreChildren: boolean;
3167
+ }
3168
+ /**
3169
+ * Workflow lineage tree.
3170
+ */
3171
+ interface WorkflowLineage {
3172
+ /** Nodes in the workflow tree */
3173
+ workflowNodes: WorkflowNode[];
3174
+ }
3175
+ /**
3176
+ * Reason for truncating workflow lineage traversal.
3177
+ */
3178
+ type TruncationReason = "MaxDepth" | "MaxNodes" | "None";
3179
+ /**
3180
+ * Get workflow lineage response.
3181
+ */
3182
+ interface GetWorkflowLineageResponse {
3183
+ /** Workflow lineage tree */
3184
+ lineage: WorkflowLineage;
3185
+ /** Leaf transaction signatures (base58) */
3186
+ leaves: string[];
3187
+ /** Whether traversal was truncated */
3188
+ truncated: boolean;
3189
+ /** Reason for truncation */
3190
+ truncationReason: TruncationReason;
3191
+ /** Hints for continuing traversal (base58 signatures) */
3192
+ continuationHints: string[];
3193
+ }
3194
+ /**
3195
+ * Get signatures for address configuration.
3196
+ */
3197
+ interface GetSignaturesForAddressConfig {
3198
+ /** Maximum number of signatures to return */
3199
+ limit?: number;
3200
+ /** Start searching backwards from this signature */
3201
+ before?: string;
3202
+ /** Start searching forwards from this signature */
3203
+ until?: string;
3204
+ }
3205
+ /**
3206
+ * Signature information.
3207
+ */
3208
+ interface SignatureInfo {
3209
+ signature: string;
3210
+ blockHeight: bigint;
3211
+ blockTime: bigint;
3212
+ err?: string;
3213
+ }
3214
+ /**
3215
+ * Get health response.
3216
+ */
3217
+ type GetHealthResponse = "ok" | string;
3218
+ /**
3219
+ * Get transactions response.
3220
+ */
3221
+ interface GetTransactionsResponse {
3222
+ /** Array of transaction data */
3223
+ transactions: Array<Record<string, unknown>>;
3224
+ }
3225
+ /**
3226
+ * Signature status from the RPC.
3227
+ */
3228
+ interface SignatureStatus {
3229
+ /** Slot in which the transaction was processed */
3230
+ slot: bigint;
3231
+ /** Whether the transaction has been executed */
3232
+ executed: boolean;
3233
+ /** Error message if transaction failed */
3234
+ err?: string;
3235
+ }
3236
+ /**
3237
+ * Options for confirming a transaction.
3238
+ */
3239
+ interface ConfirmTransactionOptions {
3240
+ /** Maximum number of retry attempts (default: 30) */
3241
+ maxRetries?: number;
3242
+ /** Delay between retries in milliseconds (default: 1000) */
3243
+ retryDelay?: number;
3244
+ }
3245
+ /**
3246
+ * Options for sending and confirming a transaction.
3247
+ */
3248
+ interface SendAndConfirmOptions extends SendTransactionOptions, ConfirmTransactionOptions {
3249
+ }
3250
+ /**
3251
+ * Result of a confirmed transaction.
3252
+ */
3253
+ interface ConfirmedTransaction {
3254
+ /** Transaction signature */
3255
+ signature: string;
3256
+ /** Whether the transaction was executed */
3257
+ executed: boolean;
3258
+ /** Error message if transaction failed */
3259
+ err?: string;
3260
+ }
3261
+ /**
3262
+ * Configuration for getAccountsByOwner.
3263
+ */
3264
+ interface GetAccountsByOwnerConfig {
3265
+ /** Maximum number of accounts to return */
3266
+ limit?: number;
3267
+ /** Cursor for pagination (base58 pubkey) */
3268
+ after?: string;
3269
+ }
3270
+ /**
3271
+ * Filter for getAccountsByOwner.
3272
+ * Matches Rust serde serialization format.
3273
+ */
3274
+ type AccountFilter = {
3275
+ type: "programAccounts";
3276
+ } | {
3277
+ type: "tokenAccounts";
3278
+ mint?: string;
3279
+ };
3280
+ /**
3281
+ * An account owned by a program or address.
3282
+ */
3283
+ interface OwnerAccount {
3284
+ /** Account public key */
3285
+ pubkey: PublicKey;
3286
+ /** Account information */
3287
+ account: AccountInfo;
3288
+ }
3289
+ /**
3290
+ * Pagination information.
3291
+ */
3292
+ interface PaginationInfo {
3293
+ /** Whether there are more results */
3294
+ hasMore: boolean;
3295
+ /** Cursor for next page (base58 pubkey) */
3296
+ nextCursor?: string;
3297
+ }
3298
+ /**
3299
+ * Get accounts by owner response.
3300
+ */
3301
+ interface GetAccountsByOwnerResponse {
3302
+ /** Array of owned accounts */
3303
+ value: OwnerAccount[];
3304
+ /** Pagination information */
3305
+ pagination?: PaginationInfo;
3306
+ }
3307
+ /**
3308
+ * Get secret sharing public key response.
3309
+ *
3310
+ * Contains the TEE's X25519 public key for HPKE encryption.
3311
+ */
3312
+ interface GetSecretSharingPubkeyResponse {
3313
+ /** The TEE's X25519 public key as a hex-encoded string */
3314
+ public_key: string;
1548
3315
  }
1549
3316
 
1550
3317
  /**
@@ -2220,7 +3987,7 @@ interface Signer {
2220
3987
  * @param message - Message bytes to sign
2221
3988
  * @returns Ed25519 signature over the message
2222
3989
  */
2223
- signMessage(message: Uint8Array): Promise<Signature>;
3990
+ signMessage(message: Uint8Array): Promise<Signature$1>;
2224
3991
  }
2225
3992
 
2226
3993
  /**
@@ -2257,7 +4024,7 @@ declare class KeypairSigner implements Signer {
2257
4024
  /**
2258
4025
  * Signs a message using the keypair's private key.
2259
4026
  */
2260
- signMessage(message: Uint8Array): Promise<Signature>;
4027
+ signMessage(message: Uint8Array): Promise<Signature$1>;
2261
4028
  }
2262
4029
 
2263
4030
  /**
@@ -2561,11 +4328,15 @@ declare class Message {
2561
4328
  readonly accountKeys: readonly PublicKey[];
2562
4329
  /** Transaction valid from (milliseconds since Unix epoch) */
2563
4330
  validFrom?: bigint;
4331
+ /** Config hash prefix for replay protection across chains */
4332
+ readonly configHashPrefix: bigint;
4333
+ /** Whether the transaction should use OCC (optimistic concurrency control) scheduling */
4334
+ readonly occ: boolean;
2564
4335
  /** Compiled instructions with account indices */
2565
4336
  readonly instructions: readonly CompiledInstruction[];
2566
4337
  /** Cached serialized bytes */
2567
4338
  private serializedCache?;
2568
- constructor(header: MessageHeader, accountKeys: readonly PublicKey[], validFrom: bigint, instructions: readonly CompiledInstruction[]);
4339
+ constructor(header: MessageHeader, accountKeys: readonly PublicKey[], validFrom: bigint, configHashPrefix: bigint, occ: boolean, instructions: readonly CompiledInstruction[]);
2569
4340
  /**
2570
4341
  * Serialize message to bytes for signing.
2571
4342
  * Result is cached for performance.
@@ -2703,14 +4474,14 @@ declare class Transaction {
2703
4474
  *
2704
4475
  * Most users should use sign() or signAll() instead.
2705
4476
  */
2706
- addSignature(index: number, signature: Signature | Uint8Array): Transaction;
4477
+ addSignature(index: number, signature: Signature$1 | Uint8Array): Transaction;
2707
4478
  /**
2708
4479
  * Add a signature for a specific public key.
2709
4480
  * Returns a NEW Transaction instance.
2710
4481
  *
2711
4482
  * Most users should use sign() or signAll() instead.
2712
4483
  */
2713
- addSignatureForPubkey(pubkey: PublicKey, signature: Signature | Uint8Array): Transaction;
4484
+ addSignatureForPubkey(pubkey: PublicKey, signature: Signature$1 | Uint8Array): Transaction;
2714
4485
  /**
2715
4486
  * Check if transaction is fully signed (all signatures present).
2716
4487
  */
@@ -2795,6 +4566,8 @@ declare class Transaction {
2795
4566
  declare class TransactionBuilder {
2796
4567
  private payer?;
2797
4568
  private validFrom?;
4569
+ private configHashPrefix?;
4570
+ private occ;
2798
4571
  private readonly instructions;
2799
4572
  private constructor();
2800
4573
  /**
@@ -2819,6 +4592,21 @@ declare class TransactionBuilder {
2819
4592
  * @param validFrom - Transaction valid from in milliseconds since Unix epoch
2820
4593
  */
2821
4594
  setValidFrom(validFrom: bigint): this;
4595
+ /**
4596
+ * Set the config hash prefix for replay protection.
4597
+ *
4598
+ * This is the first 64 bits of the config hash, used to ensure
4599
+ * transactions cannot be replayed on different chains.
4600
+ *
4601
+ * @param configHashPrefix - config hash prefix as a u64
4602
+ */
4603
+ setConfigHashPrefix(configHashPrefix: bigint): this;
4604
+ /**
4605
+ * Enable OCC (optimistic concurrency control) scheduling for this transaction.
4606
+ *
4607
+ * @param occ - Whether to use OCC scheduling (default: false)
4608
+ */
4609
+ setOcc(occ: boolean): this;
2822
4610
  /**
2823
4611
  * Add an instruction to the transaction.
2824
4612
  *
@@ -2892,4 +4680,4 @@ declare function getMainnetUrl(): string;
2892
4680
  */
2893
4681
  declare function getLocalnetUrl(): string;
2894
4682
 
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 };
4683
+ export { type AccountFilter, type AccountFilterParam, type AccountInfo, type AccountMeta, AccountMetaTable, BASE_DERIVATION_PATH, BaseRpcClient, BincodeReader, type BincodeSchema, BincodeWriter, type Bump, CHACHA20_POLY1305_TAG_LENGTH, type ChainDefinition, type CompiledInstruction, type ConfirmTransactionOptions, type ConfirmedTransaction, CryptoError, CryptoErrorCode, DEFAULT_NUM_ACCOUNTS, ED25519_PUBLIC_KEY_LENGTH, type EnumVariant, type EpochInfoResponse, type EventData, type GetAccountsByOwnerConfig, type GetAccountsByOwnerResponse, type GetHealthResponse, type GetSecretSharingPubkeyResponse, type GetSignaturesForAddressConfig, type GetTransactionsResponse, type GetWorkflowLineageRequest, type GetWorkflowLineageResponse, HPKE_ENC_LENGTH, HPKE_OVERHEAD_LENGTH, HpkeError, HpkeErrorCode, 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_TESTNET_CHAIN, 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 Seed, type SendAndConfirmOptions, type SendTransactionOptions, Signature$1 as 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_TESTNET, USER_SECRET_AAD, 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 };