use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AccountInfoResponseValue {
pub kelvin: u64,
pub owner: String,
pub data: Vec<String>,
pub executable: bool,
#[serde(rename = "rentEpoch")]
pub rent_epoch: u64,
pub space: usize,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Subscription {
pub kind: SubscriptionKind,
pub topic: String,
pub instructions: Vec<Instruction>,
pub subscriber: String,
pub event_account: Option<String>,
pub timestamp_range: Option<(u64, u64)>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Instruction {
pub program_id: String,
pub accounts: Vec<AccountMeta>,
pub data: Vec<u8>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AccountMeta {
pub pubkey: String,
pub is_signer: bool,
pub is_writable: bool,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum SubscriptionKind {
Persistent,
OneShot,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum InstructionError {
GenericError,
InvalidArgument,
InvalidInstructionData,
InvalidAccountData,
AccountDataTooSmall,
InsufficientFunds,
IncorrectProgramId,
MissingRequiredSignature,
AccountAlreadyInitialized,
UninitializedAccount,
UnbalancedInstruction,
ModifiedProgramId,
ExternalAccountKelvinSpend,
ExternalAccountDataModified,
ReadonlyKelvinChange,
ReadonlyDataModified,
DuplicateAccountIndex,
ExecutableModified,
RentEpochModified,
NotEnoughAccountKeys,
AccountDataSizeChanged,
AccountNotExecutable,
AccountBorrowFailed,
AccountBorrowOutstanding,
DuplicateAccountOutOfSync,
Custom(u32),
InvalidError,
ExecutableDataModified,
ExecutableKelvinChange,
ExecutableAccountNotRentExempt,
UnsupportedProgramId,
CallDepth,
MissingAccount,
ReentrancyNotAllowed,
MaxSeedLengthExceeded,
InvalidSeeds,
InvalidRealloc,
ComputationalBudgetExceeded,
PrivilegeEscalation,
ProgramEnvironmentSetupFailure,
ProgramFailedToComplete,
ProgramFailedToCompile,
Immutable,
IncorrectAuthority,
BorshIoError(String),
AccountNotRentExempt,
InvalidAccountOwner,
ArithmeticOverflow,
UnsupportedSysvar,
IllegalOwner,
MaxAccountsDataAllocationsExceeded,
MaxAccountsExceeded,
MaxInstructionTraceLengthExceeded,
BuiltinProgramsMustConsumeComputeUnits,
}
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum TransactionError {
AccountInUse,
AccountLoadedTwice,
AccountNotFound,
ProgramAccountNotFound,
InsufficientFundsForFee,
InvalidAccountForFee,
AlreadyProcessed,
TimestampTooStale,
TimestampInFuture,
InstructionError(u8, InstructionError),
InvalidAccountIndex,
SignatureFailure,
InvalidProgramForExecution,
SanitizeFailure,
AccountBorrowOutstanding,
WouldExceedMaxBlockCostLimit,
UnsupportedVersion,
InvalidWritableAccount,
WouldExceedMaxAccountCostLimit,
WouldExceedAccountDataBlockLimit,
TooManyAccountLocks,
InvalidRentPayingAccount,
WouldExceedMaxVoteCostLimit,
DuplicateInstruction(u8),
InsufficientFundsForRent { account_index: u8 },
MaxLoadedAccountsDataSizeExceeded,
InvalidLoadedAccountsDataSizeLimit,
ResanitizationNeeded,
UnbalancedTransaction,
ProgramCacheHitMaxLimit,
SerializationFailure,
InvalidConfigHashPrefix,
}