repo_id
stringclasses 563
values | file_path
stringlengths 40
166
| content
stringlengths 1
2.94M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src/utils/rpc_filter.rs
|
use serde_with::{serde_as, skip_serializing_none, DisplayFromStr};
use solana_extra_wasm::program::spl_token_2022::{
generic_token_account::GenericTokenAccount, state::Account,
};
use solana_sdk::{
account::{AccountSharedData, ReadableAccount},
pubkey::Pubkey,
};
use std::borrow::Cow;
use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", untagged)]
pub enum MemcmpEncodedBytes {
#[deprecated(
since = "1.8.1",
note = "Please use MemcmpEncodedBytes::Base58 instead"
)]
Binary(String),
Base58(String),
Base64(String),
Bytes(Vec<u8>),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MemcmpEncoding {
Binary,
}
#[skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Memcmp {
/// Data offset to begin match
pub offset: usize,
/// Bytes, encoded with specified encoding, or default Binary
pub bytes: MemcmpEncodedBytes,
/// Optional encoding specification
pub encoding: Option<MemcmpEncoding>,
}
impl Memcmp {
pub fn bytes(&self) -> Option<Cow<Vec<u8>>> {
use MemcmpEncodedBytes::*;
match &self.bytes {
Binary(bytes) | Base58(bytes) => bs58::decode(bytes).into_vec().ok().map(Cow::Owned),
Base64(bytes) => base64::decode(bytes).ok().map(Cow::Owned),
Bytes(bytes) => Some(Cow::Borrowed(bytes)),
}
}
pub fn bytes_match(&self, data: &[u8]) -> bool {
match self.bytes() {
Some(bytes) => {
if self.offset > data.len() {
return false;
}
if data[self.offset..].len() < bytes.len() {
return false;
}
data[self.offset..self.offset + bytes.len()] == bytes[..]
}
None => false,
}
}
}
const MAX_DATA_SIZE: usize = 128;
const MAX_DATA_BASE58_SIZE: usize = 175;
const MAX_DATA_BASE64_SIZE: usize = 172;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcFilterType {
DataSize(u64),
Memcmp(Memcmp),
TokenAccountState,
}
impl RpcFilterType {
pub fn verify(&self) -> Result<(), RpcFilterError> {
match self {
RpcFilterType::DataSize(_) => Ok(()),
RpcFilterType::Memcmp(compare) => {
let encoding = compare.encoding.as_ref().unwrap_or(&MemcmpEncoding::Binary);
match encoding {
MemcmpEncoding::Binary => {
use MemcmpEncodedBytes::*;
match &compare.bytes {
// DEPRECATED
Binary(bytes) => {
if bytes.len() > MAX_DATA_BASE58_SIZE {
return Err(RpcFilterError::Base58DataTooLarge);
}
let bytes = bs58::decode(&bytes)
.into_vec()
.map_err(RpcFilterError::DecodeError)?;
if bytes.len() > MAX_DATA_SIZE {
Err(RpcFilterError::Base58DataTooLarge)
} else {
Ok(())
}
}
Base58(bytes) => {
if bytes.len() > MAX_DATA_BASE58_SIZE {
return Err(RpcFilterError::DataTooLarge);
}
let bytes = bs58::decode(&bytes).into_vec()?;
if bytes.len() > MAX_DATA_SIZE {
Err(RpcFilterError::DataTooLarge)
} else {
Ok(())
}
}
Base64(bytes) => {
if bytes.len() > MAX_DATA_BASE64_SIZE {
return Err(RpcFilterError::DataTooLarge);
}
let bytes = base64::decode(bytes)?;
if bytes.len() > MAX_DATA_SIZE {
Err(RpcFilterError::DataTooLarge)
} else {
Ok(())
}
}
Bytes(bytes) => {
if bytes.len() > MAX_DATA_SIZE {
return Err(RpcFilterError::DataTooLarge);
}
Ok(())
}
}
}
}
}
RpcFilterType::TokenAccountState => Ok(()),
}
}
pub fn allows(&self, account: &AccountSharedData) -> bool {
match self {
RpcFilterType::DataSize(size) => account.data().len() as u64 == *size,
RpcFilterType::Memcmp(compare) => compare.bytes_match(account.data()),
RpcFilterType::TokenAccountState => Account::valid_account_data(account.data()),
}
}
}
#[derive(Error, PartialEq, Eq, Debug)]
pub enum RpcFilterError {
#[error("encoded binary data should be less than 129 bytes")]
DataTooLarge,
#[deprecated(
since = "1.8.1",
note = "Error for MemcmpEncodedBytes::Binary which is deprecated"
)]
#[error("encoded binary (base 58) data should be less than 129 bytes")]
Base58DataTooLarge,
#[deprecated(
since = "1.8.1",
note = "Error for MemcmpEncodedBytes::Binary which is deprecated"
)]
#[error("bs58 decode error")]
DecodeError(bs58::decode::Error),
#[error("base58 decode error")]
Base58DecodeError(#[from] bs58::decode::Error),
#[error("base64 decode error")]
Base64DecodeError(#[from] base64::DecodeError),
}
#[serde_as]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcTokenAccountsFilter {
Mint(#[serde_as(as = "DisplayFromStr")] Pubkey),
ProgramId(#[serde_as(as = "DisplayFromStr")] Pubkey),
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src/utils/rpc_request.rs
|
pub const MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS: usize = 256;
pub const MAX_GET_CONFIRMED_SIGNATURES_FOR_ADDRESS_SLOT_RANGE: u64 = 10_000;
pub const MAX_GET_CONFIRMED_BLOCKS_RANGE: u64 = 500_000;
pub const MAX_GET_CONFIRMED_SIGNATURES_FOR_ADDRESS2_LIMIT: usize = 1_000;
pub const MAX_MULTIPLE_ACCOUNTS: usize = 100;
pub const NUM_LARGEST_ACCOUNTS: usize = 20;
pub const MAX_GET_PROGRAM_ACCOUNT_FILTERS: usize = 4;
pub const MAX_GET_SLOT_LEADERS: usize = 5000;
// Validators that are this number of slots behind are considered delinquent
pub const DELINQUENT_VALIDATOR_SLOT_DISTANCE: u64 = 128;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src/utils/nonce_utils.rs
|
//! Durable transaction nonce helpers.
use {
crate::{utils::rpc_config::RpcAccountInfoConfig, WasmClient},
solana_sdk::{
account::{Account, ReadableAccount},
account_utils::StateMut,
commitment_config::CommitmentConfig,
hash::Hash,
nonce::{
state::{Data, Versions},
State,
},
pubkey::Pubkey,
system_program,
},
};
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum NonceError {
#[error("invalid account owner")]
InvalidAccountOwner,
#[error("invalid account data")]
InvalidAccountData,
#[error("unexpected account data size")]
UnexpectedDataSize,
#[error("provided hash ({provided}) does not match nonce hash ({expected})")]
InvalidHash { provided: Hash, expected: Hash },
#[error("provided authority ({provided}) does not match nonce authority ({expected})")]
InvalidAuthority { provided: Pubkey, expected: Pubkey },
#[error("invalid state for requested operation")]
InvalidStateForOperation,
#[error("client error: {0}")]
Client(String),
}
/// Get a nonce account from the network.
///
/// This is like [`WasmClient::get_account`] except:
///
/// - it returns this module's [`NonceError`] type,
/// - it returns an error if any of the checks from [`account_identity_ok`] fail.
pub async fn get_account(
rpc_client: &WasmClient,
nonce_pubkey: &Pubkey,
) -> Result<Account, NonceError> {
get_account_with_commitment(rpc_client, nonce_pubkey, CommitmentConfig::default()).await
}
/// Get a nonce account from the network.
///
/// This is like [`WasmClient::get_account_with_commitment`] except:
///
/// - it returns this module's [`NonceError`] type,
/// - it returns an error if the account does not exist,
/// - it returns an error if any of the checks from [`account_identity_ok`] fail.
pub async fn get_account_with_commitment(
rpc_client: &WasmClient,
nonce_pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account, NonceError> {
rpc_client
.get_account_with_config(
nonce_pubkey,
RpcAccountInfoConfig {
commitment: Some(commitment_config),
..Default::default()
},
)
.await
.map_err(|e| NonceError::Client(format!("{}", e)))
.and_then(|opt| {
opt.ok_or_else(|| {
NonceError::Client(format!("AccountNotFound: pubkey={}", nonce_pubkey))
})
})
.and_then(|a| account_identity_ok(&a).map(|()| a))
}
/// Perform basic checks that an account has nonce-like properties.
///
/// # Errors
///
/// Returns [`NonceError::InvalidAccountOwner`] if the account is not owned by the
/// system program. Returns [`NonceError::UnexpectedDataSize`] if the account
/// contains no data.
pub fn account_identity_ok<T: ReadableAccount>(account: &T) -> Result<(), NonceError> {
if account.owner() != &system_program::id() {
Err(NonceError::InvalidAccountOwner)
} else if account.data().is_empty() {
Err(NonceError::UnexpectedDataSize)
} else {
Ok(())
}
}
/// Deserialize the state of a durable transaction nonce account.
///
/// # Errors
///
/// Returns an error if the account is not owned by the system program or
/// contains no data.
///
/// # Examples
///
/// Determine if a nonce account is initialized:
///
/// ```no_run
/// use solana_client::{
/// rpc_client::WasmClient,
/// nonce_utils,
/// };
/// use solana_sdk::{
/// nonce::State,
/// pubkey::Pubkey,
/// };
/// use anyhow::Result;
///
/// fn is_nonce_initialized(
/// client: &WasmClient,
/// nonce_account_pubkey: &Pubkey,
/// ) -> Result<bool> {
///
/// // Sign the tx with nonce_account's `blockhash` instead of the
/// // network's latest blockhash.
/// let nonce_account = client.get_account(nonce_account_pubkey)?;
/// let nonce_state = nonce_utils::state_from_account(&nonce_account)?;
///
/// Ok(!matches!(nonce_state, State::Uninitialized))
/// }
/// #
/// # let client = WasmClient::new(String::new());
/// # let nonce_account_pubkey = Pubkey::new_unique();
/// # is_nonce_initialized(&client, &nonce_account_pubkey)?;
/// #
/// # Ok::<(), anyhow::NonceError>(())
/// ```
pub fn state_from_account<T: ReadableAccount + StateMut<Versions>>(
account: &T,
) -> Result<State, NonceError> {
account_identity_ok(account)?;
StateMut::<Versions>::state(account)
.map_err(|_| NonceError::InvalidAccountData)
.map(|v| v.state().clone())
}
/// Deserialize the state data of a durable transaction nonce account.
///
/// # Errors
///
/// Returns an error if the account is not owned by the system program or
/// contains no data. Returns an error if the account state is uninitialized or
/// fails to deserialize.
///
/// # Examples
///
/// Create and sign a transaction with a durable nonce:
///
/// ```no_run
/// use solana_client::{
/// rpc_client::WasmClient,
/// nonce_utils,
/// };
/// use solana_sdk::{
/// message::Message,
/// pubkey::Pubkey,
/// signature::{Keypair, Signer},
/// system_instruction,
/// transaction::Transaction,
/// };
/// use std::path::Path;
/// use anyhow::Result;
/// # use anyhow::anyhow;
///
/// fn create_transfer_tx_with_nonce(
/// client: &WasmClient,
/// nonce_account_pubkey: &Pubkey,
/// payer: &Keypair,
/// receiver: &Pubkey,
/// amount: u64,
/// tx_path: &Path,
/// ) -> Result<()> {
///
/// let instr_transfer = system_instruction::transfer(
/// &payer.pubkey(),
/// receiver,
/// amount,
/// );
///
/// // In this example, `payer` is `nonce_account_pubkey`'s authority
/// let instr_advance_nonce_account = system_instruction::advance_nonce_account(
/// nonce_account_pubkey,
/// &payer.pubkey(),
/// );
///
/// // The `advance_nonce_account` instruction must be the first issued in
/// // the transaction.
/// let message = Message::new(
/// &[
/// instr_advance_nonce_account,
/// instr_transfer
/// ],
/// Some(&payer.pubkey()),
/// );
///
/// let mut tx = Transaction::new_unsigned(message);
///
/// // Sign the tx with nonce_account's `blockhash` instead of the
/// // network's latest blockhash.
/// let nonce_account = client.get_account(nonce_account_pubkey)?;
/// let nonce_data = nonce_utils::data_from_account(&nonce_account)?;
/// let blockhash = nonce_data.blockhash();
///
/// tx.try_sign(&[payer], blockhash)?;
///
/// // Save the signed transaction locally for later submission.
/// save_tx_to_file(&tx_path, &tx)?;
///
/// Ok(())
/// }
/// #
/// # fn save_tx_to_file(path: &Path, tx: &Transaction) -> Result<()> {
/// # Ok(())
/// # }
/// #
/// # let client = WasmClient::new(String::new());
/// # let nonce_account_pubkey = Pubkey::new_unique();
/// # let payer = Keypair::new();
/// # let receiver = Pubkey::new_unique();
/// # create_transfer_tx_with_nonce(&client, &nonce_account_pubkey, &payer, &receiver, 1024, Path::new("new_tx"))?;
/// #
/// # Ok::<(), anyhow::NonceError>(())
/// ```
pub fn data_from_account<T: ReadableAccount + StateMut<Versions>>(
account: &T,
) -> Result<Data, NonceError> {
account_identity_ok(account)?;
state_from_account(account).and_then(|ref s| data_from_state(s).cloned())
}
/// Get the nonce data from its [`State`] value.
///
/// # Errors
///
/// Returns [`NonceError::InvalidStateForOperation`] if `state` is
/// [`State::Uninitialized`].
pub fn data_from_state(state: &State) -> Result<&Data, NonceError> {
match state {
State::Uninitialized => Err(NonceError::InvalidStateForOperation),
State::Initialized(data) => Ok(data),
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src/utils/rpc_response.rs
|
use serde_with::{serde_as, DisplayFromStr};
use solana_extra_wasm::{
account_decoder::parse_token::UiTokenAmount,
transaction_status::{TransactionConfirmationStatus, UiConfirmedBlock},
};
use solana_sdk::{
clock::{Epoch, Slot, UnixTimestamp},
inflation::Inflation,
pubkey::Pubkey,
transaction::TransactionError,
};
use std::{collections::HashMap, fmt};
use thiserror::Error;
// pub type RpcResult<T> = client_error::Result<Response<T>>;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WithContext<T> {
pub context: RpcResponseContext,
pub value: T,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RpcResponseContext {
pub slot: Slot,
}
// #[derive(Debug, PartialEq, Serialize, Deserialize)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcBlockCommitment<T> {
// pub commitment: Option<T>,
// pub total_stake: u64,
// }
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcBlockhashFeeCalculator {
// pub blockhash: String,
// pub fee_calculator: FeeCalculator,
// }
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockhash {
pub blockhash: String,
pub last_valid_block_height: u64,
}
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcFees {
// pub blockhash: String,
// pub fee_calculator: FeeCalculator,
// pub last_valid_slot: Slot,
// pub last_valid_block_height: u64,
// }
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct DeprecatedRpcFees {
// pub blockhash: String,
// pub fee_calculator: FeeCalculator,
// pub last_valid_slot: Slot,
// }
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct Fees {
// pub blockhash: Hash,
// pub fee_calculator: FeeCalculator,
// pub last_valid_block_height: u64,
// }
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcFeeCalculator {
// pub fee_calculator: FeeCalculator,
// }
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcFeeRateGovernor {
// pub fee_rate_governor: FeeRateGovernor,
// }
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcInflationGovernor {
pub initial: f64,
pub terminal: f64,
pub taper: f64,
pub foundation: f64,
pub foundation_term: f64,
}
impl From<Inflation> for RpcInflationGovernor {
fn from(inflation: Inflation) -> Self {
Self {
initial: inflation.initial,
terminal: inflation.terminal,
taper: inflation.taper,
foundation: inflation.foundation,
foundation_term: inflation.foundation_term,
}
}
}
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcInflationRate {
pub total: f64,
pub validator: f64,
pub foundation: f64,
pub epoch: Epoch,
}
// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcKeyedAccount {
// pub pubkey: String,
// pub account: UiAccount,
// }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
pub struct SlotInfo {
pub slot: Slot,
pub parent: Slot,
pub root: Slot,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase", tag = "type")]
pub enum SlotUpdate {
FirstShredReceived {
slot: Slot,
timestamp: u64,
},
Completed {
slot: Slot,
timestamp: u64,
},
CreatedBank {
slot: Slot,
parent: Slot,
timestamp: u64,
},
Frozen {
slot: Slot,
timestamp: u64,
stats: SlotTransactionStats,
},
Dead {
slot: Slot,
timestamp: u64,
err: String,
},
OptimisticConfirmation {
slot: Slot,
timestamp: u64,
},
Root {
slot: Slot,
timestamp: u64,
},
}
impl SlotUpdate {
pub fn slot(&self) -> Slot {
match self {
Self::FirstShredReceived { slot, .. } => *slot,
Self::Completed { slot, .. } => *slot,
Self::CreatedBank { slot, .. } => *slot,
Self::Frozen { slot, .. } => *slot,
Self::Dead { slot, .. } => *slot,
Self::OptimisticConfirmation { slot, .. } => *slot,
Self::Root { slot, .. } => *slot,
}
}
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct SlotTransactionStats {
pub num_transaction_entries: u64,
pub num_successful_transactions: u64,
pub num_failed_transactions: u64,
pub max_transactions_per_entry: u64,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase", untagged)]
pub enum RpcSignatureResult {
ProcessedSignature(ProcessedSignatureResult),
ReceivedSignature(ReceivedSignatureResult),
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ProcessedSignatureResult {
pub err: Option<TransactionError>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub enum ReceivedSignatureResult {
ReceivedSignature,
}
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcContactInfo {
// /// Pubkey of the node as a base-58 string
// pub pubkey: String,
// /// Gossip port
// pub gossip: Option<SocketAddr>,
// /// Tpu port
// pub tpu: Option<SocketAddr>,
// /// JSON RPC port
// pub rpc: Option<SocketAddr>,
// /// Software version
// pub version: Option<String>,
// /// First 4 bytes of the FeatureSet identifier
// pub feature_set: Option<u32>,
// /// Shred version
// pub shred_version: Option<u16>,
// }
/// Map of leader base58 identity pubkeys to the slot indices relative to the first epoch slot
pub type RpcLeaderSchedule = HashMap<String, Vec<usize>>;
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockProductionRange {
pub first_slot: Slot,
pub last_slot: Slot,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockProduction {
/// Map of leader base58 identity pubkeys to a tuple of `(number of leader slots, number of blocks produced)`
pub by_identity: HashMap<String, (usize, usize)>,
pub range: RpcBlockProductionRange,
}
#[derive(Serialize, Deserialize, PartialEq, Clone)]
#[serde(rename_all = "kebab-case")]
pub struct RpcVersionInfo {
/// The current version of solana-core
pub solana_core: String,
/// first 4 bytes of the FeatureSet identifier
pub feature_set: Option<u32>,
}
impl fmt::Debug for RpcVersionInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.solana_core)
}
}
impl fmt::Display for RpcVersionInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(version) = self.solana_core.split_whitespace().next() {
// Display just the semver if possible
write!(f, "{}", version)
} else {
write!(f, "{}", self.solana_core)
}
}
}
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "kebab-case")]
// pub struct RpcIdentity {
// /// The current node identity pubkey
// pub identity: String,
// }
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcVote {
pub hash: String,
pub slots: Vec<Slot>,
pub timestamp: Option<UnixTimestamp>,
pub signature: String,
}
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcVoteAccountStatus {
pub current: Vec<RpcVoteAccountInfo>,
pub delinquent: Vec<RpcVoteAccountInfo>,
}
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcVoteAccountInfo {
/// Vote account address, as base-58 encoded string
pub vote_pubkey: String,
/// The validator identity, as base-58 encoded string
pub node_pubkey: String,
/// The current stake, in lamports, delegated to this vote account
pub activated_stake: u64,
/// An 8-bit integer used as a fraction (commission/MAX_U8) for rewards payout
pub commission: u8,
/// Whether this account is staked for the current epoch
pub epoch_vote_account: bool,
/// History of how many credits earned by the end of each epoch
/// each tuple is (Epoch, credits, prev_credits)
pub epoch_credits: Vec<(Epoch, u64, u64)>,
/// Most recent slot voted on by this vote account (0 if no votes exist)
#[serde(default)]
pub last_vote: u64,
/// Current root slot for this vote account (0 if not root slot exists)
#[serde(default)]
pub root_slot: Slot,
}
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcSignatureConfirmation {
// pub confirmations: usize,
// pub status: Result<()>,
// }
// #[derive(Serialize, Deserialize, Clone, Debug)]
// #[serde(rename_all = "camelCase")]
// pub struct RpcStorageTurn {
// pub blockhash: String,
// pub slot: Slot,
// }
#[serde_as]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcAccountBalance {
#[serde_as(as = "DisplayFromStr")]
pub address: Pubkey,
pub lamports: u64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcSupply {
pub total: u64,
pub circulating: u64,
pub non_circulating: u64,
pub non_circulating_accounts: Vec<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub enum StakeActivationState {
Activating,
Active,
Deactivating,
Inactive,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcStakeActivation {
pub state: StakeActivationState,
pub active: u64,
pub inactive: u64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct RpcTokenAccountBalance {
pub address: String,
#[serde(flatten)]
pub amount: UiTokenAmount,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcConfirmedTransactionStatusWithSignature {
pub signature: String,
pub slot: Slot,
pub err: Option<TransactionError>,
pub memo: Option<String>,
pub block_time: Option<UnixTimestamp>,
pub confirmation_status: Option<TransactionConfirmationStatus>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcPerfSample {
pub slot: Slot,
pub num_transactions: u64,
pub num_slots: u64,
pub sample_period_secs: u16,
pub num_non_vote_transaction: u64,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcInflationReward {
pub epoch: Epoch,
pub effective_slot: Slot,
pub amount: u64, // lamports
pub post_balance: u64, // lamports
pub commission: Option<u8>, // Vote account commission when the reward was credited
}
#[derive(Clone, Deserialize, Serialize, Debug, Error, Eq, PartialEq)]
pub enum RpcBlockUpdateError {
#[error("block store error")]
BlockStoreError,
#[error("unsupported transaction version ({0})")]
UnsupportedTransactionVersion(u8),
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcLogsResponse {
pub signature: String, // Signature as base58 string
pub err: Option<TransactionError>,
pub logs: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockUpdate {
pub slot: Slot,
pub block: Option<UiConfirmedBlock>,
pub err: Option<RpcBlockUpdateError>,
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RpcPrioritizationFee {
pub slot: Slot,
pub prioritization_fee: u64,
}
// impl From<ConfirmedTransactionStatusWithSignature> for RpcConfirmedTransactionStatusWithSignature {
// fn from(value: ConfirmedTransactionStatusWithSignature) -> Self {
// let ConfirmedTransactionStatusWithSignature {
// signature,
// slot,
// err,
// memo,
// block_time,
// } = value;
// Self {
// signature: signature.to_string(),
// slot,
// err,
// memo,
// block_time,
// confirmation_status: None,
// }
// }
// }
// #[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
// pub struct RpcSnapshotSlotInfo {
// pub full: Slot,
// pub incremental: Option<Slot>,
// }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src/utils/mod.rs
|
pub mod nonce_utils;
pub mod rpc_config;
pub mod rpc_filter;
pub mod rpc_request;
pub mod rpc_response;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-client/src/utils/rpc_config.rs
|
use bincode::serialize;
use serde_with::{serde_as, skip_serializing_none, DisplayFromStr};
use solana_extra_wasm::{
account_decoder::{UiAccount, UiAccountEncoding, UiDataSliceConfig},
transaction_status::{TransactionDetails, UiTransactionEncoding},
};
use solana_sdk::{
clock::{Epoch, Slot},
commitment_config::{CommitmentConfig, CommitmentLevel},
hash::Hash,
pubkey::Pubkey,
signature::Signature,
};
use super::rpc_filter::RpcFilterType;
use crate::{utils::nonce_utils, ClientError, ClientResult, WasmClient};
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcKeyedAccount {
pub pubkey: String,
pub account: UiAccount,
}
#[derive(Debug, PartialEq, Eq)]
pub enum Source {
Cluster,
NonceAccount(Pubkey),
}
impl Source {
pub async fn get_blockhash(
&self,
rpc_client: &WasmClient,
commitment_config: CommitmentConfig,
) -> Result<Hash, Box<dyn std::error::Error>> {
match self {
Self::Cluster => {
let (blockhash, _) = rpc_client
.get_latest_blockhash_with_config(commitment_config)
.await?;
Ok(blockhash)
}
Self::NonceAccount(ref pubkey) => {
#[allow(clippy::redundant_closure)]
let data =
nonce_utils::get_account_with_commitment(rpc_client, pubkey, commitment_config)
.await
.and_then(|ref a| nonce_utils::data_from_account(a))?;
Ok(data.blockhash())
}
}
}
pub async fn is_blockhash_valid(
&self,
rpc_client: &WasmClient,
blockhash: &Hash,
commitment_config: CommitmentConfig,
) -> Result<bool, Box<dyn std::error::Error>> {
Ok(match self {
Self::Cluster => {
rpc_client
.is_blockhash_valid(blockhash, commitment_config)
.await?
}
Self::NonceAccount(ref pubkey) => {
#[allow(clippy::redundant_closure)]
let _ =
nonce_utils::get_account_with_commitment(rpc_client, pubkey, commitment_config)
.await
.and_then(|ref a| nonce_utils::data_from_account(a))?;
true
}
})
}
}
#[derive(Debug, PartialEq, Eq)]
pub enum BlockhashQuery {
None(Hash),
FeeCalculator(Source, Hash),
All(Source),
}
impl BlockhashQuery {
pub fn new(blockhash: Option<Hash>, sign_only: bool, nonce_account: Option<Pubkey>) -> Self {
let source = nonce_account
.map(Source::NonceAccount)
.unwrap_or(Source::Cluster);
match blockhash {
Some(hash) if sign_only => Self::None(hash),
Some(hash) if !sign_only => Self::FeeCalculator(source, hash),
None if !sign_only => Self::All(source),
_ => panic!("Cannot resolve blockhash"),
}
}
pub async fn get_blockhash(
&self,
rpc_client: &WasmClient,
commitment_config: CommitmentConfig,
) -> Result<Hash, Box<dyn std::error::Error>> {
match self {
BlockhashQuery::None(hash) => Ok(*hash),
BlockhashQuery::FeeCalculator(source, hash) => {
if !source
.is_blockhash_valid(rpc_client, hash, commitment_config)
.await?
{
return Err(format!("Hash has expired {:?}", hash).into());
}
Ok(*hash)
}
BlockhashQuery::All(source) => {
source.get_blockhash(rpc_client, commitment_config).await
}
}
}
}
impl Default for BlockhashQuery {
fn default() -> Self {
BlockhashQuery::All(Source::Cluster)
}
}
pub fn serialize_and_encode<T>(input: &T, encoding: UiTransactionEncoding) -> ClientResult<String>
where
T: serde::ser::Serialize,
{
let serialized =
serialize(input).map_err(|e| ClientError::new(format!("Serialization failed: {}", e)))?;
let encoded = match encoding {
UiTransactionEncoding::Base58 => bs58::encode(serialized).into_string(),
UiTransactionEncoding::Base64 => base64::encode(serialized),
_ => {
return Err(ClientError::new(format!(
"unsupported encoding: {}. Supported encodings: base58, base64",
encoding
)))
}
};
Ok(encoded)
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSignatureStatusConfig {
pub search_transaction_history: bool,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSendTransactionConfig {
#[serde(default)]
pub skip_preflight: bool,
pub preflight_commitment: Option<CommitmentLevel>,
pub encoding: Option<UiTransactionEncoding>,
pub max_retries: Option<usize>,
pub min_context_slot: Option<Slot>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSimulateTransactionAccountsConfig {
pub encoding: Option<UiAccountEncoding>,
pub addresses: Vec<String>,
}
#[skip_serializing_none]
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSimulateTransactionConfig {
#[serde(default)]
pub sig_verify: Option<bool>,
#[serde(default)]
pub replace_recent_blockhash: Option<bool>,
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub encoding: Option<UiTransactionEncoding>,
pub accounts: Option<RpcSimulateTransactionAccountsConfig>,
pub min_context_slot: Option<Slot>,
}
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcRequestAirdropConfig {
pub recent_blockhash: Option<String>, // base-58 encoded blockhash
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
}
#[serde_as]
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcLeaderScheduleConfig {
#[serde_as(as = "Option<DisplayFromStr>")]
pub identity: Option<Pubkey>, // validator identity, as a base-58 encoded string
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
}
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockProductionConfigRange {
pub first_slot: Slot,
pub last_slot: Option<Slot>,
}
#[skip_serializing_none]
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockProductionConfig {
pub identity: Option<String>, // validator identity, as a base-58 encoded string
pub range: Option<RpcBlockProductionConfigRange>, // current epoch if `None`
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
}
#[skip_serializing_none]
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcGetVoteAccountsConfig {
pub vote_pubkey: Option<String>, // validator vote address, as a base-58 encoded string
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub keep_unstaked_delinquents: Option<bool>,
pub delinquent_slot_distance: Option<u64>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RpcLeaderScheduleConfigWrapper {
SlotOnly(Option<Slot>),
ConfigOnly(Option<RpcLeaderScheduleConfig>),
}
impl RpcLeaderScheduleConfigWrapper {
pub fn unzip(&self) -> (Option<Slot>, Option<RpcLeaderScheduleConfig>) {
match &self {
RpcLeaderScheduleConfigWrapper::SlotOnly(slot) => (*slot, None),
RpcLeaderScheduleConfigWrapper::ConfigOnly(config) => (None, config.clone()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcLargestAccountsFilter {
Circulating,
NonCirculating,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcLargestAccountsConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub filter: Option<RpcLargestAccountsFilter>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSupplyConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
#[serde(default)]
pub exclude_non_circulating_accounts_list: bool,
}
#[skip_serializing_none]
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcEpochConfig {
pub epoch: Option<Epoch>,
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub min_context_slot: Option<Slot>,
}
#[skip_serializing_none]
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcAccountInfoConfig {
pub encoding: Option<UiAccountEncoding>,
pub data_slice: Option<UiDataSliceConfig>,
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub min_context_slot: Option<Slot>,
}
#[skip_serializing_none]
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcProgramAccountsConfig {
pub filters: Option<Vec<RpcFilterType>>,
#[serde(flatten)]
pub account_config: RpcAccountInfoConfig,
pub with_context: Option<bool>,
}
#[skip_serializing_none]
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSignaturesForAddressConfig {
pub before: Option<String>, // Signature as base-58 string
pub until: Option<String>, // Signature as base-58 string
pub limit: Option<usize>,
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub min_context_slot: Option<Slot>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RpcEncodingConfigWrapper<T> {
Deprecated(Option<UiTransactionEncoding>),
Current(Option<T>),
}
impl<T: EncodingConfig + Default + Copy> RpcEncodingConfigWrapper<T> {
pub fn convert_to_current(&self) -> T {
match self {
RpcEncodingConfigWrapper::Deprecated(encoding) => T::new_with_encoding(encoding),
RpcEncodingConfigWrapper::Current(config) => config.unwrap_or_default(),
}
}
pub fn convert<U: EncodingConfig + From<T>>(&self) -> RpcEncodingConfigWrapper<U> {
match self {
RpcEncodingConfigWrapper::Deprecated(encoding) => {
RpcEncodingConfigWrapper::Deprecated(*encoding)
}
RpcEncodingConfigWrapper::Current(config) => {
RpcEncodingConfigWrapper::Current(config.map(|config| config.into()))
}
}
}
}
pub trait EncodingConfig {
fn new_with_encoding(encoding: &Option<UiTransactionEncoding>) -> Self;
}
#[skip_serializing_none]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockConfig {
pub encoding: Option<UiTransactionEncoding>,
pub transaction_details: Option<TransactionDetails>,
pub rewards: Option<bool>,
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub max_supported_transaction_version: Option<u8>,
}
impl EncodingConfig for RpcBlockConfig {
fn new_with_encoding(encoding: &Option<UiTransactionEncoding>) -> Self {
Self {
encoding: *encoding,
..Self::default()
}
}
}
impl RpcBlockConfig {
pub fn rewards_only() -> Self {
Self {
transaction_details: Some(TransactionDetails::None),
..Self::default()
}
}
pub fn rewards_with_commitment(commitment: Option<CommitmentConfig>) -> Self {
Self {
transaction_details: Some(TransactionDetails::None),
commitment,
..Self::default()
}
}
}
impl From<RpcBlockConfig> for RpcEncodingConfigWrapper<RpcBlockConfig> {
fn from(config: RpcBlockConfig) -> Self {
RpcEncodingConfigWrapper::Current(Some(config))
}
}
#[skip_serializing_none]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcTransactionConfig {
pub encoding: Option<UiTransactionEncoding>,
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub max_supported_transaction_version: Option<u8>,
}
impl EncodingConfig for RpcTransactionConfig {
fn new_with_encoding(encoding: &Option<UiTransactionEncoding>) -> Self {
Self {
encoding: *encoding,
..Self::default()
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RpcBlocksConfigWrapper {
EndSlotOnly(Option<Slot>),
CommitmentOnly(Option<CommitmentConfig>),
}
impl RpcBlocksConfigWrapper {
pub fn unzip(&self) -> (Option<Slot>, Option<CommitmentConfig>) {
match &self {
RpcBlocksConfigWrapper::EndSlotOnly(end_slot) => (*end_slot, None),
RpcBlocksConfigWrapper::CommitmentOnly(commitment) => (None, *commitment),
}
}
}
#[skip_serializing_none]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcContextConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub min_context_slot: Option<Slot>,
}
#[derive(Debug, Default)]
pub struct GetConfirmedSignaturesForAddress2Config {
pub before: Option<Signature>,
pub until: Option<Signature>,
pub limit: Option<usize>,
pub commitment: Option<CommitmentConfig>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcTransactionLogsConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcTransactionLogsFilter {
All,
AllWithVotes,
Mentions(Vec<String>), // base58-encoded list of addresses
}
#[cfg(feature = "pubsub")]
pub mod pubsub {
use super::*;
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct RpcAccountSubscribeConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub encoding: Option<UiTransactionEncoding>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcBlockSubscribeConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub encoding: Option<UiTransactionEncoding>,
pub transaction_details: Option<TransactionDetails>,
pub show_rewards: Option<bool>,
pub max_supported_transaction_version: Option<u8>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RpcBlockSubscribeFilter {
All,
MentionsAccountOrProgram(String),
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcSignatureSubscribeConfig {
#[serde(flatten)]
pub commitment: Option<CommitmentConfig>,
pub enable_received_notification: Option<bool>,
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/Cargo.toml
|
[package]
name = "anchor-cli-wasm"
version = "0.29.0" # mirror Anchor version
description = "Anchor CLI for Solana Playground with WASM"
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "GPL-3.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["anchor", "cli", "solana", "wasm"]
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
anchor-lang = "0.29.0"
anchor-syn = { version = "0.29.0", features = ["idl-types"] }
anyhow = "*"
clap = { version = "*", features = ["derive"] }
console = "*"
console_error_panic_hook = "*"
flate2 = "*"
serde = "*"
serde_derive = "*"
serde_json = "*"
solana-client-wasm = { path = "../solana-client" }
solana-playground-utils-wasm = { path = "../utils/solana-playground-utils" }
solana-sdk = "*"
wasm-bindgen = "*"
wasm-bindgen-futures = "*"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src/lib.rs
|
pub mod cli;
mod commands;
mod utils;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src/utils.rs
|
use std::str::FromStr;
use anchor_lang::prelude::Pubkey;
use anchor_syn::idl::types::Idl;
use anyhow::anyhow;
use solana_client_wasm::WasmClient;
use solana_playground_utils_wasm::js::{PgProgramInfo, PgSettings, PgWallet};
use solana_sdk::{
commitment_config::{CommitmentConfig, CommitmentLevel},
signature::Keypair,
};
use crate::cli::CliResult;
pub fn get_client() -> WasmClient {
let connection_settings = PgSettings::connection();
WasmClient::new_with_commitment(
&connection_settings.endpoint(),
CommitmentConfig {
commitment: match connection_settings.commitment().as_str() {
"processed" => CommitmentLevel::Processed,
"confirmed" => CommitmentLevel::Confirmed,
"finalized" => CommitmentLevel::Finalized,
_ => CommitmentLevel::Confirmed,
},
},
)
}
pub fn get_keypair() -> Keypair {
Keypair::from_bytes(&PgWallet::keypair_bytes()).unwrap()
}
pub fn get_idl() -> CliResult<Idl> {
match PgProgramInfo::idl_string().map(|idl_string| serde_json::from_str(&idl_string).unwrap()) {
Some(idl) => Ok(idl),
None => Err(anyhow!("IDL not found")),
}
}
pub fn get_program_id(maybe_program_id: Option<Pubkey>) -> CliResult<Pubkey> {
match maybe_program_id {
Some(program_id) => Ok(program_id),
None => match PgProgramInfo::pk_string() {
Some(program_id_string) => Ok(Pubkey::from_str(&program_id_string).unwrap()),
None => Err(anyhow!("Program id doesn't exist")),
},
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src/cli.rs
|
use clap::Parser;
use solana_playground_utils_wasm::js::PgTerminal;
use wasm_bindgen::prelude::*;
use crate::commands::idl::{process_idl, IdlCommand};
#[derive(Parser)]
#[clap(version, about)]
enum Cli {
/// Commands for interacting with interface definitions
Idl {
#[clap(subcommand)]
subcmd: IdlCommand,
},
}
pub type CliResult<T = ()> = anyhow::Result<T>;
#[wasm_bindgen(js_name = runAnchor)]
pub async fn run_anchor(cmd: &str) {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
let args = cmd.split_ascii_whitespace().collect::<Vec<&str>>();
match Cli::try_parse_from(args) {
Ok(cli) => match cli {
Cli::Idl { subcmd } => {
if let Err(e) = process_idl(subcmd).await {
PgTerminal::log_wasm(&format!("Process error: {e}"))
}
}
},
Err(e) => PgTerminal::log_wasm(&e.to_string()),
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src/commands/idl.rs
|
use std::io::{Read, Write};
use anchor_lang::{
idl::{IdlAccount, IdlInstruction, ERASED_AUTHORITY},
prelude::AccountMeta,
AccountDeserialize, AnchorDeserialize, AnchorSerialize,
};
use anchor_syn::idl::types::Idl;
use anyhow::anyhow;
use clap::Parser;
use flate2::{read::ZlibDecoder, write::ZlibEncoder, Compression};
use solana_playground_utils_wasm::js::PgTerminal;
use solana_sdk::{
instruction::Instruction, pubkey::Pubkey, signer::keypair::Keypair, signer::Signer,
system_program, sysvar, transaction::Transaction,
};
use crate::{
cli::CliResult,
utils::{get_client, get_idl, get_keypair, get_program_id},
};
#[derive(Parser)]
pub enum IdlCommand {
/// Outputs the authority for the IDL account.
Authority {
/// The program to view.
program_id: Option<Pubkey>,
},
/// Close the IDL account.
Close { program_id: Option<Pubkey> },
/// Command to remove the ability to modify the IDL account. This should
/// likely be used in conjection with eliminating an "upgrade authority" on
/// the program.
EraseAuthority {
#[clap(short, long)]
program_id: Option<Pubkey>,
},
/// Fetches an IDL for the given address from a cluster.
/// The address can be a program, IDL account, or IDL buffer.
Fetch { address: Option<Pubkey> },
/// Initializes a program's IDL account. Can only be run once.
Init { program_id: Option<Pubkey> },
/// Sets a new authority on the IDL account.
SetAuthority {
/// Program to change the IDL authority.
#[clap(short, long)]
program_id: Option<Pubkey>,
/// The IDL account buffer to set the authority of. If none is given,
/// then the canonical IDL account is used.
address: Option<Pubkey>,
/// New authority of the IDL account.
#[clap(short, long)]
new_authority: Pubkey,
},
/// Sets a new IDL buffer for the program.
SetBuffer {
program_id: Option<Pubkey>,
/// Address of the buffer account to set as the idl on the program.
#[clap(short, long)]
buffer: Pubkey,
},
/// Upgrades the IDL to the new file. An alias for first writing and then
/// then setting the idl buffer account.
Upgrade { program_id: Option<Pubkey> },
/// Writes an IDL into a buffer account. This can be used with SetBuffer
/// to perform an upgrade.
WriteBuffer { program_id: Option<Pubkey> },
}
pub async fn process_idl(cmd: IdlCommand) -> CliResult {
match cmd {
IdlCommand::Authority { program_id } => process_authority(program_id).await,
IdlCommand::Close { program_id } => process_close(program_id).await,
IdlCommand::EraseAuthority { program_id } => process_erase_authority(program_id).await,
IdlCommand::Fetch { address } => process_fetch(address).await,
IdlCommand::Init { program_id } => process_init(program_id).await,
IdlCommand::SetAuthority {
program_id,
address,
new_authority,
} => process_set_authority(program_id, address, new_authority).await,
IdlCommand::SetBuffer { program_id, buffer } => {
process_set_buffer(program_id, buffer).await
}
IdlCommand::Upgrade { program_id } => process_upgrade(program_id).await,
IdlCommand::WriteBuffer { program_id } => process_write_buffer(program_id).await,
}
}
async fn process_authority(program_id: Option<Pubkey>) -> CliResult {
let program_id = get_program_id(program_id)?;
let client = get_client();
let idl_address = {
let account = client.get_account(&program_id).await?;
if account.executable {
IdlAccount::address(&program_id)
} else {
program_id
}
};
let account = client.get_account(&idl_address).await?;
let mut data: &[u8] = &account.data;
let idl_account: IdlAccount = AccountDeserialize::try_deserialize(&mut data)?;
PgTerminal::log_wasm(&format!("{}", idl_account.authority));
Ok(())
}
async fn process_close(program_id: Option<Pubkey>) -> CliResult {
let program_id = get_program_id(program_id)?;
let idl_address = IdlAccount::address(&program_id);
let keypair = get_keypair();
let client = get_client();
// Instruction accounts
let accounts = vec![
AccountMeta::new(idl_address, false),
AccountMeta::new_readonly(keypair.pubkey(), true),
AccountMeta::new(keypair.pubkey(), true),
];
// Instruction
let ix = Instruction {
program_id,
accounts,
data: { serialize_idl_ix(anchor_lang::idl::IdlInstruction::Close {})? },
};
// Send transaction
let latest_hash = client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&[ix],
Some(&keypair.pubkey()),
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction(&tx).await?;
PgTerminal::log_wasm(&format!("IDL account closed: {}", idl_address));
Ok(())
}
async fn process_erase_authority(program_id: Option<Pubkey>) -> CliResult {
process_set_authority(program_id, None, ERASED_AUTHORITY).await
}
async fn process_fetch(addr: Option<Pubkey>) -> CliResult {
let addr = get_program_id(addr)?;
let client = get_client();
let mut account = client.get_account(&addr).await?;
if account.executable {
let addr = IdlAccount::address(&addr);
account = client.get_account(&addr).await?
}
// Cut off account discriminator
let mut data = &account.data[8..];
let idl_account: IdlAccount = AnchorDeserialize::deserialize(&mut data)?;
let compressed_len: usize = idl_account.data_len.try_into().unwrap();
let compressed_bytes = &account.data[44..44 + compressed_len];
let mut z = ZlibDecoder::new(compressed_bytes);
let mut s = Vec::new();
z.read_to_end(&mut s)?;
let idl: Idl = serde_json::from_slice(&s[..])?;
let idl_string = serde_json::to_string_pretty(&idl)?;
PgTerminal::log_wasm(&idl_string);
Ok(())
}
async fn process_init(program_id: Option<Pubkey>) -> CliResult {
let program_id = get_program_id(program_id)?;
let idl = get_idl()?;
let idl_address = IdlAccount::address(&program_id);
let idl_data = serialize_idl(&idl)?;
let keypair = get_keypair();
let client = get_client();
// Run `Create instruction
{
let pda_max_growth = 60_000;
let idl_header_size = 44;
let idl_data_len = idl_data.len() as u64;
// We're only going to support up to 6 instructions in one transaction
// because will anyone really have a >60kb IDL?
if idl_data_len > pda_max_growth {
return Err(anyhow!(
"Your IDL is over 60kb and this isn't supported right now"
));
}
// Double for future growth
let data_len = (idl_data_len * 2).min(pda_max_growth - idl_header_size);
let num_additional_instructions = data_len / 10000;
let mut instructions = Vec::new();
let data = serialize_idl_ix(anchor_lang::idl::IdlInstruction::Create { data_len })?;
let program_signer = Pubkey::find_program_address(&[], &program_id).0;
let accounts = vec![
AccountMeta::new_readonly(keypair.pubkey(), true),
AccountMeta::new(idl_address, false),
AccountMeta::new_readonly(program_signer, false),
AccountMeta::new_readonly(system_program::ID, false),
AccountMeta::new_readonly(program_id, false),
AccountMeta::new_readonly(sysvar::rent::ID, false),
];
instructions.push(Instruction {
program_id,
accounts,
data,
});
for _ in 0..num_additional_instructions {
let data = serialize_idl_ix(anchor_lang::idl::IdlInstruction::Resize { data_len })?;
instructions.push(Instruction {
program_id,
accounts: vec![
AccountMeta::new(idl_address, false),
AccountMeta::new_readonly(keypair.pubkey(), true),
AccountMeta::new_readonly(system_program::ID, false),
],
data,
});
}
let latest_hash = client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&keypair.pubkey()),
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction(&tx).await?;
}
// Write directly to the IDL account buffer
idl_write(program_id, &idl, IdlAccount::address(&program_id)).await?;
PgTerminal::log_wasm(&format!("IDL account created: {}", idl_address));
Ok(())
}
async fn process_set_authority(
program_id: Option<Pubkey>,
idl_address: Option<Pubkey>,
new_authority: Pubkey,
) -> CliResult {
let program_id = get_program_id(program_id)?;
let idl_address = idl_address.unwrap_or(IdlAccount::address(&program_id));
let keypair = get_keypair();
let client = get_client();
// Instruction data
let data = serialize_idl_ix(anchor_lang::idl::IdlInstruction::SetAuthority { new_authority })?;
// Instruction accounts
let accounts = vec![
AccountMeta::new(idl_address, false),
AccountMeta::new_readonly(keypair.pubkey(), true),
];
// Instruction
let ix = Instruction {
program_id,
accounts,
data,
};
// Send transaction
let latest_hash = client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&[ix],
Some(&keypair.pubkey()),
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction(&tx).await?;
if new_authority == ERASED_AUTHORITY {
PgTerminal::log_wasm("Erased authority.");
} else {
PgTerminal::log_wasm(&format!("Set authority to: {}", new_authority));
}
Ok(())
}
async fn process_set_buffer(program_id: Option<Pubkey>, buffer: Pubkey) -> CliResult {
let program_id = get_program_id(program_id)?;
let keypair = get_keypair();
let client = get_client();
// Instruction to set the buffer onto the IdlAccount
let set_buffer_ix = {
let accounts = vec![
AccountMeta::new(buffer, false),
AccountMeta::new(IdlAccount::address(&program_id), false),
AccountMeta::new(keypair.pubkey(), true),
];
let mut data = anchor_lang::idl::IDL_IX_TAG.to_le_bytes().to_vec();
data.append(&mut IdlInstruction::SetBuffer.try_to_vec()?);
Instruction {
program_id,
accounts,
data,
}
};
// Build the transaction
let latest_hash = client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&[set_buffer_ix],
Some(&keypair.pubkey()),
&[&keypair],
latest_hash,
);
// Send the transaction
client.send_and_confirm_transaction(&tx).await?;
Ok(())
}
async fn process_upgrade(program_id: Option<Pubkey>) -> CliResult {
let program_id = get_program_id(program_id)?;
let buffer_pk = create_and_write_buffer(program_id).await?;
process_set_buffer(Some(program_id), buffer_pk).await
}
async fn process_write_buffer(program_id: Option<Pubkey>) -> CliResult {
let program_id = get_program_id(program_id)?;
create_and_write_buffer(program_id).await?;
Ok(())
}
/// Write the idl to the account buffer, chopping up the IDL into pieces and sending multiple
/// transactions in the event the IDL doesn't fit into a single transaction
async fn idl_write(program_id: Pubkey, idl: &Idl, idl_address: Pubkey) -> CliResult {
let keypair = get_keypair();
let client = get_client();
// Remove the metadata before deploy
let mut idl = idl.clone();
idl.metadata = None;
// Serialize and compress the idl
let idl_data = {
let json_bytes = serde_json::to_vec(&idl)?;
let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
e.write_all(&json_bytes)?;
e.finish()?
};
const MAX_WRITE_SIZE: usize = 1000;
let mut offset = 0;
while offset < idl_data.len() {
// Instruction data
let data = {
let start = offset;
let end = std::cmp::min(offset + MAX_WRITE_SIZE, idl_data.len());
serialize_idl_ix(anchor_lang::idl::IdlInstruction::Write {
data: idl_data[start..end].to_vec(),
})?
};
// Instruction accounts
let accounts = vec![
AccountMeta::new(idl_address, false),
AccountMeta::new_readonly(keypair.pubkey(), true),
];
// Instruction
let ix = Instruction {
program_id,
accounts,
data,
};
// Send transaction
let latest_hash = client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&[ix],
Some(&keypair.pubkey()),
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction(&tx).await?;
offset += MAX_WRITE_SIZE;
}
Ok(())
}
/// Serialize and compress the idl
fn serialize_idl(idl: &Idl) -> CliResult<Vec<u8>> {
let json_bytes = serde_json::to_vec(idl)?;
let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
e.write_all(&json_bytes)?;
e.finish().map_err(Into::into)
}
fn serialize_idl_ix(ix_inner: anchor_lang::idl::IdlInstruction) -> CliResult<Vec<u8>> {
let mut data = anchor_lang::idl::IDL_IX_TAG.to_le_bytes().to_vec();
data.append(&mut ix_inner.try_to_vec()?);
Ok(data)
}
async fn create_and_write_buffer(program_id: Pubkey) -> CliResult<Pubkey> {
let idl = get_idl()?;
let keypair = get_keypair();
let client = get_client();
let buffer_kp = Keypair::new();
let buffer_pk = buffer_kp.pubkey();
// Creates the new buffer account with the system program
let create_account_ix = {
let space = 8 + 32 + 4 + serialize_idl(&idl)?.len();
let lamports = client.get_minimum_balance_for_rent_exemption(space).await?;
solana_sdk::system_instruction::create_account(
&keypair.pubkey(),
&buffer_pk,
lamports,
space as u64,
&program_id,
)
};
// Program instruction to create the buffer
let create_buffer_ix = {
let accounts = vec![
AccountMeta::new(buffer_pk, false),
AccountMeta::new_readonly(keypair.pubkey(), true),
AccountMeta::new_readonly(sysvar::rent::ID, false),
];
let mut data = anchor_lang::idl::IDL_IX_TAG.to_le_bytes().to_vec();
data.append(&mut IdlInstruction::CreateBuffer.try_to_vec()?);
Instruction {
program_id,
accounts,
data,
}
};
// Build the transaction
let latest_hash = client.get_latest_blockhash().await?;
let tx = Transaction::new_signed_with_payer(
&[create_account_ix, create_buffer_ix],
Some(&keypair.pubkey()),
&[&keypair, &buffer_kp],
latest_hash,
);
// Send the transaction
client.send_and_confirm_transaction(&tx).await?;
idl_write(program_id, &idl, buffer_pk).await?;
PgTerminal::log_wasm(&format!("IDL buffer created: {}", buffer_pk));
Ok(buffer_pk)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/anchor-cli/src/commands/mod.rs
|
pub mod idl;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/Cargo.toml
|
[package]
name = "playnet"
version = "0.1.0"
description = "A minimal runtime to execute Solana programs"
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "GPL-3.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["playnet", "solana", "playground", "wasm"]
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
base64 = "*"
bincode = "*"
console_error_panic_hook = "*"
serde = "*"
serde_derive = "*"
serde_json = "*"
solana-bpf-loader-program = { path = "../../../forks/solana/programs/bpf_loader" }
solana-program-runtime = { path = "../../../forks/solana/program-runtime" }
solana_rbpf = { path = "../../../forks/rbpf" }
solana-sdk = { path = "../../../forks/solana/sdk" }
wasm-bindgen = { version = "=0.2.86" }
[dev-dependencies]
wasm-bindgen-test = "0.3.33"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/Cargo.lock
|
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aead"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877"
dependencies = [
"generic-array",
]
[[package]]
name = "aes"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
dependencies = [
"cfg-if",
"cipher 0.3.0",
"cpufeatures",
"opaque-debug",
]
[[package]]
name = "aes-gcm-siv"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc"
dependencies = [
"aead",
"aes",
"cipher 0.3.0",
"ctr",
"polyval",
"subtle",
"zeroize",
]
[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom 0.2.8",
"once_cell",
"version_check",
]
[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "ark-bn254"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea691771ebbb28aea556c044e2e5c5227398d840cee0c34d4d20fa8eb2689e8c"
dependencies = [
"ark-ec",
"ark-ff",
"ark-std",
]
[[package]]
name = "ark-ec"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dea978406c4b1ca13c2db2373b05cc55429c3575b8b21f1b9ee859aa5b03dd42"
dependencies = [
"ark-ff",
"ark-serialize",
"ark-std",
"derivative",
"num-traits",
"zeroize",
]
[[package]]
name = "ark-ff"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6"
dependencies = [
"ark-ff-asm",
"ark-ff-macros",
"ark-serialize",
"ark-std",
"derivative",
"num-bigint",
"num-traits",
"paste",
"rustc_version 0.3.3",
"zeroize",
]
[[package]]
name = "ark-ff-asm"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "ark-ff-macros"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20"
dependencies = [
"num-bigint",
"num-traits",
"quote",
"syn",
]
[[package]]
name = "ark-serialize"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671"
dependencies = [
"ark-std",
"digest 0.9.0",
]
[[package]]
name = "ark-std"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c"
dependencies = [
"num-traits",
"rand 0.8.5",
]
[[package]]
name = "array-bytes"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ad284aeb45c13f2fb4f084de4a420ebf447423bdf9386c0540ce33cb3ef4b8c"
[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "arrayvec"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "ascii"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e"
[[package]]
name = "assert_matches"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
"serde",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitmaps"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
dependencies = [
"typenum",
]
[[package]]
name = "blake3"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef"
dependencies = [
"arrayref",
"arrayvec",
"cc",
"cfg-if",
"constant_time_eq",
"digest 0.10.6",
]
[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"block-padding",
"generic-array",
]
[[package]]
name = "block-buffer"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [
"generic-array",
]
[[package]]
name = "block-padding"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "borsh"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa"
dependencies = [
"borsh-derive",
"hashbrown 0.11.2",
]
[[package]]
name = "borsh-derive"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775"
dependencies = [
"borsh-derive-internal",
"borsh-schema-derive-internal",
"proc-macro-crate 0.1.5",
"proc-macro2",
"syn",
]
[[package]]
name = "borsh-derive-internal"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "bs58"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3"
[[package]]
name = "bumpalo"
version = "3.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
[[package]]
name = "bv"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340"
dependencies = [
"feature-probe",
"serde",
]
[[package]]
name = "bytemuck"
version = "1.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fe233b960f12f8007e3db2d136e3cb1c291bfd7396e384ee76025fc1a3932b4"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
dependencies = [
"jobserver",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
dependencies = [
"num-integer",
"num-traits",
]
[[package]]
name = "cipher"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
dependencies = [
"generic-array",
]
[[package]]
name = "cipher"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e"
dependencies = [
"crypto-common",
"inout",
]
[[package]]
name = "combine"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680"
dependencies = [
"ascii",
"byteorder",
"either",
"memchr",
"unreachable",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "console_log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494"
dependencies = [
"log",
"web-sys",
]
[[package]]
name = "constant_time_eq"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279"
[[package]]
name = "cpufeatures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a"
dependencies = [
"autocfg",
"cfg-if",
"crossbeam-utils",
"memoffset 0.7.1",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
dependencies = [
"cfg-if",
]
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "crypto-mac"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
dependencies = [
"generic-array",
"subtle",
]
[[package]]
name = "ctr"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea"
dependencies = [
"cipher 0.3.0",
]
[[package]]
name = "curve25519-dalek"
version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0"
dependencies = [
"byteorder",
"digest 0.9.0",
"rand_core 0.5.1",
"serde",
"subtle",
"zeroize",
]
[[package]]
name = "derivation-path"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0"
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
"generic-array",
]
[[package]]
name = "digest"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer 0.10.3",
"crypto-common",
"subtle",
]
[[package]]
name = "eager"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abe71d579d1812060163dff96056261deb5bf6729b100fa2e36a68b9649ba3d3"
[[package]]
name = "ed25519"
version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369"
dependencies = [
"signature",
]
[[package]]
name = "ed25519-dalek"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
dependencies = [
"curve25519-dalek",
"ed25519",
"rand 0.7.3",
"serde",
"sha2 0.9.9",
"zeroize",
]
[[package]]
name = "ed25519-dalek-bip32"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908"
dependencies = [
"derivation-path",
"ed25519-dalek",
"hmac 0.12.1",
"sha2 0.10.6",
]
[[package]]
name = "either"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "enum-iterator"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91a4ec26efacf4aeff80887a175a419493cb6f8b5480d26387eb0bd038976187"
dependencies = [
"enum-iterator-derive",
]
[[package]]
name = "enum-iterator-derive"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "828de45d0ca18782232dfb8f3ea9cc428e8ced380eb26a520baaacfc70de39ce"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "env_logger"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "feature-probe"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "generic-array"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"serde",
"typenum",
"version_check",
]
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
[[package]]
name = "getrandom"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
[[package]]
name = "goblin"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143"
dependencies = [
"log",
"plain",
"scroll",
]
[[package]]
name = "hash32"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
dependencies = [
"byteorder",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
dependencies = [
"ahash",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
]
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "hmac"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840"
dependencies = [
"crypto-mac",
"digest 0.9.0",
]
[[package]]
name = "hmac"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
"digest 0.10.6",
]
[[package]]
name = "hmac-drbg"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1"
dependencies = [
"digest 0.9.0",
"generic-array",
"hmac 0.8.1",
]
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "im"
version = "15.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9"
dependencies = [
"bitmaps",
"rand_core 0.6.4",
"rand_xoshiro",
"rayon",
"serde",
"sized-chunks",
"typenum",
"version_check",
]
[[package]]
name = "inout"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
dependencies = [
"generic-array",
]
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]]
name = "jobserver"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b"
dependencies = [
"libc",
]
[[package]]
name = "js-sys"
version = "0.3.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "keccak"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768"
dependencies = [
"cpufeatures",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "libloading"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
]
[[package]]
name = "libsecp256k1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73"
dependencies = [
"arrayref",
"base64 0.12.3",
"digest 0.9.0",
"hmac-drbg",
"libsecp256k1-core",
"libsecp256k1-gen-ecmult",
"libsecp256k1-gen-genmult",
"rand 0.7.3",
"serde",
"sha2 0.9.9",
"typenum",
]
[[package]]
name = "libsecp256k1-core"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80"
dependencies = [
"crunchy",
"digest 0.9.0",
"subtle",
]
[[package]]
name = "libsecp256k1-gen-ecmult"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3"
dependencies = [
"libsecp256k1-core",
]
[[package]]
name = "libsecp256k1-gen-genmult"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d"
dependencies = [
"libsecp256k1-core",
]
[[package]]
name = "lock_api"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memmap2"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"
dependencies = [
"libc",
]
[[package]]
name = "memoffset"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "merlin"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d"
dependencies = [
"byteorder",
"keccak",
"rand_core 0.6.4",
"zeroize",
]
[[package]]
name = "num-bigint"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-derive"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi 0.2.6",
"libc",
]
[[package]]
name = "num_enum"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9"
dependencies = [
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
dependencies = [
"proc-macro-crate 1.2.1",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "once_cell"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]]
name = "paste"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
[[package]]
name = "pbkdf2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd"
dependencies = [
"crypto-mac",
]
[[package]]
name = "pbkdf2"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest 0.10.6",
]
[[package]]
name = "percent-encoding"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0"
dependencies = [
"thiserror",
"ucd-trie",
]
[[package]]
name = "plain"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "playnet"
version = "0.1.0"
dependencies = [
"base64 0.13.1",
"bincode",
"console_error_panic_hook",
"serde",
"serde_derive",
"serde_json",
"solana-bpf-loader-program",
"solana-program-runtime",
"solana-sdk",
"solana_rbpf",
"wasm-bindgen",
"wasm-bindgen-test",
]
[[package]]
name = "polyval"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1"
dependencies = [
"cfg-if",
"cpufeatures",
"opaque-debug",
"universal-hash",
]
[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]]
name = "proc-macro-crate"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9"
dependencies = [
"once_cell",
"thiserror",
"toml",
]
[[package]]
name = "proc-macro2"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
dependencies = [
"unicode-ident",
]
[[package]]
name = "qstring"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e"
dependencies = [
"percent-encoding",
]
[[package]]
name = "quote"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.4",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom 0.2.8",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "rand_xoshiro"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
dependencies = [
"rand_core 0.6.4",
]
[[package]]
name = "rayon"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"num_cpus",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "regex"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
"semver 0.11.0",
]
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver 1.0.16",
]
[[package]]
name = "rustversion"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
[[package]]
name = "ryu"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "scroll"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da"
dependencies = [
"scroll_derive",
]
[[package]]
name = "scroll_derive"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "semver"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
[[package]]
name = "semver-parser"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
dependencies = [
"pest",
]
[[package]]
name = "serde"
version = "1.0.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_bytes"
version = "0.11.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "718dc5fff5b36f99093fc49b280cfc96ce6fc824317783bff5a1fed0c7a64819"
dependencies = [
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "sha2"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
"cpufeatures",
"digest 0.9.0",
"opaque-debug",
]
[[package]]
name = "sha2"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
"digest 0.10.6",
]
[[package]]
name = "sha3"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
dependencies = [
"block-buffer 0.9.0",
"digest 0.9.0",
"keccak",
"opaque-debug",
]
[[package]]
name = "sha3"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9"
dependencies = [
"digest 0.10.6",
"keccak",
]
[[package]]
name = "signature"
version = "1.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
[[package]]
name = "sized-chunks"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e"
dependencies = [
"bitmaps",
"typenum",
]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "solana-bpf-loader-program"
version = "1.15.0"
dependencies = [
"bincode",
"byteorder",
"libsecp256k1",
"log",
"rand 0.7.3",
"solana-measure",
"solana-program-runtime",
"solana-sdk",
"solana-zk-token-sdk",
"solana_rbpf",
"thiserror",
]
[[package]]
name = "solana-frozen-abi"
version = "1.15.0"
dependencies = [
"ahash",
"blake3",
"block-buffer 0.9.0",
"bs58",
"bv",
"byteorder",
"cc",
"either",
"generic-array",
"getrandom 0.1.16",
"hashbrown 0.12.3",
"im",
"lazy_static",
"log",
"memmap2",
"once_cell",
"rand_core 0.6.4",
"rustc_version 0.4.0",
"serde",
"serde_bytes",
"serde_derive",
"serde_json",
"sha2 0.10.6",
"solana-frozen-abi-macro",
"subtle",
"thiserror",
]
[[package]]
name = "solana-frozen-abi-macro"
version = "1.15.0"
dependencies = [
"proc-macro2",
"quote",
"rustc_version 0.4.0",
"syn",
]
[[package]]
name = "solana-logger"
version = "1.15.0"
dependencies = [
"env_logger",
"lazy_static",
"log",
]
[[package]]
name = "solana-measure"
version = "1.15.0"
dependencies = [
"log",
"solana-sdk",
]
[[package]]
name = "solana-program"
version = "1.15.0"
dependencies = [
"ark-bn254",
"ark-ec",
"ark-ff",
"array-bytes",
"base64 0.13.1",
"bincode",
"bitflags",
"blake3",
"borsh",
"borsh-derive",
"bs58",
"bv",
"bytemuck",
"cc",
"console_error_panic_hook",
"console_log",
"curve25519-dalek",
"getrandom 0.2.8",
"itertools",
"js-sys",
"lazy_static",
"libc",
"libsecp256k1",
"log",
"memoffset 0.6.5",
"num-derive",
"num-traits",
"parking_lot",
"rand 0.7.3",
"rand_chacha 0.2.2",
"rustc_version 0.4.0",
"rustversion",
"serde",
"serde_bytes",
"serde_derive",
"serde_json",
"sha2 0.10.6",
"sha3 0.10.6",
"solana-frozen-abi",
"solana-frozen-abi-macro",
"solana-sdk-macro",
"thiserror",
"tiny-bip39",
"wasm-bindgen",
"zeroize",
]
[[package]]
name = "solana-program-runtime"
version = "1.15.0"
dependencies = [
"base64 0.13.1",
"bincode",
"eager",
"enum-iterator",
"itertools",
"libc",
"libloading",
"log",
"num-derive",
"num-traits",
"rand 0.7.3",
"rustc_version 0.4.0",
"serde",
"solana-frozen-abi",
"solana-frozen-abi-macro",
"solana-measure",
"solana-sdk",
"solana_rbpf",
"thiserror",
]
[[package]]
name = "solana-sdk"
version = "1.15.0"
dependencies = [
"assert_matches",
"base64 0.13.1",
"bincode",
"bitflags",
"borsh",
"bs58",
"bytemuck",
"byteorder",
"chrono",
"derivation-path",
"digest 0.10.6",
"ed25519-dalek",
"ed25519-dalek-bip32",
"generic-array",
"hmac 0.12.1",
"itertools",
"js-sys",
"lazy_static",
"libsecp256k1",
"log",
"memmap2",
"num-derive",
"num-traits",
"num_enum",
"pbkdf2 0.11.0",
"qstring",
"rand 0.7.3",
"rand_chacha 0.2.2",
"rustc_version 0.4.0",
"rustversion",
"serde",
"serde_bytes",
"serde_derive",
"serde_json",
"sha2 0.10.6",
"sha3 0.10.6",
"solana-frozen-abi",
"solana-frozen-abi-macro",
"solana-logger",
"solana-program",
"solana-sdk-macro",
"thiserror",
"uriparse",
"wasm-bindgen",
]
[[package]]
name = "solana-sdk-macro"
version = "1.15.0"
dependencies = [
"bs58",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "solana-zk-token-sdk"
version = "1.15.0"
dependencies = [
"aes-gcm-siv",
"arrayref",
"base64 0.13.1",
"bincode",
"bytemuck",
"byteorder",
"cipher 0.4.3",
"curve25519-dalek",
"getrandom 0.1.16",
"itertools",
"lazy_static",
"merlin",
"num-derive",
"num-traits",
"rand 0.7.3",
"serde",
"serde_json",
"sha3 0.9.1",
"solana-program",
"solana-sdk",
"subtle",
"thiserror",
"zeroize",
]
[[package]]
name = "solana_rbpf"
version = "0.2.38"
dependencies = [
"byteorder",
"combine",
"goblin",
"hash32",
"log",
"rand 0.8.5",
"rustc-demangle",
"scroll",
"thiserror",
]
[[package]]
name = "subtle"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "syn"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"unicode-xid",
]
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tiny-bip39"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d"
dependencies = [
"anyhow",
"hmac 0.8.1",
"once_cell",
"pbkdf2 0.4.0",
"rand 0.7.3",
"rustc-hash",
"sha2 0.9.9",
"thiserror",
"unicode-normalization",
"wasm-bindgen",
"zeroize",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "toml"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
dependencies = [
"serde",
]
[[package]]
name = "typenum"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "ucd-trie"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
[[package]]
name = "unicode-ident"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "unicode-normalization"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-xid"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "universal-hash"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05"
dependencies = [
"generic-array",
"subtle",
]
[[package]]
name = "unreachable"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
dependencies = [
"void",
]
[[package]]
name = "uriparse"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff"
dependencies = [
"fnv",
"lazy_static",
]
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
[[package]]
name = "wasm-bindgen-test"
version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d2fff962180c3fadf677438054b1db62bee4aa32af26a45388af07d1287e1d"
dependencies = [
"console_error_panic_hook",
"js-sys",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4683da3dfc016f704c9f82cf401520c4f1cb3ee440f7f52b3d6ac29506a49ca7"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "web-sys"
version = "0.3.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
[[package]]
name = "zeroize"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/types.rs
|
use solana_sdk::{
account::Account,
clock::UnixTimestamp,
hash::Hash,
pubkey::Pubkey,
slot_history::Slot,
stake_history::Epoch,
transaction::{self, TransactionError, TransactionVersion},
transaction_context::{TransactionAccount, TransactionReturnData},
};
use wasm_bindgen::prelude::*;
use crate::runtime::transaction_history::{ConfirmedTransactionMeta, TransactionData};
#[wasm_bindgen]
pub struct WasmAccount {
/// Lamports in the account
pub lamports: u64,
/// Data held in this account
#[wasm_bindgen(getter_with_clone)]
pub data: Vec<u8>,
/// The program that owns this account. If executable, the program that loads this account.
pub owner: Pubkey,
/// This account's data contains a loaded program (and is now read-only)
pub executable: bool,
/// The epoch at which this account will next owe rent
#[wasm_bindgen(js_name = rentEpoch)]
pub rent_epoch: Epoch,
}
impl From<Account> for WasmAccount {
fn from(account: Account) -> Self {
Self {
lamports: account.lamports,
data: account.data,
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
}
}
}
#[wasm_bindgen]
pub struct GetLatestBlockhashResult {
blockhash: Hash,
last_valid_block_height: u64,
}
impl GetLatestBlockhashResult {
pub fn new(blockhash: Hash, last_valid_block_height: u64) -> Self {
Self {
blockhash,
last_valid_block_height,
}
}
}
#[wasm_bindgen]
impl GetLatestBlockhashResult {
pub fn blockhash(&self) -> String {
self.blockhash.to_string()
}
#[wasm_bindgen(js_name = lastValidBlockHeight)]
pub fn last_valid_block_height(&self) -> u64 {
self.last_valid_block_height
}
}
/// Return data at the end of a transaction
#[wasm_bindgen]
pub struct WasmTransactionReturnData {
#[wasm_bindgen(js_name = programId)]
pub program_id: Pubkey,
#[wasm_bindgen(getter_with_clone)]
pub data: Vec<u8>,
}
impl From<TransactionReturnData> for WasmTransactionReturnData {
fn from(val: TransactionReturnData) -> Self {
Self {
data: val.data,
program_id: val.program_id,
}
}
}
#[wasm_bindgen]
pub struct SimulateTransactionResult {
pub(crate) result: transaction::Result<()>,
pub(crate) pre_accounts: Vec<TransactionAccount>,
pub(crate) post_accounts: Vec<TransactionAccount>,
pub(crate) logs: Vec<String>,
pub(crate) units_consumed: u64,
pub(crate) return_data: Option<TransactionReturnData>,
}
impl SimulateTransactionResult {
pub fn new(
result: transaction::Result<()>,
pre_accounts: Vec<TransactionAccount>,
post_accounts: Vec<TransactionAccount>,
logs: Vec<String>,
units_consumed: u64,
return_data: Option<TransactionReturnData>,
) -> Self {
Self {
result,
pre_accounts,
post_accounts,
logs,
units_consumed,
return_data,
}
}
pub fn new_error(err: transaction::TransactionError) -> Self {
Self {
result: Err(err),
logs: vec![],
pre_accounts: vec![],
post_accounts: vec![],
units_consumed: 0,
return_data: None,
}
}
}
#[wasm_bindgen]
impl SimulateTransactionResult {
pub fn error(&self) -> Option<String> {
match &self.result {
Ok(_) => None,
Err(err) => Some(err.to_string()),
}
}
pub fn logs(&self) -> Vec<JsValue> {
self.logs.iter().map(|log| JsValue::from_str(log)).collect()
}
#[wasm_bindgen(js_name = unitsConsumed)]
pub fn units_consumed(&self) -> u64 {
self.units_consumed
}
#[wasm_bindgen(js_name = returnData)]
pub fn return_data(&self) -> Option<WasmTransactionReturnData> {
self.return_data
.as_ref()
.map(|tx_return_data| WasmTransactionReturnData::from(tx_return_data.to_owned()))
}
}
#[wasm_bindgen]
pub struct SendTransactionResult {
result: transaction::Result<String>,
}
impl SendTransactionResult {
pub fn new(tx_hash: String) -> Self {
Self {
result: Ok(tx_hash),
}
}
pub fn new_error(err: TransactionError) -> Self {
Self { result: Err(err) }
}
}
#[wasm_bindgen]
impl SendTransactionResult {
pub fn error(&self) -> Option<String> {
match &self.result {
Ok(_) => None,
Err(err) => Some(err.to_string()),
}
}
#[wasm_bindgen(js_name = txHash)]
pub fn tx_hash(&self) -> String {
self.result.as_ref().unwrap().to_owned()
}
}
#[wasm_bindgen]
pub struct GetSignatureStatusesResult {
statuses: Vec<Option<TransactionStatus>>,
}
impl GetSignatureStatusesResult {
pub fn new(statuses: Vec<Option<TransactionStatus>>) -> Self {
Self { statuses }
}
}
#[wasm_bindgen]
impl GetSignatureStatusesResult {
pub fn statuses(self) -> Vec<JsValue> {
self.statuses
.into_iter()
.map(|status| JsValue::from(status))
.collect()
}
}
#[wasm_bindgen]
pub struct TransactionStatus {
#[wasm_bindgen(js_name = confirmationStatus)]
pub confirmation_status: Option<WasmCommitmentLevel>,
pub confirmations: Option<usize>,
pub slot: Slot,
err: Option<TransactionError>,
}
impl TransactionStatus {
pub fn new(
confirmation_status: Option<WasmCommitmentLevel>,
confirmations: Option<usize>,
slot: Slot,
err: Option<TransactionError>,
) -> Self {
Self {
confirmation_status,
confirmations,
slot,
err,
}
}
}
#[wasm_bindgen]
impl TransactionStatus {
pub fn error(&self) -> Option<String> {
self.err.as_ref().and_then(|err| Some(err.to_string()))
}
}
#[wasm_bindgen]
pub struct GetTransactionResult {
data: Option<TransactionData>,
}
impl GetTransactionResult {
pub fn new(data: Option<TransactionData>) -> Self {
Self { data }
}
}
#[wasm_bindgen]
impl GetTransactionResult {
/// NOTE: This method should be called before accessing any other data
pub fn exists(&self) -> bool {
self.data.is_some()
}
#[wasm_bindgen(js_name = blockTime)]
pub fn block_time(&self) -> Option<UnixTimestamp> {
self.data.as_ref().unwrap().get_block_time()
}
/// Returns the transaction version or `None` for legacy transactions
pub fn version(&self) -> Option<u8> {
match self.data.as_ref().unwrap().get_tx().version() {
TransactionVersion::Legacy(_) => None,
TransactionVersion::Number(version) => Some(version),
}
}
pub fn meta(&self) -> ConfirmedTransactionMeta {
self.data
.as_ref()
.unwrap()
.get_meta()
.as_ref()
.unwrap()
.clone()
}
/// Returns the base64 encoded tx string
pub fn transaction(&self) -> String {
base64::encode(bincode::serialize(&self.data.as_ref().unwrap().get_tx()).unwrap())
}
}
#[wasm_bindgen]
#[derive(Clone, Copy)]
pub enum WasmCommitmentLevel {
Processed,
Confirmed,
Finalized,
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/serde.rs
|
// Custom de/serializations
use std::{collections::HashMap, str::FromStr};
use serde::{
ser::{SerializeMap, Serializer},
Deserialize, Deserializer,
};
/// `Pubkey` is getting de/serialized as bytes but JSON keys must be strings.
/// We do the necessary conversion with custom de/serialization implementation.
pub mod bank_accounts {
use solana_sdk::{account::Account, pubkey::Pubkey};
use crate::runtime::bank::BankAccounts;
use super::*;
/// `Pubkey` as key is getting serialized as bytes by default. This function
/// serializes `Pubkey`s as `String`s to make `serde_json::to_string` work.
pub fn serialize<S>(accounts: &BankAccounts, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut map = serializer.serialize_map(Some(accounts.len()))?;
for (k, v) in accounts {
map.serialize_entry(&k.to_string(), v)?;
}
map.end()
}
pub fn deserialize<'de, D>(deserializer: D) -> Result<BankAccounts, D::Error>
where
D: Deserializer<'de>,
{
let mut pubkey_hm = HashMap::new();
let string_hm = HashMap::<String, Account>::deserialize(deserializer)?;
for (s, acc) in string_hm {
pubkey_hm.insert(Pubkey::from_str(&s).unwrap(), acc);
}
Ok(pubkey_hm)
}
}
/// Custom de-serialize implementation for `Keypair`
pub mod bank_keypair {
use solana_sdk::signature::Keypair;
use super::*;
/// `Pubkey` as key is getting serialized as bytes by default. This function
/// serializes `Pubkey`s as `String`s to make `serde_json::to_string` work.
pub fn serialize<S>(keypair: &Keypair, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_bytes(&keypair.to_bytes())
}
pub fn deserialize<'de, D>(deserializer: D) -> Result<Keypair, D::Error>
where
D: Deserializer<'de>,
{
let buffer = Vec::<u8>::deserialize(deserializer)?;
Ok(Keypair::from_bytes(&buffer).unwrap())
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/playnet.rs
|
// Playnet creates a minimal custom runtime to allow testing Solana programs
// in browsers(though not limited to) without restrictions with the help of WASM.
//
// Playnet is not `solana-test-validator`, it's specifically designed for single
// user in mind to consume as little resources as possible.
use std::{rc::Rc, sync::RwLock};
use wasm_bindgen::prelude::*;
use crate::{rpc::PgRpc, runtime::bank::PgBank};
#[wasm_bindgen]
pub struct Playnet {
/// RPC methods to interact with the Playnet
#[wasm_bindgen(getter_with_clone)]
pub rpc: PgRpc,
/// Reference to the bank
bank: Rc<RwLock<PgBank>>,
}
#[wasm_bindgen]
impl Playnet {
/// Playnet lifecycle starts after constructing a Playnet instance
#[wasm_bindgen(constructor)]
pub fn new(maybe_bank_string: Option<String>) -> Self {
// Get WASM errors in console
console_error_panic_hook::set_once();
// Create the bank
let bank = Rc::new(RwLock::new(PgBank::new(maybe_bank_string)));
Self {
rpc: PgRpc::new(Rc::clone(&bank)),
bank: Rc::clone(&bank),
}
}
/// Get the save data necessary to recover from the next time Playnet instance gets created
#[wasm_bindgen(js_name = getSaveData)]
pub fn get_save_data(&self) -> String {
serde_json::to_string(&*self.bank.read().unwrap()).unwrap()
}
}
#[cfg(test)]
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[cfg(test)]
pub mod test {
use std::str::FromStr;
use solana_sdk::{
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
hash::Hash,
instruction::{AccountMeta, Instruction},
message::Message,
native_token::LAMPORTS_PER_SOL,
packet::PACKET_DATA_SIZE,
pubkey::Pubkey,
signature::Keypair,
signer::Signer,
signers::Signers,
system_instruction, system_program,
transaction::Transaction,
};
use wasm_bindgen_test::*;
use crate::test_programs;
use super::Playnet;
/// Tests whether `system_program::transfer` works as expected
#[test]
#[wasm_bindgen_test]
fn transfer() {
let playnet = Playnet::new(None);
let sender_kp = get_payer(&playnet);
let sender_pk = sender_kp.pubkey();
let receiver_kp = Keypair::new();
let receiver_pk = receiver_kp.pubkey();
// Transfer
let send_amount = 1 * LAMPORTS_PER_SOL;
let ixs = &[system_instruction::transfer(
&sender_pk,
&receiver_pk,
send_amount,
)];
send_tx(ixs, &sender_pk, [&sender_kp], &playnet);
// Get fee for message
let fee = playnet
.rpc
.get_fee_for_message(
serde_json::to_string(&Message::new(ixs, Some(&sender_pk)))
.unwrap()
.as_bytes(),
)
.unwrap();
let sender_balance = playnet
.rpc
.get_account_info(&sender_pk.to_string())
.lamports;
let receiver_balance = playnet
.rpc
.get_account_info(&receiver_pk.to_string())
.lamports;
assert_eq!(sender_balance, self::AIRDROP_AMOUNT - (send_amount + fee));
assert_eq!(receiver_balance, send_amount);
}
/// Tests whether "hello world" program works as expected
#[test]
#[wasm_bindgen_test]
fn hello_world() {
let playnet = Playnet::new(None);
let owner_kp = get_payer(&playnet);
let owner_pk = owner_kp.pubkey();
let program_id = deploy_program(
test_programs::hello_world::PROGRAM_BYTES,
&owner_kp,
&playnet,
)
.unwrap();
let tx_hash = send_tx(
&[Instruction::new_with_bytes(program_id, &[], vec![])],
&owner_pk,
[&owner_kp],
&playnet,
);
let tx = playnet.rpc.get_transaction(&tx_hash);
let logs = tx.meta().log_messages;
assert!(logs
.unwrap()
.iter()
.any(|log| log == "Program log: Hello, World!"));
}
/// Tests whether CPI works as expected
#[test]
#[wasm_bindgen_test]
fn transfer_cpi() {
let playnet = Playnet::new(None);
let owner_kp = get_payer(&playnet);
let owner_pk = owner_kp.pubkey();
let receiver_kp = Keypair::new();
let receiver_pk = receiver_kp.pubkey();
let program_id = deploy_program(
test_programs::transfer_cpi::PROGRAM_BYTES,
&owner_kp,
&playnet,
)
.unwrap();
let tx_hash = send_tx(
&[Instruction::new_with_bytes(
program_id,
&[],
vec![
AccountMeta {
pubkey: owner_pk,
is_signer: true,
is_writable: true,
},
AccountMeta {
pubkey: receiver_pk,
is_signer: false,
is_writable: true,
},
AccountMeta {
pubkey: system_program::id(),
is_signer: false,
is_writable: false,
},
],
)],
&owner_pk,
[&owner_kp],
&playnet,
);
let tx = playnet.rpc.get_transaction(&tx_hash);
// Confirm tx was successful
assert!(tx.meta().err.is_none());
// Confirm the balance of the receiver
let receiver_balance = playnet
.rpc
.get_account_info(&receiver_pk.to_string())
.lamports;
// Program transfers 1 SOL to receiver
assert_eq!(receiver_balance, 1 * LAMPORTS_PER_SOL);
}
const AIRDROP_AMOUNT: u64 = 2 * LAMPORTS_PER_SOL;
/// Returns a new keypair with `self::AIRDROP_AMOUNT` lamports
fn get_payer(playnet: &Playnet) -> Keypair {
let payer_kp = Keypair::new();
// Request airdrop
playnet
.rpc
.request_airdrop(&payer_kp.pubkey().to_string(), self::AIRDROP_AMOUNT);
payer_kp
}
/// Returns the tx signature
fn send_tx(
ixs: &[Instruction],
payer: &Pubkey,
signers: impl Signers,
playnet: &Playnet,
) -> String {
let latest_blockhash =
Hash::from_str(&playnet.rpc.get_latest_blockhash().blockhash()).unwrap();
let result = playnet.rpc.send_transaction(
serde_json::to_string(&Transaction::new_signed_with_payer(
ixs,
Some(&payer),
&signers,
latest_blockhash,
))
.unwrap()
.as_bytes(),
);
result.tx_hash()
}
/// Deploys the program and returns the program id
fn deploy_program(
program_bytes: &[u8],
owner_kp: &Keypair,
playnet: &Playnet,
) -> Result<Pubkey, Box<dyn std::error::Error>> {
let program_len = program_bytes.len();
// Create buffer
let buffer_kp = Keypair::new();
let buffer_pk = buffer_kp.pubkey();
let buffer_len = UpgradeableLoaderState::size_of_buffer(program_len);
let buffer_lamports = playnet
.rpc
.get_minimum_balance_for_rent_exemption(buffer_len);
let owner_pk = owner_kp.pubkey();
send_tx(
&bpf_loader_upgradeable::create_buffer(
&owner_pk,
&buffer_pk,
&owner_pk,
buffer_lamports,
program_len,
)?,
&owner_pk,
[owner_kp, &buffer_kp],
playnet,
);
// Write to buffer
let chunk_size = PACKET_DATA_SIZE - 220; // Data with 1 signature
for (i, bytes) in program_bytes.chunks(chunk_size).enumerate() {
send_tx(
&[bpf_loader_upgradeable::write(
&buffer_pk,
&owner_pk,
(i * chunk_size) as u32,
bytes.to_vec(),
)],
&owner_pk,
[owner_kp],
playnet,
);
}
// Deploy
let program_kp = Keypair::new();
let program_pk = program_kp.pubkey();
send_tx(
&bpf_loader_upgradeable::deploy_with_max_program_len(
&owner_pk,
&program_pk,
&buffer_pk,
&owner_pk,
buffer_lamports,
program_len,
)?,
&owner_pk,
[owner_kp, &program_kp],
playnet,
);
Ok(program_pk)
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/lib.rs
|
// Project structure:
// ./playnet -> Starting point. Lifecycle starts when a Playnet instance gets created.
// ./runtime -> Where all internal logic for Playnet runtime lives.
// ./rpc -> Methods for clients to interact with the Playnet.
mod playnet;
mod rpc;
mod runtime;
mod serde;
mod types;
mod utils;
#[cfg(test)]
pub mod test_programs;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/utils.rs
|
use solana_sdk::{
hash::{Hash, Hasher},
transaction::{self, MessageHash, SanitizedTransaction, Transaction, VersionedTransaction},
};
use crate::runtime::bank::PgAddressLoader;
/// Tries to convert a serialized transaction into `SanitizedTransaction`
pub fn get_sanitized_tx_from_serialized_tx(
serialized_tx: &[u8],
) -> transaction::Result<SanitizedTransaction> {
let tx: Transaction = serde_json::from_slice(serialized_tx).unwrap();
let tx = VersionedTransaction::from(tx);
get_sanitized_tx_from_versioned_tx(tx)
}
/// Tries to convert a versioned transaction into `SanitizedTransaction`
pub fn get_sanitized_tx_from_versioned_tx(
versioned_tx: VersionedTransaction,
) -> transaction::Result<SanitizedTransaction> {
SanitizedTransaction::try_create(
versioned_tx,
MessageHash::Compute,
Some(false), // is_simple_vote_tx
PgAddressLoader::default(),
true, // require_static_program_ids
)
}
/// Create a blockhash from the given bytes
pub fn create_blockhash(bytes: &[u8]) -> Hash {
let mut hasher = Hasher::default();
hasher.hash(bytes);
hasher.result()
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/rpc.rs
|
// Since there is no networking access from WASM, all JSON-RPC methods need to be
// implemented from scratch to interact with the Playnet runtime.
use std::{
rc::Rc,
str::FromStr,
sync::{RwLock, RwLockReadGuard, RwLockWriteGuard},
};
use solana_sdk::{
feature_set::FeatureSet,
message::{Message, SanitizedMessage},
pubkey::Pubkey,
signature::Signature,
slot_history::Slot,
transaction::{self, SanitizedTransaction},
};
use wasm_bindgen::prelude::*;
use crate::{
runtime::bank::PgBank,
types::{
GetLatestBlockhashResult, GetSignatureStatusesResult, GetTransactionResult,
SendTransactionResult, SimulateTransactionResult, TransactionStatus, WasmAccount,
WasmCommitmentLevel,
},
utils::get_sanitized_tx_from_serialized_tx,
};
#[wasm_bindgen]
#[derive(Clone)]
pub struct PgRpc {
bank: Rc<RwLock<PgBank>>,
}
impl PgRpc {
pub fn new(bank: Rc<RwLock<PgBank>>) -> Self {
Self { bank }
}
fn get_bank(&self) -> RwLockReadGuard<'_, PgBank> {
self.bank.read().unwrap()
}
fn get_bank_mut(&self) -> RwLockWriteGuard<'_, PgBank> {
self.bank.write().unwrap()
}
}
#[wasm_bindgen]
impl PgRpc {
#[wasm_bindgen(js_name = getAccountInfo)]
pub fn get_account_info(&self, pubkey_str: &str) -> WasmAccount {
WasmAccount::from(
self.get_bank()
.get_account_default(&Pubkey::from_str(pubkey_str).unwrap()),
)
}
#[wasm_bindgen(js_name = getSlot)]
pub fn get_slot(&self) -> Slot {
self.get_bank().get_slot()
}
#[wasm_bindgen(js_name = getBlockHeight)]
pub fn get_block_height(&self) -> u64 {
self.get_bank().get_block_height()
}
#[wasm_bindgen(js_name = getGenesisHash)]
pub fn get_genesis_hash(&self) -> String {
self.get_bank().get_genesis_hash().to_string()
}
#[wasm_bindgen(js_name = getLatestBlockhash)]
pub fn get_latest_blockhash(&self) -> GetLatestBlockhashResult {
let bank = self.get_bank();
GetLatestBlockhashResult::new(bank.get_latest_blockhash(), bank.get_block_height())
}
#[wasm_bindgen(js_name = getMinimumBalanceForRentExemption)]
pub fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> u64 {
self.get_bank()
.get_minimum_balance_for_rent_exemption(data_len)
}
#[wasm_bindgen(js_name = getFeeForMessage)]
pub fn get_fee_for_message(&self, serialized_msg: &[u8]) -> Option<u64> {
let msg: Message = serde_json::from_slice(serialized_msg).unwrap();
self.get_bank()
.get_fee_for_message(&SanitizedMessage::try_from(msg).unwrap())
}
#[wasm_bindgen(js_name = simulateTransaction)]
pub fn simulate_transaction(&self, serialized_tx: &[u8]) -> SimulateTransactionResult {
let sanitized_transaction = match get_sanitized_tx_from_serialized_tx(serialized_tx) {
Ok(tx) => tx,
Err(err) => return SimulateTransactionResult::new_error(err),
};
let bank = self.get_bank();
bank.simulate_tx(&sanitized_transaction)
}
#[wasm_bindgen(js_name = sendTransaction)]
pub fn send_transaction(&self, serialized_tx: &[u8]) -> SendTransactionResult {
let sanitized_tx = match get_sanitized_tx_from_serialized_tx(serialized_tx) {
Ok(sanitized_tx) => sanitized_tx,
Err(err) => return SendTransactionResult::new_error(err),
};
fn verify_transaction(
transaction: &SanitizedTransaction,
feature_set: &FeatureSet,
) -> transaction::Result<()> {
transaction.verify()?;
transaction.verify_precompiles(feature_set)?;
Ok(())
}
let mut bank = self.get_bank_mut();
if let Err(err) = verify_transaction(&sanitized_tx, &bank.feature_set()) {
return SendTransactionResult::new_error(err);
}
match bank.process_tx(sanitized_tx) {
Ok(tx_hash) => SendTransactionResult::new(tx_hash.to_string()),
Err(err) => SendTransactionResult::new_error(err),
}
}
#[wasm_bindgen(js_name = getSignatureStatuses)]
pub fn get_signature_statuses(&self, signatures: Vec<JsValue>) -> GetSignatureStatusesResult {
let bank = self.get_bank();
let statuses = signatures
.iter()
.map(|js_signature| {
let signature = Signature::from_str(&js_signature.as_string().unwrap()).unwrap();
bank.get_tx(&signature).and_then(|tx_data| {
let current_slot = bank.get_slot();
let confirmations = current_slot - tx_data.get_slot();
let confirmation_status = if confirmations == 0 {
WasmCommitmentLevel::Processed
} else if confirmations < 32 {
WasmCommitmentLevel::Confirmed
} else {
WasmCommitmentLevel::Finalized
};
let err = tx_data
.get_meta()
.as_ref()
.map(|meta| meta.err.clone())
.unwrap_or(None);
Some(TransactionStatus::new(
Some(confirmation_status),
Some(confirmations as usize),
tx_data.get_slot(),
err,
))
})
})
.collect();
GetSignatureStatusesResult::new(statuses)
}
#[wasm_bindgen(js_name = getTransaction)]
pub fn get_transaction(&self, signature_str: &str) -> GetTransactionResult {
let signature = Signature::from_str(signature_str).unwrap();
GetTransactionResult::new(
self.get_bank()
.get_tx(&signature)
.map(|data| data.to_owned()),
)
}
#[wasm_bindgen(js_name = requestAirdrop)]
pub fn request_airdrop(&self, pubkey_str: &str, lamports: u64) -> SendTransactionResult {
let pubkey = Pubkey::from_str(pubkey_str).unwrap();
match self.get_bank_mut().airdrop(&pubkey, lamports) {
Ok(tx_hash) => SendTransactionResult::new(tx_hash.to_string()),
Err(e) => SendTransactionResult::new_error(e),
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/test_programs/transfer_cpi.rs
|
pub const PROGRAM_BYTES: &[u8] = &[
127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 247, 0, 1, 0, 0, 0, 176, 11, 0, 0,
0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 16, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 56, 0, 4, 0,
64, 0, 9, 0, 8, 0, 1, 0, 0, 0, 5, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0,
32, 1, 0, 0, 0, 0, 0, 0, 168, 213, 0, 0, 0, 0, 0, 0, 168, 213, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 200, 214, 0, 0, 0, 0, 0, 0, 200, 214, 0, 0, 0, 0, 0, 0,
200, 214, 0, 0, 0, 0, 0, 0, 176, 20, 0, 0, 0, 0, 0, 0, 176, 20, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 40, 236, 0, 0, 0, 0, 0, 0, 40, 236, 0, 0, 0, 0, 0, 0, 40,
236, 0, 0, 0, 0, 0, 0, 160, 21, 0, 0, 0, 0, 0, 0, 160, 21, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 120, 235, 0, 0, 0, 0, 0, 0, 120, 235, 0, 0, 0, 0, 0, 0, 120, 235,
0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
191, 22, 0, 0, 0, 0, 0, 0, 121, 97, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0,
255, 255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85, 2, 7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0,
0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0, 0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2,
0, 0, 32, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 243, 1, 0, 0, 121, 97, 16, 0, 0, 0,
0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85,
2, 7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0,
0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2, 0, 0, 40, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133,
16, 0, 0, 231, 1, 0, 0, 121, 97, 56, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255,
255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85, 2, 7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0,
7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0, 0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2, 0,
0, 32, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 219, 1, 0, 0, 121, 97, 64, 0, 0, 0, 0,
0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85, 2,
7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0, 0,
0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2, 0, 0, 40, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16,
0, 0, 207, 1, 0, 0, 121, 97, 104, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255,
255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85, 2, 7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0,
7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0, 0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2, 0,
0, 32, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 195, 1, 0, 0, 121, 97, 112, 0, 0, 0,
0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85,
2, 7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0,
0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2, 0, 0, 40, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133,
16, 0, 0, 183, 1, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 72, 0, 0, 0, 0, 0, 0, 191, 55, 0, 0, 0,
0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 24, 1, 0, 0, 208, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
2, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 21, 8, 58, 0, 0, 0, 0, 0, 21, 8, 57, 0,
1, 0, 0, 0, 21, 8, 56, 0, 2, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0, 0, 0, 183,
2, 0, 0, 0, 202, 154, 59, 123, 42, 216, 254, 0, 0, 0, 0, 183, 2, 0, 0, 3, 0, 0, 0, 123, 42, 72,
255, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 112, 255, 255, 255, 123, 42, 64, 255,
0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 123, 42, 48, 255, 0, 0, 0, 0, 183, 2, 0, 0, 4, 0, 0, 0,
123, 42, 40, 255, 0, 0, 0, 0, 24, 2, 0, 0, 168, 229, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 42, 32,
255, 0, 0, 0, 0, 24, 2, 0, 0, 32, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 42, 152, 255, 0, 0,
0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 216, 254, 255, 255, 123, 42, 144, 255, 0, 0, 0,
0, 123, 26, 128, 255, 0, 0, 0, 0, 24, 1, 0, 0, 248, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26,
136, 255, 0, 0, 0, 0, 123, 26, 120, 255, 0, 0, 0, 0, 123, 122, 112, 255, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 0, 255, 255, 255, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 32,
255, 255, 255, 133, 16, 0, 0, 231, 10, 0, 0, 121, 168, 8, 255, 0, 0, 0, 0, 121, 169, 0, 255, 0,
0, 0, 0, 121, 162, 16, 255, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 255, 255,
255, 255, 21, 8, 5, 0, 0, 0, 0, 0, 21, 9, 4, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191,
130, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 128, 1, 0, 0, 121, 115, 48, 0,
0, 0, 0, 0, 121, 114, 0, 0, 0, 0, 0, 0, 121, 164, 216, 254, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0,
0, 0, 7, 1, 0, 0, 32, 255, 255, 255, 133, 16, 0, 0, 240, 9, 0, 0, 121, 116, 8, 0, 0, 0, 0, 0,
121, 67, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 37, 3, 5, 0, 1, 0, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 183, 1, 0, 0, 10, 0, 0, 0, 123, 22, 0, 0, 0,
0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 113, 114, 41, 0, 0, 0, 0, 0, 113, 113, 40, 0, 0, 0, 0, 0,
121, 117, 0, 0, 0, 0, 0, 0, 123, 52, 0, 0, 0, 0, 0, 0, 121, 112, 16, 0, 0, 0, 0, 0, 121, 3, 0,
0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 37, 3, 1, 0, 1, 0, 0, 0, 5, 0, 242, 255, 0, 0, 0, 0,
123, 48, 0, 0, 0, 0, 0, 0, 183, 8, 0, 0, 1, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 85, 2, 1, 0, 0,
0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 85, 1, 1, 0, 0, 0, 0, 0, 183, 2,
0, 0, 0, 0, 0, 0, 123, 58, 200, 254, 0, 0, 0, 0, 113, 113, 42, 0, 0, 0, 0, 0, 85, 1, 1, 0, 0,
0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 123, 42, 184, 254, 0, 0, 0, 0, 123, 138, 192, 254, 0, 0, 0,
0, 121, 120, 56, 0, 0, 0, 0, 0, 121, 131, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 37, 3, 1,
0, 1, 0, 0, 0, 5, 0, 223, 255, 0, 0, 0, 0, 113, 114, 89, 0, 0, 0, 0, 0, 113, 113, 88, 0, 0, 0,
0, 0, 121, 121, 48, 0, 0, 0, 0, 0, 123, 154, 160, 254, 0, 0, 0, 0, 121, 121, 32, 0, 0, 0, 0, 0,
123, 154, 168, 254, 0, 0, 0, 0, 121, 121, 24, 0, 0, 0, 0, 0, 123, 154, 176, 254, 0, 0, 0, 0,
123, 56, 0, 0, 0, 0, 0, 0, 121, 121, 64, 0, 0, 0, 0, 0, 121, 147, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0,
1, 0, 0, 0, 37, 3, 1, 0, 1, 0, 0, 0, 5, 0, 209, 255, 0, 0, 0, 0, 123, 57, 0, 0, 0, 0, 0, 0,
183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 208, 254, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 85, 2, 1, 0,
0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 85, 1, 1, 0, 0, 0, 0, 0, 183,
2, 0, 0, 0, 0, 0, 0, 123, 58, 136, 254, 0, 0, 0, 0, 123, 10, 144, 254, 0, 0, 0, 0, 113, 113,
90, 0, 0, 0, 0, 0, 85, 1, 2, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 208, 254, 0, 0,
0, 0, 123, 42, 128, 254, 0, 0, 0, 0, 123, 90, 152, 254, 0, 0, 0, 0, 121, 112, 104, 0, 0, 0, 0,
0, 121, 3, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 37, 3, 1, 0, 1, 0, 0, 0, 5, 0, 187, 255,
0, 0, 0, 0, 123, 74, 120, 254, 0, 0, 0, 0, 113, 114, 137, 0, 0, 0, 0, 0, 113, 113, 136, 0, 0,
0, 0, 0, 121, 116, 96, 0, 0, 0, 0, 0, 123, 74, 96, 254, 0, 0, 0, 0, 121, 116, 80, 0, 0, 0, 0,
0, 123, 74, 104, 254, 0, 0, 0, 0, 121, 116, 72, 0, 0, 0, 0, 0, 123, 74, 112, 254, 0, 0, 0, 0,
123, 48, 0, 0, 0, 0, 0, 0, 121, 117, 112, 0, 0, 0, 0, 0, 121, 83, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0,
1, 0, 0, 0, 37, 3, 1, 0, 1, 0, 0, 0, 5, 0, 172, 255, 0, 0, 0, 0, 123, 53, 0, 0, 0, 0, 0, 0,
191, 36, 0, 0, 0, 0, 0, 0, 191, 19, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0,
1, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 85, 4,
1, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 113, 116, 138, 0, 0, 0, 0, 0, 85, 4, 1, 0, 0, 0, 0,
0, 183, 2, 0, 0, 0, 0, 0, 0, 121, 116, 120, 0, 0, 0, 0, 0, 121, 119, 128, 0, 0, 0, 0, 0, 115,
58, 249, 255, 0, 0, 0, 0, 115, 26, 248, 255, 0, 0, 0, 0, 123, 122, 240, 255, 0, 0, 0, 0, 123,
74, 232, 255, 0, 0, 0, 0, 123, 90, 224, 255, 0, 0, 0, 0, 123, 10, 216, 255, 0, 0, 0, 0, 121,
161, 96, 254, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 121, 161, 208, 254, 0, 0, 0, 0, 115,
26, 202, 255, 0, 0, 0, 0, 121, 161, 136, 254, 0, 0, 0, 0, 115, 26, 201, 255, 0, 0, 0, 0, 121,
161, 128, 254, 0, 0, 0, 0, 115, 26, 200, 255, 0, 0, 0, 0, 121, 161, 104, 254, 0, 0, 0, 0, 123,
26, 192, 255, 0, 0, 0, 0, 121, 161, 112, 254, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 123,
154, 176, 255, 0, 0, 0, 0, 123, 138, 168, 255, 0, 0, 0, 0, 121, 161, 160, 254, 0, 0, 0, 0, 123,
26, 160, 255, 0, 0, 0, 0, 121, 161, 192, 254, 0, 0, 0, 0, 115, 26, 154, 255, 0, 0, 0, 0, 121,
161, 200, 254, 0, 0, 0, 0, 115, 26, 153, 255, 0, 0, 0, 0, 121, 161, 184, 254, 0, 0, 0, 0, 115,
26, 152, 255, 0, 0, 0, 0, 121, 161, 168, 254, 0, 0, 0, 0, 123, 26, 144, 255, 0, 0, 0, 0, 121,
161, 176, 254, 0, 0, 0, 0, 123, 26, 136, 255, 0, 0, 0, 0, 121, 161, 144, 254, 0, 0, 0, 0, 123,
26, 128, 255, 0, 0, 0, 0, 121, 161, 120, 254, 0, 0, 0, 0, 123, 26, 120, 255, 0, 0, 0, 0, 121,
161, 152, 254, 0, 0, 0, 0, 123, 26, 112, 255, 0, 0, 0, 0, 115, 42, 250, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 0, 255, 255, 255, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0,
32, 255, 255, 255, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 112, 255, 255, 255, 183, 4, 0, 0, 3,
0, 0, 0, 133, 16, 0, 0, 11, 8, 0, 0, 97, 161, 0, 255, 0, 0, 0, 0, 21, 1, 1, 0, 20, 0, 0, 0, 5,
0, 20, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 112, 255, 255, 255, 133, 16, 0,
0, 222, 254, 255, 255, 121, 162, 40, 255, 0, 0, 0, 0, 21, 2, 6, 0, 0, 0, 0, 0, 121, 161, 32,
255, 0, 0, 0, 0, 21, 1, 4, 0, 0, 0, 0, 0, 39, 2, 0, 0, 34, 0, 0, 0, 21, 2, 2, 0, 0, 0, 0, 0,
183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 214, 0, 0, 0, 121, 162, 64, 255, 0, 0, 0, 0, 21, 2, 4,
0, 0, 0, 0, 0, 121, 161, 56, 255, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0,
0, 133, 16, 0, 0, 208, 0, 0, 0, 183, 1, 0, 0, 20, 0, 0, 0, 99, 22, 0, 0, 0, 0, 0, 0, 5, 0, 91,
255, 0, 0, 0, 0, 97, 162, 28, 255, 0, 0, 0, 0, 99, 42, 248, 254, 0, 0, 0, 0, 121, 163, 20, 255,
0, 0, 0, 0, 123, 58, 240, 254, 0, 0, 0, 0, 121, 164, 12, 255, 0, 0, 0, 0, 123, 74, 232, 254, 0,
0, 0, 0, 121, 165, 4, 255, 0, 0, 0, 0, 123, 90, 224, 254, 0, 0, 0, 0, 99, 38, 28, 0, 0, 0, 0,
0, 123, 54, 20, 0, 0, 0, 0, 0, 123, 70, 12, 0, 0, 0, 0, 0, 123, 86, 4, 0, 0, 0, 0, 0, 99, 22,
0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 112, 255, 255, 255, 133, 16, 0, 0,
189, 254, 255, 255, 121, 162, 40, 255, 0, 0, 0, 0, 21, 2, 6, 0, 0, 0, 0, 0, 121, 161, 32, 255,
0, 0, 0, 0, 21, 1, 4, 0, 0, 0, 0, 0, 39, 2, 0, 0, 34, 0, 0, 0, 21, 2, 2, 0, 0, 0, 0, 0, 183, 3,
0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 181, 0, 0, 0, 121, 162, 64, 255, 0, 0, 0, 0, 21, 2, 65, 255,
0, 0, 0, 0, 121, 161, 56, 255, 0, 0, 0, 0, 21, 1, 63, 255, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0,
0, 133, 16, 0, 0, 175, 0, 0, 0, 5, 0, 60, 255, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 133, 16, 0, 0, 125, 3, 0, 0, 121, 166, 192,
255, 0, 0, 0, 0, 121, 168, 200, 255, 0, 0, 0, 0, 121, 169, 184, 255, 0, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 191, 165, 0, 0, 0, 0, 0, 0, 191, 147, 0, 0, 0,
0, 0, 0, 191, 132, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 235, 254, 255, 255, 183, 0, 0, 0, 0, 0, 0,
0, 97, 161, 224, 255, 0, 0, 0, 0, 21, 1, 11, 0, 20, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0,
123, 26, 200, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0,
121, 161, 232, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0,
123, 26, 176, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 133,
16, 0, 0, 71, 8, 0, 0, 123, 10, 168, 255, 0, 0, 0, 0, 21, 8, 19, 0, 0, 0, 0, 0, 39, 8, 0, 0,
48, 0, 0, 0, 191, 151, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 16, 0, 0, 0, 5, 0, 23, 0, 0, 0, 0, 0, 121,
113, 0, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 0,
0, 0, 0, 0, 0, 85, 2, 7, 0, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255,
255, 123, 33, 8, 0, 0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0, 0, 183, 2, 0, 0, 40, 0, 0, 0, 183, 3, 0,
0, 8, 0, 0, 0, 133, 16, 0, 0, 129, 0, 0, 0, 7, 7, 0, 0, 48, 0, 0, 0, 7, 8, 0, 0, 208, 255, 255,
255, 85, 8, 8, 0, 0, 0, 0, 0, 21, 6, 20, 0, 0, 0, 0, 0, 39, 6, 0, 0, 48, 0, 0, 0, 21, 6, 18, 0,
0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0,
133, 16, 0, 0, 119, 0, 0, 0, 5, 0, 13, 0, 0, 0, 0, 0, 121, 113, 248, 255, 0, 0, 0, 0, 121, 18,
0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85, 2, 228, 255,
0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0, 0, 0, 0,
0, 85, 2, 224, 255, 0, 0, 0, 0, 183, 2, 0, 0, 32, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16,
0, 0, 106, 0, 0, 0, 5, 0, 220, 255, 0, 0, 0, 0, 121, 160, 168, 255, 0, 0, 0, 0, 149, 0, 0, 0,
0, 0, 0, 0, 24, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 121, 51, 0, 0, 0, 0, 0, 0, 24, 4,
0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 21, 3, 1, 0, 0, 0, 0, 0, 191, 52, 0, 0, 0, 0, 0, 0,
191, 67, 0, 0, 0, 0, 0, 0, 31, 19, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 1,
0, 0, 0, 45, 67, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 85, 5,
1, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 135, 2, 0, 0, 0, 0, 0, 0, 95, 33, 0, 0, 0, 0, 0,
0, 24, 2, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 45, 18, 4, 0, 0, 0, 0, 0, 24, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 123, 18, 0, 0, 0, 0, 0, 0, 191, 16, 0, 0, 0, 0, 0, 0, 149, 0,
0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 21, 0, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 3, 0,
0, 0, 21, 1, 1, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 31, 65, 0,
0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 45, 97, 1, 0, 0, 0, 0, 0,
183, 7, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 85, 7, 1, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0,
0, 0, 0, 135, 3, 0, 0, 0, 0, 0, 0, 95, 54, 0, 0, 0, 0, 0, 0, 24, 1, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 3, 0, 0, 0, 45, 97, 10, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 123,
97, 0, 0, 0, 0, 0, 0, 45, 66, 1, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0,
0, 0, 191, 82, 0, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 75, 24, 0, 0, 191,
96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0,
0, 0, 0, 0, 7, 1, 0, 0, 240, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0,
0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0,
123, 26, 200, 255, 0, 0, 0, 0, 24, 1, 0, 0, 232, 229, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26,
192, 255, 0, 0, 0, 0, 24, 1, 0, 0, 224, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255, 0, 0,
0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 168, 255, 255, 255, 191, 162, 0, 0, 0, 0, 0, 0,
7, 2, 0, 0, 192, 255, 255, 255, 133, 16, 0, 0, 112, 9, 0, 0, 121, 166, 176, 255, 0, 0, 0, 0,
121, 167, 168, 255, 0, 0, 0, 0, 121, 162, 184, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 21, 6, 5, 0, 0, 0, 0, 0, 21, 7, 4, 0, 0, 0, 0, 0, 191, 113,
0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 9, 0, 0,
0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 104, 11, 0, 0, 149, 0,
0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 218, 3, 0, 0, 149, 0, 0, 0, 0, 0,
0, 0, 133, 16, 0, 0, 154, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 178, 255,
255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 177, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 83, 9, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 18, 8,
0, 0, 0, 0, 0, 21, 2, 4, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0,
183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 243, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 113, 18,
0, 0, 0, 0, 0, 0, 101, 2, 8, 0, 9, 0, 0, 0, 21, 2, 20, 0, 3, 0, 0, 0, 21, 2, 1, 0, 9, 0, 0, 0,
5, 0, 7, 0, 0, 0, 0, 0, 121, 18, 80, 0, 0, 0, 0, 0, 21, 2, 5, 0, 0, 0, 0, 0, 121, 17, 72, 0, 0,
0, 0, 0, 21, 1, 3, 0, 0, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 21, 2, 2, 0, 10, 0, 0, 0, 21, 2, 6,
0, 11, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 18, 80, 0, 0, 0, 0, 0, 21, 2, 253, 255, 0, 0, 0,
0, 121, 17, 72, 0, 0, 0, 0, 0, 21, 1, 251, 255, 0, 0, 0, 0, 5, 0, 9, 0, 0, 0, 0, 0, 121, 18,
56, 0, 0, 0, 0, 0, 21, 2, 248, 255, 0, 0, 0, 0, 121, 17, 48, 0, 0, 0, 0, 0, 21, 1, 246, 255, 0,
0, 0, 0, 5, 0, 4, 0, 0, 0, 0, 0, 121, 18, 80, 0, 0, 0, 0, 0, 21, 2, 243, 255, 0, 0, 0, 0, 121,
17, 72, 0, 0, 0, 0, 0, 21, 1, 241, 255, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0,
213, 255, 255, 255, 5, 0, 238, 255, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0,
0, 0, 15, 52, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 45, 66, 1, 0, 0, 0, 0, 0, 183, 1, 0,
0, 0, 0, 0, 0, 87, 1, 0, 0, 1, 0, 0, 0, 85, 1, 27, 0, 0, 0, 0, 0, 121, 97, 8, 0, 0, 0, 0, 0,
191, 23, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0, 45, 71, 1, 0, 0, 0, 0, 0, 191, 71, 0, 0,
0, 0, 0, 0, 37, 7, 1, 0, 8, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21, 1, 6, 0, 0, 0, 0, 0, 121,
98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 248, 255, 0, 0, 0, 0, 123, 26, 240,
255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0,
0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 208, 255, 255, 255,
191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 114, 0, 0, 0, 0, 0, 0, 183, 3,
0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 71, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0, 85, 1, 4, 0, 1,
0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 133, 16, 0, 0, 253, 8, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216, 255, 0, 0, 0, 0, 123, 118, 8, 0, 0, 0, 0, 0,
123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161, 216, 255, 0, 0, 0, 0, 133, 16,
0, 0, 253, 8, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 22, 0, 0, 0, 0, 0, 0, 191, 33, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 1, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 45, 18, 1, 0, 0, 0, 0, 0, 183,
3, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 1, 0, 0, 0, 85, 3, 41, 0, 0, 0, 0, 0, 121, 105, 8, 0, 0, 0,
0, 0, 191, 151, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0, 45, 23, 1, 0, 0, 0, 0, 0, 191, 23,
0, 0, 0, 0, 0, 0, 37, 7, 1, 0, 4, 0, 0, 0, 183, 7, 0, 0, 4, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 192, 255, 255, 255, 183, 8, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 48, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 33,
24, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 121, 162, 200, 255, 0, 0, 0, 0, 85, 2, 1, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 85, 1, 1, 0, 0, 0, 0, 0, 183, 8, 0, 0, 8, 0, 0, 0, 121, 162, 192,
255, 0, 0, 0, 0, 21, 9, 6, 0, 0, 0, 0, 0, 121, 97, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0,
123, 58, 248, 255, 0, 0, 0, 0, 39, 9, 0, 0, 48, 0, 0, 0, 123, 154, 240, 255, 0, 0, 0, 0, 5, 0,
1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 208, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255,
255, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 13, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0,
85, 1, 4, 0, 1, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 133, 16, 0,
0, 195, 8, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216, 255, 0, 0, 0, 0, 123, 118,
8, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161, 216, 255, 0,
0, 0, 0, 133, 16, 0, 0, 195, 8, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 56, 0, 0, 0, 0,
0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 85, 8, 4, 0, 0, 0, 0, 0, 123, 118,
8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0,
121, 65, 0, 0, 0, 0, 0, 0, 21, 1, 13, 0, 0, 0, 0, 0, 121, 66, 8, 0, 0, 0, 0, 0, 85, 2, 6, 0, 0,
0, 0, 0, 21, 7, 20, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 92, 255, 255, 255, 21, 0, 12, 0, 0, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 191, 131, 0, 0,
0, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 91, 255, 255, 255, 21, 0, 7, 0, 0, 0, 0,
0, 5, 0, 12, 0, 0, 0, 0, 0, 21, 7, 9, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 130, 0,
0, 0, 0, 0, 0, 133, 16, 0, 0, 81, 255, 255, 255, 21, 0, 1, 0, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0,
0, 123, 118, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 191, 135, 0, 0, 0, 0, 0, 0, 5, 0, 4,
0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 191, 128, 0, 0, 0, 0, 0, 0, 123, 6, 8, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 123, 118, 16, 0, 0, 0, 0, 0, 149, 0, 0, 0,
0, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 123, 104, 16, 0, 0, 0, 0, 0,
123, 104, 8, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 123, 120, 0, 0, 0, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 136, 255, 255, 255, 183, 3, 0, 0, 40, 0, 0, 0, 133, 16, 0, 0, 90,
23, 0, 0, 121, 129, 16, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0, 121, 129, 8, 0, 0, 0, 0,
0, 123, 26, 184, 255, 0, 0, 0, 0, 121, 129, 0, 0, 0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0,
123, 120, 0, 0, 0, 0, 0, 0, 123, 104, 8, 0, 0, 0, 0, 0, 123, 138, 120, 255, 0, 0, 0, 0, 123,
104, 16, 0, 0, 0, 0, 0, 121, 169, 192, 255, 0, 0, 0, 0, 183, 8, 0, 0, 56, 0, 0, 0, 45, 152, 2,
0, 0, 0, 0, 0, 121, 167, 176, 255, 0, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0, 0, 183, 3, 0, 0, 56, 0, 0,
0, 31, 147, 0, 0, 0, 0, 0, 0, 121, 161, 184, 255, 0, 0, 0, 0, 31, 145, 0, 0, 0, 0, 0, 0, 191,
152, 0, 0, 0, 0, 0, 0, 61, 49, 5, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176,
255, 255, 255, 191, 146, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 79, 255, 255, 255, 121, 168, 192,
255, 0, 0, 0, 0, 121, 167, 176, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 129, 0, 0, 0,
0, 0, 0, 37, 9, 8, 0, 54, 0, 0, 0, 183, 6, 0, 0, 55, 0, 0, 0, 31, 150, 0, 0, 0, 0, 0, 0, 183,
2, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 90, 23, 0, 0, 15, 104, 0, 0, 0,
0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115,
33, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 123, 138, 192, 255, 0, 0, 0, 0, 183, 3, 0, 0, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 123, 26, 128, 255, 0, 0,
0, 0, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 144, 255, 255, 255, 121, 161, 136, 255, 0, 0, 0,
0, 123, 26, 112, 255, 0, 0, 0, 0, 183, 5, 0, 0, 58, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 7, 4, 0,
0, 1, 0, 0, 0, 121, 161, 128, 255, 0, 0, 0, 0, 93, 20, 4, 0, 0, 0, 0, 0, 113, 161, 144, 255, 0,
0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 21, 1, 36, 0, 0, 0, 0, 0, 5, 0, 46, 0, 0, 0, 0, 0, 61, 56,
1, 0, 0, 0, 0, 0, 5, 0, 204, 1, 0, 0, 0, 0, 113, 70, 0, 0, 0, 0, 0, 0, 21, 3, 15, 0, 0, 0, 0,
0, 191, 49, 0, 0, 0, 0, 0, 0, 191, 121, 0, 0, 0, 0, 0, 0, 113, 146, 0, 0, 0, 0, 0, 0, 103, 2,
0, 0, 8, 0, 0, 0, 15, 98, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 55, 6, 0, 0, 58, 0, 0,
0, 191, 96, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 58, 0, 0, 0, 31, 2, 0, 0, 0, 0, 0, 0, 115, 41, 0, 0,
0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 7, 1, 0, 0, 255, 255, 255, 255, 21, 1, 1, 0, 0, 0, 0, 0, 5,
0, 243, 255, 0, 0, 0, 0, 21, 6, 229, 255, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 29, 56, 161,
1, 0, 0, 0, 0, 61, 131, 96, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 55, 6, 0, 0, 58, 0, 0, 0,
191, 98, 0, 0, 0, 0, 0, 0, 39, 2, 0, 0, 58, 0, 0, 0, 191, 16, 0, 0, 0, 0, 0, 0, 31, 32, 0, 0,
0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 15, 50, 0, 0, 0, 0, 0, 0, 115, 2, 0, 0, 0, 0, 0, 0, 7,
3, 0, 0, 1, 0, 0, 0, 45, 21, 215, 255, 0, 0, 0, 0, 5, 0, 241, 255, 0, 0, 0, 0, 29, 131, 147, 1,
0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 61, 131, 162, 1, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0,
15, 49, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0,
0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 113, 161, 145, 255, 0, 0, 0, 0, 21, 1, 79, 0, 0, 0, 0, 0,
61, 152, 6, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0,
112, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 248, 16, 0, 0, 133, 16, 0, 0, 255, 255,
255, 255, 21, 9, 32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 58, 0, 0, 0, 121,
160, 112, 255, 0, 0, 0, 0, 191, 117, 0, 0, 0, 0, 0, 0, 15, 53, 0, 0, 0, 0, 0, 0, 113, 81, 0, 0,
0, 0, 0, 0, 45, 20, 1, 0, 0, 0, 0, 0, 5, 0, 116, 1, 0, 0, 0, 0, 191, 2, 0, 0, 0, 0, 0, 0, 15,
18, 0, 0, 0, 0, 0, 0, 113, 33, 0, 0, 0, 0, 0, 0, 115, 21, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0,
0, 0, 29, 57, 1, 0, 0, 0, 0, 0, 5, 0, 244, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 45, 145,
15, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 119, 1, 0, 0, 1, 0, 0, 0, 191, 146, 0, 0, 0, 0,
0, 0, 15, 114, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 191, 115, 0, 0, 0, 0, 0, 0,
113, 52, 0, 0, 0, 0, 0, 0, 113, 37, 0, 0, 0, 0, 0, 0, 115, 83, 0, 0, 0, 0, 0, 0, 115, 66, 0, 0,
0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 7, 3, 0, 0, 1, 0, 0, 0, 7, 1, 0, 0, 255, 255, 255,
255, 21, 1, 1, 0, 0, 0, 0, 0, 5, 0, 247, 255, 0, 0, 0, 0, 121, 166, 184, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 216, 255, 255, 255, 191, 114, 0, 0, 0, 0, 0, 0, 191, 147, 0,
0, 0, 0, 0, 0, 133, 16, 0, 0, 8, 17, 0, 0, 121, 161, 216, 255, 0, 0, 0, 0, 85, 1, 20, 0, 1, 0,
0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0,
0, 0, 123, 42, 200, 255, 0, 0, 0, 0, 123, 154, 232, 255, 0, 0, 0, 0, 123, 106, 224, 255, 0, 0,
0, 0, 123, 122, 216, 255, 0, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0,
0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 216, 255, 255, 255, 24, 1, 0, 0, 216, 215, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 43, 0, 0, 0, 24, 4, 0, 0, 200, 230, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 24, 5, 0, 0, 248, 229, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 150, 10, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 120, 255, 0, 0, 0, 0, 123, 145, 16, 0, 0, 0, 0, 0,
123, 97, 8, 0, 0, 0, 0, 0, 123, 113, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 49, 0, 0,
0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 64, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 99, 10, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 29, 137, 57, 1, 0, 0, 0, 0, 61,
137, 73, 1, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0,
0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 2, 0, 0, 0, 113,
161, 146, 255, 0, 0, 0, 0, 85, 1, 167, 255, 0, 0, 0, 0, 29, 137, 47, 1, 0, 0, 0, 0, 61, 137,
63, 1, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0,
0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 3, 0, 0, 0, 113, 161,
147, 255, 0, 0, 0, 0, 85, 1, 157, 255, 0, 0, 0, 0, 29, 137, 37, 1, 0, 0, 0, 0, 61, 137, 53, 1,
0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0,
115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 4, 0, 0, 0, 113, 161, 148,
255, 0, 0, 0, 0, 85, 1, 147, 255, 0, 0, 0, 0, 29, 137, 27, 1, 0, 0, 0, 0, 61, 137, 43, 1, 0, 0,
0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33,
0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 5, 0, 0, 0, 113, 161, 149, 255, 0, 0,
0, 0, 85, 1, 137, 255, 0, 0, 0, 0, 29, 137, 17, 1, 0, 0, 0, 0, 61, 137, 33, 1, 0, 0, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0,
0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 6, 0, 0, 0, 113, 161, 150, 255, 0, 0, 0, 0, 85,
1, 127, 255, 0, 0, 0, 0, 29, 137, 7, 1, 0, 0, 0, 0, 61, 137, 23, 1, 0, 0, 0, 0, 191, 113, 0, 0,
0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0,
191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 7, 0, 0, 0, 113, 161, 151, 255, 0, 0, 0, 0, 85, 1, 117,
255, 0, 0, 0, 0, 29, 137, 253, 0, 0, 0, 0, 0, 61, 137, 13, 1, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0,
0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57,
0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 8, 0, 0, 0, 113, 161, 152, 255, 0, 0, 0, 0, 85, 1, 107, 255, 0,
0, 0, 0, 29, 137, 243, 0, 0, 0, 0, 0, 61, 137, 3, 1, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0,
15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0,
0, 0, 0, 0, 7, 9, 0, 0, 9, 0, 0, 0, 113, 161, 153, 255, 0, 0, 0, 0, 85, 1, 97, 255, 0, 0, 0, 0,
29, 137, 233, 0, 0, 0, 0, 0, 61, 137, 249, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145,
0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0,
0, 7, 9, 0, 0, 10, 0, 0, 0, 113, 161, 154, 255, 0, 0, 0, 0, 85, 1, 87, 255, 0, 0, 0, 0, 29,
137, 223, 0, 0, 0, 0, 0, 61, 137, 239, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0,
0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0,
7, 9, 0, 0, 11, 0, 0, 0, 113, 161, 155, 255, 0, 0, 0, 0, 85, 1, 77, 255, 0, 0, 0, 0, 29, 137,
213, 0, 0, 0, 0, 0, 61, 137, 229, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0,
0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9,
0, 0, 12, 0, 0, 0, 113, 161, 156, 255, 0, 0, 0, 0, 85, 1, 67, 255, 0, 0, 0, 0, 29, 137, 203, 0,
0, 0, 0, 0, 61, 137, 219, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0,
183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 13,
0, 0, 0, 113, 161, 157, 255, 0, 0, 0, 0, 85, 1, 57, 255, 0, 0, 0, 0, 29, 137, 193, 0, 0, 0, 0,
0, 61, 137, 209, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2,
0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 14, 0, 0,
0, 113, 161, 158, 255, 0, 0, 0, 0, 85, 1, 47, 255, 0, 0, 0, 0, 29, 137, 183, 0, 0, 0, 0, 0, 61,
137, 199, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0,
0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 15, 0, 0, 0, 113,
161, 159, 255, 0, 0, 0, 0, 85, 1, 37, 255, 0, 0, 0, 0, 29, 137, 173, 0, 0, 0, 0, 0, 61, 137,
189, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0,
0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 16, 0, 0, 0, 113, 161,
160, 255, 0, 0, 0, 0, 85, 1, 27, 255, 0, 0, 0, 0, 29, 137, 163, 0, 0, 0, 0, 0, 61, 137, 179, 0,
0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0,
115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 17, 0, 0, 0, 113, 161, 161,
255, 0, 0, 0, 0, 85, 1, 17, 255, 0, 0, 0, 0, 29, 137, 153, 0, 0, 0, 0, 0, 61, 137, 169, 0, 0,
0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115,
33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 18, 0, 0, 0, 113, 161, 162, 255,
0, 0, 0, 0, 85, 1, 7, 255, 0, 0, 0, 0, 29, 137, 143, 0, 0, 0, 0, 0, 61, 137, 159, 0, 0, 0, 0,
0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0,
0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 19, 0, 0, 0, 113, 161, 163, 255, 0, 0, 0,
0, 85, 1, 253, 254, 0, 0, 0, 0, 29, 137, 133, 0, 0, 0, 0, 0, 61, 137, 149, 0, 0, 0, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0,
0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 20, 0, 0, 0, 113, 161, 164, 255, 0, 0, 0, 0,
85, 1, 243, 254, 0, 0, 0, 0, 29, 137, 123, 0, 0, 0, 0, 0, 61, 137, 139, 0, 0, 0, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0,
0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 21, 0, 0, 0, 113, 161, 165, 255, 0, 0, 0, 0,
85, 1, 233, 254, 0, 0, 0, 0, 29, 137, 113, 0, 0, 0, 0, 0, 61, 137, 129, 0, 0, 0, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0,
0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 22, 0, 0, 0, 113, 161, 166, 255, 0, 0, 0, 0,
85, 1, 223, 254, 0, 0, 0, 0, 29, 137, 103, 0, 0, 0, 0, 0, 61, 137, 119, 0, 0, 0, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0,
0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 23, 0, 0, 0, 113, 161, 167, 255, 0, 0, 0, 0,
85, 1, 213, 254, 0, 0, 0, 0, 29, 137, 93, 0, 0, 0, 0, 0, 61, 137, 109, 0, 0, 0, 0, 0, 191, 113,
0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0,
0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 24, 0, 0, 0, 113, 161, 168, 255, 0, 0, 0, 0, 85, 1,
203, 254, 0, 0, 0, 0, 29, 137, 83, 0, 0, 0, 0, 0, 61, 137, 99, 0, 0, 0, 0, 0, 191, 113, 0, 0,
0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0,
191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 25, 0, 0, 0, 113, 161, 169, 255, 0, 0, 0, 0, 85, 1, 193,
254, 0, 0, 0, 0, 29, 137, 73, 0, 0, 0, 0, 0, 61, 137, 89, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0,
0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57,
0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 26, 0, 0, 0, 113, 161, 170, 255, 0, 0, 0, 0, 85, 1, 183, 254, 0,
0, 0, 0, 29, 137, 63, 0, 0, 0, 0, 0, 61, 137, 79, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0,
15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0,
0, 0, 0, 0, 7, 9, 0, 0, 27, 0, 0, 0, 113, 161, 171, 255, 0, 0, 0, 0, 85, 1, 173, 254, 0, 0, 0,
0, 29, 137, 53, 0, 0, 0, 0, 0, 61, 137, 69, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145,
0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0,
0, 7, 9, 0, 0, 28, 0, 0, 0, 113, 161, 172, 255, 0, 0, 0, 0, 85, 1, 163, 254, 0, 0, 0, 0, 29,
137, 43, 0, 0, 0, 0, 0, 61, 137, 59, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0,
0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7,
9, 0, 0, 29, 0, 0, 0, 113, 161, 173, 255, 0, 0, 0, 0, 85, 1, 153, 254, 0, 0, 0, 0, 29, 137, 33,
0, 0, 0, 0, 0, 61, 137, 49, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0,
0, 183, 2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0,
30, 0, 0, 0, 113, 161, 174, 255, 0, 0, 0, 0, 85, 1, 143, 254, 0, 0, 0, 0, 29, 137, 23, 0, 0, 0,
0, 0, 61, 137, 39, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183,
2, 0, 0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 31, 0,
0, 0, 113, 161, 175, 255, 0, 0, 0, 0, 85, 1, 133, 254, 0, 0, 0, 0, 29, 137, 13, 0, 0, 0, 0, 0,
61, 137, 29, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 183, 2, 0,
0, 0, 0, 0, 0, 115, 33, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 32, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0,
5, 0, 124, 254, 0, 0, 0, 0, 183, 2, 0, 0, 58, 0, 0, 0, 24, 3, 0, 0, 136, 230, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 133, 16, 0, 0, 41, 9, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 162, 184, 255,
0, 0, 0, 0, 21, 2, 4, 0, 0, 0, 0, 0, 21, 7, 3, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 68, 253, 255, 255, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0,
216, 255, 255, 255, 24, 1, 0, 0, 216, 215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 43, 0,
0, 0, 24, 4, 0, 0, 232, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 5, 0, 0, 16, 230, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 133, 16, 0, 0, 64, 9, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 145, 0, 0,
0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 88, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 18, 9, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 49, 0, 0, 0, 0, 0, 0, 191,
130, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 40, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 89,
15, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 22, 0, 0, 0, 0, 0, 0, 123, 42, 192, 255, 0,
0, 0, 0, 121, 34, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 208, 255, 255, 255,
183, 7, 0, 0, 0, 0, 0, 0, 123, 42, 152, 255, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 183, 4, 0,
0, 48, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 178, 21, 0, 0, 183, 1, 0, 0, 1, 0, 0,
0, 121, 162, 216, 255, 0, 0, 0, 0, 85, 2, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 85, 1, 1,
0, 0, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0, 133, 16, 0, 0, 103, 6, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 121, 168, 208, 255, 0, 0, 0, 0, 123, 106, 128, 255, 0, 0, 0,
0, 21, 8, 10, 0, 0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16,
0, 0, 17, 253, 255, 255, 121, 163, 192, 255, 0, 0, 0, 0, 21, 0, 1, 0, 0, 0, 0, 0, 5, 0, 6, 0,
0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 97, 6, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 191, 112, 0, 0, 0, 0, 0, 0, 121, 163, 192, 255, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 10, 224, 255, 0, 0, 0, 0, 183, 9,
0, 0, 8, 0, 0, 0, 121, 161, 152, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 21, 1, 33, 0,
0, 0, 0, 0, 183, 9, 0, 0, 8, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 183,
4, 0, 0, 0, 0, 0, 0, 5, 0, 47, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 48, 0, 0,
0, 191, 3, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0, 115, 83, 42, 0, 0, 0, 0, 0, 115, 99, 41,
0, 0, 0, 0, 0, 115, 67, 40, 0, 0, 0, 0, 0, 121, 161, 160, 255, 0, 0, 0, 0, 123, 19, 32, 0, 0,
0, 0, 0, 123, 115, 24, 0, 0, 0, 0, 0, 123, 131, 16, 0, 0, 0, 0, 0, 121, 161, 168, 255, 0, 0, 0,
0, 123, 19, 8, 0, 0, 0, 0, 0, 121, 161, 176, 255, 0, 0, 0, 0, 123, 19, 0, 0, 0, 0, 0, 0, 97,
161, 251, 255, 0, 0, 0, 0, 99, 19, 43, 0, 0, 0, 0, 0, 113, 161, 255, 255, 0, 0, 0, 0, 115, 19,
47, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 121, 163, 192, 255,
0, 0, 0, 0, 121, 164, 200, 255, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0, 8, 0, 0, 0,
191, 7, 0, 0, 0, 0, 0, 0, 121, 161, 152, 255, 0, 0, 0, 0, 45, 65, 19, 0, 0, 0, 0, 0, 191, 49,
0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 121, 162, 240, 255, 0,
0, 0, 0, 121, 164, 128, 255, 0, 0, 0, 0, 123, 36, 24, 0, 0, 0, 0, 0, 121, 162, 232, 255, 0, 0,
0, 0, 123, 36, 16, 0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 123, 36, 8, 0, 0, 0, 0, 0, 7,
9, 0, 0, 8, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 15, 146, 0, 0, 0, 0, 0, 0, 123, 36, 32, 0, 0,
0, 0, 0, 123, 20, 40, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0, 123,
52, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0,
0, 0, 113, 17, 0, 0, 0, 0, 0, 0, 123, 74, 200, 255, 0, 0, 0, 0, 21, 1, 59, 0, 255, 0, 0, 0, 45,
18, 4, 0, 0, 0, 0, 0, 24, 3, 0, 0, 176, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 164,
8, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 123, 154, 184, 255, 0, 0, 0, 0, 39, 1, 0, 0, 48, 0,
0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 121, 70, 8, 0, 0, 0, 0, 0, 121,
104, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 37, 8, 2, 0, 1, 0, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 113, 69, 41, 0, 0, 0, 0, 0, 113, 67, 40, 0,
0, 0, 0, 0, 121, 73, 0, 0, 0, 0, 0, 0, 123, 154, 176, 255, 0, 0, 0, 0, 123, 134, 0, 0, 0, 0, 0,
0, 121, 72, 16, 0, 0, 0, 0, 0, 121, 132, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 37, 4, 1, 0,
1, 0, 0, 0, 5, 0, 244, 255, 0, 0, 0, 0, 123, 106, 168, 255, 0, 0, 0, 0, 123, 72, 0, 0, 0, 0, 0,
0, 191, 84, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 1, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 85, 4, 1, 0,
0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 1, 0, 0, 0, 121, 169, 184, 255, 0, 0, 0, 0,
85, 3, 1, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 15, 23, 0, 0, 0, 0, 0, 0, 113, 113, 42, 0,
0, 0, 0, 0, 85, 1, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0, 0,
123, 26, 160, 255, 0, 0, 0, 0, 121, 119, 24, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 93,
18, 159, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 122,
136, 255, 0, 0, 0, 0, 191, 87, 0, 0, 0, 0, 0, 0, 123, 106, 144, 255, 0, 0, 0, 0, 191, 70, 0, 0,
0, 0, 0, 0, 133, 16, 0, 0, 238, 252, 255, 255, 191, 100, 0, 0, 0, 0, 0, 0, 121, 166, 144, 255,
0, 0, 0, 0, 191, 117, 0, 0, 0, 0, 0, 0, 121, 167, 136, 255, 0, 0, 0, 0, 121, 160, 224, 255, 0,
0, 0, 0, 121, 162, 240, 255, 0, 0, 0, 0, 5, 0, 145, 255, 0, 0, 0, 0, 123, 42, 184, 255, 0, 0,
0, 0, 191, 150, 0, 0, 0, 0, 0, 0, 15, 54, 0, 0, 0, 0, 0, 0, 113, 97, 3, 0, 0, 0, 0, 0, 123, 26,
160, 255, 0, 0, 0, 0, 113, 97, 2, 0, 0, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 113, 97, 1, 0,
0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 183, 1, 0, 0, 32, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0,
133, 16, 0, 0, 129, 252, 255, 255, 85, 0, 2, 0, 0, 0, 0, 0, 183, 1, 0, 0, 32, 0, 0, 0, 5, 0,
84, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 16, 16, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0,
0, 123, 16, 8, 0, 0, 0, 0, 0, 123, 16, 0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
72, 0, 0, 0, 123, 10, 144, 255, 0, 0, 0, 0, 123, 16, 24, 0, 0, 0, 0, 0, 121, 103, 80, 0, 0, 0,
0, 0, 99, 118, 4, 0, 0, 0, 0, 0, 183, 1, 0, 0, 40, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0, 133, 16,
0, 0, 112, 252, 255, 255, 191, 8, 0, 0, 0, 0, 0, 0, 85, 8, 2, 0, 0, 0, 0, 0, 183, 1, 0, 0, 40,
0, 0, 0, 5, 0, 66, 0, 0, 0, 0, 0, 121, 161, 160, 255, 0, 0, 0, 0, 191, 19, 0, 0, 0, 0, 0, 0,
183, 4, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 183, 5, 0, 0, 1, 0, 0, 0, 121, 162, 184,
255, 0, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 121, 163, 168, 255, 0, 0,
0, 0, 123, 72, 16, 0, 0, 0, 0, 0, 183, 4, 0, 0, 1, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 183, 4, 0,
0, 0, 0, 0, 0, 121, 163, 176, 255, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0,
0, 183, 0, 0, 0, 0, 0, 0, 0, 123, 10, 168, 255, 0, 0, 0, 0, 123, 74, 176, 255, 0, 0, 0, 0, 191,
99, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 40, 0, 0, 0, 123, 58, 160, 255, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0,
0, 0, 123, 24, 8, 0, 0, 0, 0, 0, 123, 24, 0, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 121,
163, 192, 255, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 88, 0, 0, 0, 123, 24, 24, 0,
0, 0, 0, 0, 123, 120, 32, 0, 0, 0, 0, 0, 15, 121, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 95, 40, 0, 0,
87, 9, 0, 0, 248, 255, 255, 255, 191, 49, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 121, 23,
0, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 93, 18, 7, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 90, 184, 255, 0, 0, 0, 0, 133, 16, 0, 0, 155,
252, 255, 255, 121, 165, 184, 255, 0, 0, 0, 0, 121, 163, 192, 255, 0, 0, 0, 0, 121, 162, 240,
255, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 48, 0, 0, 0, 121, 160, 224, 255, 0, 0,
0, 0, 191, 4, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 115, 84, 42, 0, 0, 0, 0, 0, 121, 161,
176, 255, 0, 0, 0, 0, 115, 20, 41, 0, 0, 0, 0, 0, 121, 161, 168, 255, 0, 0, 0, 0, 115, 20, 40,
0, 0, 0, 0, 0, 123, 116, 32, 0, 0, 0, 0, 0, 121, 161, 160, 255, 0, 0, 0, 0, 123, 20, 24, 0, 0,
0, 0, 0, 123, 132, 16, 0, 0, 0, 0, 0, 121, 161, 144, 255, 0, 0, 0, 0, 123, 20, 8, 0, 0, 0, 0,
0, 123, 100, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 5, 0, 68,
255, 0, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 126, 5, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 191, 38, 0, 0, 0, 0, 0, 0, 121, 18, 24, 0, 0, 0, 0, 0, 123, 42, 248, 255, 0, 0,
0, 0, 121, 18, 16, 0, 0, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0,
123, 42, 232, 255, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 24, 1,
0, 0, 250, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 191, 167, 0, 0, 0,
0, 0, 0, 7, 7, 0, 0, 192, 255, 255, 255, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 216, 255, 255,
255, 191, 113, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 209, 252, 255, 255, 24, 1, 0, 0, 136, 86, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 123, 122, 176, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 123, 26, 160, 255, 0, 0, 0, 0, 183, 1,
0, 0, 0, 0, 0, 0, 123, 26, 144, 255, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 123, 26, 168, 255,
0, 0, 0, 0, 123, 26, 136, 255, 0, 0, 0, 0, 24, 1, 0, 0, 160, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123, 26, 128, 255, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 128, 255, 255, 255, 191,
97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 78, 13, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 121, 162, 200,
255, 0, 0, 0, 0, 21, 2, 4, 0, 0, 0, 0, 0, 121, 161, 192, 255, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0,
0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 253, 251, 255, 255, 191, 96, 0, 0, 0, 0, 0, 0, 149,
0, 0, 0, 0, 0, 0, 0, 191, 71, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0,
0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 174, 4, 0, 0, 113, 146, 0, 0, 0, 0, 0, 0, 123,
106, 224, 255, 0, 0, 0, 0, 101, 2, 6, 0, 5, 0, 0, 0, 101, 2, 13, 0, 2, 0, 0, 0, 183, 6, 0, 0,
52, 0, 0, 0, 21, 2, 33, 0, 0, 0, 0, 0, 21, 2, 13, 0, 1, 0, 0, 0, 183, 6, 0, 0, 12, 0, 0, 0, 5,
0, 30, 0, 0, 0, 0, 0, 101, 2, 3, 0, 8, 0, 0, 0, 21, 2, 9, 0, 6, 0, 0, 0, 21, 2, 8, 0, 7, 0, 0,
0, 5, 0, 250, 255, 0, 0, 0, 0, 101, 2, 8, 0, 10, 0, 0, 0, 21, 2, 10, 0, 9, 0, 0, 0, 183, 1, 0,
0, 76, 0, 0, 0, 5, 0, 11, 0, 0, 0, 0, 0, 21, 2, 9, 0, 3, 0, 0, 0, 21, 2, 4, 0, 4, 0, 0, 0, 5,
0, 243, 255, 0, 0, 0, 0, 183, 6, 0, 0, 36, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 21, 2, 8, 0, 11,
0, 0, 0, 183, 6, 0, 0, 4, 0, 0, 0, 5, 0, 14, 0, 0, 0, 0, 0, 183, 1, 0, 0, 84, 0, 0, 0, 5, 0, 1,
0, 0, 0, 0, 0, 183, 1, 0, 0, 92, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 88, 0, 0, 0,
5, 0, 3, 0, 0, 0, 0, 0, 183, 1, 0, 0, 52, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 64,
0, 0, 0, 121, 54, 0, 0, 0, 0, 0, 0, 15, 22, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 1,
0, 0, 0, 0, 0, 0, 21, 6, 6, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0,
133, 16, 0, 0, 202, 251, 255, 255, 21, 0, 238, 2, 0, 0, 0, 0, 113, 146, 0, 0, 0, 0, 0, 0, 191,
97, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 123, 58, 248, 255, 0, 0, 0, 0, 123, 26, 240,
255, 0, 0, 0, 0, 123, 10, 232, 255, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 240,
255, 255, 255, 123, 122, 216, 255, 0, 0, 0, 0, 123, 138, 208, 255, 0, 0, 0, 0, 123, 58, 200,
255, 0, 0, 0, 0, 101, 2, 17, 0, 5, 0, 0, 0, 101, 2, 88, 0, 2, 0, 0, 0, 21, 2, 120, 0, 0, 0, 0,
0, 21, 2, 178, 0, 1, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37, 1, 1, 0, 3, 0, 0, 0, 5, 0, 156, 2,
0, 0, 0, 0, 15, 32, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 7, 2,
0, 0, 4, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 33, 0, 0,
0, 0, 0, 0, 121, 150, 8, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 45, 19, 93, 0, 0, 0, 0, 0, 5,
0, 21, 0, 0, 0, 0, 0, 101, 2, 25, 0, 8, 0, 0, 0, 21, 2, 197, 0, 6, 0, 0, 0, 21, 2, 231, 0, 7,
0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1,
0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0,
208, 251, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 15, 32, 0,
0, 0, 0, 0, 0, 183, 1, 0, 0, 8, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 4, 0, 0, 0, 123,
42, 248, 255, 0, 0, 0, 0, 121, 163, 240, 255, 0, 0, 0, 0, 31, 35, 0, 0, 0, 0, 0, 0, 121, 150,
8, 0, 0, 0, 0, 0, 45, 49, 71, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 33, 0, 0, 0,
0, 0, 0, 123, 97, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 8, 0, 0, 0, 5, 0, 141, 1, 0, 0, 0, 0, 101, 2,
71, 0, 10, 0, 0, 0, 123, 154, 192, 255, 0, 0, 0, 0, 21, 2, 240, 0, 9, 0, 0, 0, 183, 8, 0, 0, 0,
0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 37, 1, 1, 0, 3, 0, 0, 0, 5, 0, 120, 2, 0, 0, 0, 0, 15, 96,
0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 10, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0,
7, 6, 0, 0, 4, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 121, 161, 232,
255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0,
123, 106, 248, 255, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 85, 8, 13, 0, 32, 0, 0, 0, 121, 161,
240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 121, 169, 192, 255, 0, 0, 0, 0, 121, 152, 88,
0, 0, 0, 0, 0, 121, 151, 72, 0, 0, 0, 0, 0, 37, 1, 11, 1, 7, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133,
16, 0, 0, 160, 251, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 4, 1, 0, 0, 0, 0, 191, 145,
0, 0, 0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 113, 23, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0,
0, 0, 0, 93, 97, 231, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255,
255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 148, 251, 255, 255,
121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 224, 255, 0, 0, 0, 0, 21, 2, 29, 1, 3, 0, 0, 0, 21, 2,
80, 1, 4, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 121, 150, 8, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0,
0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 136, 251, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121,
162, 248, 255, 0, 0, 0, 0, 15, 32, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 5, 0, 0, 0, 99, 16, 0, 0, 0,
0, 0, 0, 7, 2, 0, 0, 4, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0,
31, 33, 0, 0, 0, 0, 0, 0, 37, 1, 185, 255, 7, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
232, 255, 255, 255, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 122, 251, 255, 255, 121, 162, 248,
255, 0, 0, 0, 0, 5, 0, 179, 255, 0, 0, 0, 0, 21, 2, 94, 1, 11, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0,
0, 37, 1, 1, 0, 3, 0, 0, 0, 5, 0, 59, 2, 0, 0, 0, 0, 15, 32, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0,
12, 0, 0, 0, 5, 0, 60, 1, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37,
1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0,
0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 105, 251, 255, 255, 121, 160, 232, 255, 0,
0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 15, 32, 0, 0, 0, 0, 0, 0, 99, 96, 0, 0, 0, 0, 0, 0, 7,
2, 0, 0, 4, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 33, 0,
0, 0, 0, 0, 0, 121, 150, 40, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 45, 19, 45, 2, 0, 0, 0,
0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 123, 97, 0, 0, 0, 0, 0, 0, 7, 2,
0, 0, 8, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 33, 0, 0,
0, 0, 0, 0, 121, 150, 48, 0, 0, 0, 0, 0, 37, 1, 5, 0, 7, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0,
7, 1, 0, 0, 232, 255, 255, 255, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 81, 251, 255, 255,
121, 162, 248, 255, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 123,
97, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 7, 2, 0, 0, 8, 0, 0, 0,
123, 42, 248, 255, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 33,
0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42, 248, 255, 0, 0,
0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 21, 6, 15, 1, 32, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 15, 97, 0,
0, 0, 0, 0, 0, 113, 23, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93, 33, 244, 255, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 3, 0, 0, 1, 0, 0, 0,
133, 16, 0, 0, 56, 251, 255, 255, 121, 162, 248, 255, 0, 0, 0, 0, 5, 0, 238, 255, 0, 0, 0, 0,
183, 6, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0,
133, 16, 0, 0, 46, 251, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0,
0, 15, 32, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1,
0, 0, 0, 7, 2, 0, 0, 4, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121,
161, 232, 255, 0, 0, 0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1,
0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 21, 6, 236, 0, 32, 0, 0, 0,
191, 145, 0, 0, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 113, 23, 0, 0, 0, 0, 0, 0, 121, 161, 240,
255, 0, 0, 0, 0, 93, 33, 244, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232,
255, 255, 255, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 21, 251, 255, 255, 121, 162, 248, 255,
0, 0, 0, 0, 5, 0, 238, 255, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37,
1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0,
0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 11, 251, 255, 255, 121, 160, 232, 255, 0,
0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 15, 32, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 6, 0, 0, 0,
99, 16, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 7, 2, 0, 0, 4, 0, 0, 0, 123, 42, 248, 255, 0,
0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 115,
129, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 7, 6, 0, 0, 1, 0,
0, 0, 21, 6, 201, 0, 32, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 113,
24, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93, 33, 244, 255, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 242,
250, 255, 255, 121, 162, 248, 255, 0, 0, 0, 0, 5, 0, 238, 255, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0,
0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 232,
250, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 15, 32, 0, 0, 0,
0, 0, 0, 183, 1, 0, 0, 7, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 7, 2, 0,
0, 4, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0,
0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 115, 129, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42,
248, 255, 0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 21, 6, 166, 0, 32, 0, 0, 0, 191, 145, 0, 0, 0, 0,
0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 113, 24, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93,
33, 244, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 3,
0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 207, 250, 255, 255, 121, 162, 248, 255, 0, 0, 0, 0, 5, 0, 238,
255, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0, 0,
191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3,
0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 197, 250, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 166,
248, 255, 0, 0, 0, 0, 15, 96, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 9, 0, 0, 0, 99, 16, 0, 0, 0, 0,
0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 7, 6, 0, 0, 4, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 5, 0, 22,
0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0, 0,
0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 85, 8,
15, 0, 32, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 121, 162, 192,
255, 0, 0, 0, 0, 121, 39, 88, 0, 0, 0, 0, 0, 121, 34, 72, 0, 0, 0, 0, 0, 37, 1, 229, 0, 7, 0,
0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 40, 0, 0, 0, 0, 0, 0,
191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 169, 250, 255, 255, 191,
130, 0, 0, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 220, 0, 0, 0, 0, 0, 191, 145, 0,
0, 0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 113, 23, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0,
0, 0, 93, 97, 229, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255,
191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 156, 250, 255, 255, 121,
166, 248, 255, 0, 0, 0, 0, 5, 0, 222, 255, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97,
0, 0, 0, 0, 0, 0, 123, 129, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0,
0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 61, 129, 1, 0, 0, 0, 0, 0, 5,
0, 102, 1, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0,
0, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 126, 18, 0, 0, 15, 134, 0, 0, 0, 0,
0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 33, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 5, 0,
7, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0,
0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 21, 8,
78, 0, 32, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 113, 23, 0, 0, 0, 0,
0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93, 97, 244, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0,
7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16,
0, 0, 118, 250, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 237, 255, 0, 0, 0, 0, 183, 8,
0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16,
0, 0, 108, 250, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 15,
96, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 3, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 123, 154, 192, 255,
0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 7, 6, 0, 0, 4, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 5,
0, 22, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0,
0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 85,
8, 15, 0, 32, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 121, 162, 192,
255, 0, 0, 0, 0, 121, 39, 88, 0, 0, 0, 0, 0, 121, 34, 72, 0, 0, 0, 0, 0, 37, 1, 196, 0, 7, 0,
0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 40, 0, 0, 0, 0, 0, 0,
191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 79, 250, 255, 255, 191,
130, 0, 0, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 187, 0, 0, 0, 0, 0, 191, 145, 0,
0, 0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 113, 23, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0,
0, 0, 93, 97, 229, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255,
191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 66, 250, 255, 255, 121,
166, 248, 255, 0, 0, 0, 0, 5, 0, 222, 255, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0,
3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0,
0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 57, 250, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0,
121, 162, 248, 255, 0, 0, 0, 0, 15, 32, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 4, 0, 0, 0, 99, 16, 0,
0, 0, 0, 0, 0, 7, 2, 0, 0, 4, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 163, 200, 255, 0, 0,
0, 0, 121, 49, 8, 0, 0, 0, 0, 0, 121, 162, 232, 255, 0, 0, 0, 0, 121, 164, 208, 255, 0, 0, 0,
0, 123, 20, 40, 0, 0, 0, 0, 0, 121, 49, 0, 0, 0, 0, 0, 0, 123, 20, 32, 0, 0, 0, 0, 0, 121, 163,
224, 255, 0, 0, 0, 0, 121, 49, 24, 0, 0, 0, 0, 0, 123, 20, 72, 0, 0, 0, 0, 0, 121, 49, 16, 0,
0, 0, 0, 0, 123, 20, 64, 0, 0, 0, 0, 0, 121, 49, 8, 0, 0, 0, 0, 0, 123, 20, 56, 0, 0, 0, 0, 0,
121, 49, 0, 0, 0, 0, 0, 0, 123, 20, 48, 0, 0, 0, 0, 0, 121, 163, 216, 255, 0, 0, 0, 0, 121, 49,
0, 0, 0, 0, 0, 0, 123, 20, 0, 0, 0, 0, 0, 0, 121, 49, 8, 0, 0, 0, 0, 0, 123, 20, 8, 0, 0, 0, 0,
0, 121, 49, 16, 0, 0, 0, 0, 0, 123, 20, 16, 0, 0, 0, 0, 0, 123, 36, 24, 0, 0, 0, 0, 0, 149, 0,
0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 37, 1, 7, 0, 3, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16,
0, 0, 18, 250, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 15,
96, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 11, 0, 0, 0, 99, 16, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 4, 0, 0,
0, 123, 106, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0,
121, 152, 40, 0, 0, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0, 45, 18, 226, 0, 0, 0, 0, 0, 121, 161,
232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 123, 129, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0,
0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0,
121, 152, 64, 0, 0, 0, 0, 0, 121, 151, 48, 0, 0, 0, 0, 0, 37, 1, 6, 0, 7, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0,
0, 0, 133, 16, 0, 0, 247, 249, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 121, 161, 232, 255, 0,
0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 123, 129, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 123,
106, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 61, 129,
6, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0,
0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 233, 249, 255, 255, 121, 166, 248, 255, 0,
0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0,
191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 213, 17, 0, 0, 15, 134, 0, 0, 0, 0, 0, 0, 183, 8, 0,
0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 5, 0, 8, 0, 0, 0, 0, 0,
121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 115, 145, 0, 0, 0, 0, 0, 0, 7, 6, 0,
0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 191, 121, 0, 0, 0, 0, 0,
0, 21, 8, 164, 255, 32, 0, 0, 0, 191, 151, 0, 0, 0, 0, 0, 0, 15, 137, 0, 0, 0, 0, 0, 0, 113,
153, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93, 97, 243, 255, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1,
0, 0, 0, 133, 16, 0, 0, 204, 249, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 236, 255, 0,
0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 123, 113, 0, 0, 0, 0, 0, 0,
7, 6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 121, 169, 240, 255, 0, 0, 0, 0, 191,
145, 0, 0, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 61, 113, 1, 0, 0, 0, 0, 0, 5, 0, 163, 0, 0, 0,
0, 0, 121, 168, 232, 255, 0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0,
191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 173, 17, 0, 0, 15, 118, 0, 0, 0, 0, 0, 0, 123, 106,
248, 255, 0, 0, 0, 0, 31, 105, 0, 0, 0, 0, 0, 0, 121, 167, 192, 255, 0, 0, 0, 0, 121, 113, 96,
0, 0, 0, 0, 0, 37, 9, 9, 0, 7, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0,
7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16,
0, 0, 175, 249, 255, 255, 191, 129, 0, 0, 0, 0, 0, 0, 121, 168, 232, 255, 0, 0, 0, 0, 121, 166,
248, 255, 0, 0, 0, 0, 15, 104, 0, 0, 0, 0, 0, 0, 123, 24, 0, 0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0,
0, 0, 7, 7, 0, 0, 33, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 191,
121, 0, 0, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0,
0, 0, 0, 115, 113, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 7,
8, 0, 0, 1, 0, 0, 0, 21, 8, 107, 255, 32, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 15, 129, 0, 0,
0, 0, 0, 0, 113, 23, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93, 97, 244, 255, 0, 0,
0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0,
183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 147, 249, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 5,
0, 237, 255, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 123, 113, 0,
0, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 121, 169, 240, 255, 0,
0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 61, 113, 1, 0, 0, 0, 0, 0, 5, 0,
116, 0, 0, 0, 0, 0, 121, 168, 232, 255, 0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 15, 97, 0, 0,
0, 0, 0, 0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 116, 17, 0, 0, 15, 118, 0, 0, 0, 0, 0,
0, 123, 106, 248, 255, 0, 0, 0, 0, 31, 105, 0, 0, 0, 0, 0, 0, 121, 167, 192, 255, 0, 0, 0, 0,
121, 113, 96, 0, 0, 0, 0, 0, 37, 9, 9, 0, 7, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0,
0, 0, 133, 16, 0, 0, 118, 249, 255, 255, 191, 129, 0, 0, 0, 0, 0, 0, 121, 168, 232, 255, 0, 0,
0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 15, 104, 0, 0, 0, 0, 0, 0, 123, 24, 0, 0, 0, 0, 0, 0, 7,
6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 31, 97, 0,
0, 0, 0, 0, 0, 121, 120, 104, 0, 0, 0, 0, 0, 191, 121, 0, 0, 0, 0, 0, 0, 37, 1, 6, 0, 7, 0, 0,
0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 101, 249, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 121,
161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 123, 129, 0, 0, 0, 0, 0, 0, 183, 8, 0, 0,
0, 0, 0, 0, 7, 9, 0, 0, 33, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 5,
0, 7, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 15, 97, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0,
0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 21,
8, 35, 255, 32, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 113, 23, 0, 0,
0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 93, 97, 244, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0,
0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133,
16, 0, 0, 75, 249, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 237, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0,
4, 0, 0, 0, 133, 16, 0, 0, 68, 249, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 162, 248,
255, 0, 0, 0, 0, 5, 0, 92, 253, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255,
255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 60, 249, 255, 255,
121, 160, 232, 255, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 128, 253, 0, 0, 0, 0,
191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0, 0, 183, 3,
0, 0, 4, 0, 0, 0, 133, 16, 0, 0, 52, 249, 255, 255, 121, 160, 232, 255, 0, 0, 0, 0, 121, 162,
248, 255, 0, 0, 0, 0, 5, 0, 189, 253, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232,
255, 255, 255, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 45, 249, 255, 255, 121, 162, 248, 255,
0, 0, 0, 0, 5, 0, 205, 253, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255,
255, 191, 98, 0, 0, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 38, 249, 255, 255,
121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 147, 254, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1,
0, 0, 232, 255, 255, 255, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0,
31, 249, 255, 255, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 23, 255, 0, 0, 0, 0, 191, 161, 0, 0,
0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 40, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0,
0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 23, 249, 255, 255, 191, 130, 0, 0, 0, 0, 0, 0,
121, 169, 240, 255, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 83, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 40, 0, 0, 0, 0, 0, 0, 191, 98, 0,
0, 0, 0, 0, 0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 13, 249, 255, 255, 191, 130, 0, 0, 0,
0, 0, 0, 121, 169, 240, 255, 0, 0, 0, 0, 121, 166, 248, 255, 0, 0, 0, 0, 5, 0, 130, 255, 0, 0,
0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 46, 2, 0, 0, 133, 16,
0, 0, 255, 255, 255, 255, 24, 5, 0, 0, 216, 215, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 90, 0, 240,
0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 123, 90, 8, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 1, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 123, 74, 192, 255, 0, 0, 0, 0, 123, 58,
184, 255, 0, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 123, 42, 176, 255, 0, 0, 0, 0, 121, 33,
16, 0, 0, 0, 0, 0, 121, 82, 8, 240, 0, 0, 0, 0, 123, 42, 128, 255, 0, 0, 0, 0, 121, 82, 0, 240,
0, 0, 0, 0, 123, 42, 120, 255, 0, 0, 0, 0, 21, 1, 77, 0, 0, 0, 0, 0, 121, 162, 176, 255, 0, 0,
0, 0, 121, 39, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 34, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 15, 18,
0, 0, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 121, 161, 192, 255, 0, 0, 0, 0, 39, 1, 0, 0,
48, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 121, 161, 184, 255, 0, 0, 0, 0, 7, 1, 0, 0, 216,
255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 5, 0, 59, 0, 0, 0, 0, 0, 85, 8, 1, 0, 0, 0, 0, 0,
5, 0, 55, 0, 0, 0, 0, 0, 121, 146, 40, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0,
32, 0, 0, 0, 133, 16, 0, 0, 24, 17, 0, 0, 7, 8, 0, 0, 208, 255, 255, 255, 7, 9, 0, 0, 48, 0, 0,
0, 103, 0, 0, 0, 32, 0, 0, 0, 119, 0, 0, 0, 32, 0, 0, 0, 85, 0, 245, 255, 0, 0, 0, 0, 113, 97,
33, 0, 0, 0, 0, 0, 85, 1, 24, 0, 0, 0, 0, 0, 121, 145, 0, 0, 0, 0, 0, 0, 121, 18, 16, 0, 0, 0,
0, 0, 24, 3, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 127, 45, 35, 1, 0, 0, 0, 0,
0, 5, 0, 74, 0, 0, 0, 0, 0, 191, 19, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 16, 0, 0, 0, 123, 58, 160,
255, 0, 0, 0, 0, 123, 35, 0, 0, 0, 0, 0, 0, 121, 146, 8, 0, 0, 0, 0, 0, 121, 35, 16, 0, 0, 0,
0, 0, 24, 4, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 127, 45, 52, 1, 0, 0, 0, 0,
0, 5, 0, 71, 0, 0, 0, 0, 0, 191, 35, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 16, 0, 0, 0, 123, 58, 144,
255, 0, 0, 0, 0, 7, 2, 0, 0, 24, 0, 0, 0, 7, 1, 0, 0, 24, 0, 0, 0, 123, 26, 152, 255, 0, 0, 0,
0, 123, 42, 136, 255, 0, 0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 121, 145, 0, 0, 0, 0, 0, 0, 121, 18,
16, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 85, 2, 38, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0,
0, 7, 2, 0, 0, 16, 0, 0, 0, 123, 42, 224, 255, 0, 0, 0, 0, 123, 66, 0, 0, 0, 0, 0, 0, 121, 146,
8, 0, 0, 0, 0, 0, 121, 35, 16, 0, 0, 0, 0, 0, 21, 3, 1, 0, 0, 0, 0, 0, 5, 0, 37, 0, 0, 0, 0, 0,
191, 35, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 16, 0, 0, 0, 123, 58, 216, 255, 0, 0, 0, 0, 123, 66, 16,
0, 0, 0, 0, 0, 7, 2, 0, 0, 24, 0, 0, 0, 7, 1, 0, 0, 24, 0, 0, 0, 123, 42, 208, 255, 0, 0, 0, 0,
123, 26, 200, 255, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 29, 23, 5, 0, 0, 0, 0, 0, 191,
118, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 34, 0, 0, 0, 121, 168, 248, 255, 0, 0, 0, 0, 121, 169, 240,
255, 0, 0, 0, 0, 5, 0, 192, 255, 0, 0, 0, 0, 121, 161, 176, 255, 0, 0, 0, 0, 121, 162, 184,
255, 0, 0, 0, 0, 121, 163, 192, 255, 0, 0, 0, 0, 121, 164, 120, 255, 0, 0, 0, 0, 121, 165, 128,
255, 0, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 85, 0, 4, 0, 0, 0, 0, 0, 183, 1, 0, 0, 20,
0, 0, 0, 121, 162, 168, 255, 0, 0, 0, 0, 99, 18, 0, 0, 0, 0, 0, 0, 5, 0, 34, 0, 0, 0, 0, 0,
121, 161, 168, 255, 0, 0, 0, 0, 191, 2, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 123, 0, 0, 0, 5, 0,
30, 0, 0, 0, 0, 0, 121, 162, 168, 255, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 123, 18, 8,
0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 121, 163, 200, 255, 0,
0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 121, 162, 168, 255, 0, 0, 0, 0, 121, 161, 216, 255, 0, 0, 0,
0, 123, 18, 8, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 121,
163, 208, 255, 0, 0, 0, 0, 5, 0, 13, 0, 0, 0, 0, 0, 121, 162, 168, 255, 0, 0, 0, 0, 121, 161,
160, 255, 0, 0, 0, 0, 123, 18, 8, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255,
255, 255, 121, 163, 152, 255, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 121, 162, 168, 255, 0, 0, 0,
0, 121, 161, 144, 255, 0, 0, 0, 0, 123, 18, 8, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 255, 255, 255, 255, 121, 163, 136, 255, 0, 0, 0, 0, 95, 19, 0, 0, 0, 0, 0, 0, 71, 3, 0, 0,
11, 0, 0, 0, 123, 50, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 97, 18, 0, 0, 0, 0, 0, 0,
101, 2, 6, 0, 9, 0, 0, 0, 101, 2, 11, 0, 4, 0, 0, 0, 101, 2, 20, 0, 1, 0, 0, 0, 21, 2, 39, 0,
0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 5, 0, 74, 0, 0, 0, 0, 0, 101, 2,
10, 0, 14, 0, 0, 0, 101, 2, 19, 0, 11, 0, 0, 0, 21, 2, 39, 0, 10, 0, 0, 0, 24, 6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 5, 0, 68, 0, 0, 0, 0, 0, 101, 2, 19, 0, 6, 0, 0, 0, 21, 2, 37,
0, 5, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 5, 0, 63, 0, 0, 0, 0, 0, 101,
2, 19, 0, 16, 0, 0, 0, 21, 2, 35, 0, 15, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0,
0, 0, 5, 0, 58, 0, 0, 0, 0, 0, 21, 2, 34, 0, 2, 0, 0, 0, 21, 2, 36, 0, 3, 0, 0, 0, 24, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 0, 53, 0, 0, 0, 0, 0, 21, 2, 35, 0, 12, 0, 0, 0, 21, 2,
37, 0, 13, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 5, 0, 48, 0, 0, 0, 0, 0,
21, 2, 36, 0, 7, 0, 0, 0, 21, 2, 38, 0, 8, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0,
0, 0, 5, 0, 43, 0, 0, 0, 0, 0, 21, 2, 37, 0, 17, 0, 0, 0, 21, 2, 39, 0, 18, 0, 0, 0, 24, 6, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 5, 0, 38, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 97, 19, 4, 0, 0, 0, 0, 0, 21, 3, 34, 0, 0, 0, 0, 0, 191, 54, 0, 0, 0, 0, 0,
0, 5, 0, 32, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 5, 0, 29, 0, 0,
0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0, 0, 24, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 5, 0, 23, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0,
17, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 5, 0, 14, 0, 0, 0, 0, 0,
24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 5, 0, 11, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 5, 0, 8, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
0, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 5, 0, 2, 0,
0, 0, 0, 0, 24, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 85, 2, 6, 0, 14, 0, 0, 0, 121,
18, 16, 0, 0, 0, 0, 0, 21, 2, 4, 0, 0, 0, 0, 0, 121, 17, 8, 0, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0,
0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 243, 247, 255, 255, 191, 96, 0, 0, 0, 0, 0, 0,
149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,
255, 255, 255, 191, 33, 0, 0, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0, 0, 0, 191, 19, 0, 0, 0, 0, 0, 0,
119, 3, 0, 0, 32, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 79, 49, 0, 0, 0, 0, 0, 0, 101, 1, 6, 0,
9, 0, 0, 0, 101, 1, 12, 0, 4, 0, 0, 0, 101, 1, 23, 0, 1, 0, 0, 0, 21, 1, 53, 0, 0, 0, 0, 0,
183, 3, 0, 0, 1, 0, 0, 0, 21, 1, 86, 0, 1, 0, 0, 0, 5, 0, 47, 0, 0, 0, 0, 0, 101, 1, 12, 0, 14,
0, 0, 0, 101, 1, 23, 0, 11, 0, 0, 0, 21, 1, 50, 0, 10, 0, 0, 0, 21, 1, 1, 0, 11, 0, 0, 0, 5, 0,
42, 0, 0, 0, 0, 0, 183, 3, 0, 0, 11, 0, 0, 0, 5, 0, 78, 0, 0, 0, 0, 0, 101, 1, 30, 0, 6, 0, 0,
0, 21, 1, 46, 0, 5, 0, 0, 0, 21, 1, 1, 0, 6, 0, 0, 0, 5, 0, 36, 0, 0, 0, 0, 0, 183, 3, 0, 0, 6,
0, 0, 0, 5, 0, 72, 0, 0, 0, 0, 0, 101, 1, 30, 0, 16, 0, 0, 0, 21, 1, 42, 0, 15, 0, 0, 0, 21, 1,
1, 0, 16, 0, 0, 0, 5, 0, 30, 0, 0, 0, 0, 0, 183, 3, 0, 0, 16, 0, 0, 0, 5, 0, 66, 0, 0, 0, 0, 0,
21, 1, 39, 0, 2, 0, 0, 0, 21, 1, 40, 0, 3, 0, 0, 0, 21, 1, 1, 0, 4, 0, 0, 0, 5, 0, 24, 0, 0, 0,
0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 5, 0, 60, 0, 0, 0, 0, 0, 21, 1, 37, 0, 12, 0, 0, 0, 21, 1, 38,
0, 13, 0, 0, 0, 21, 1, 1, 0, 14, 0, 0, 0, 5, 0, 18, 0, 0, 0, 0, 0, 183, 7, 0, 0, 7, 0, 0, 0,
183, 1, 0, 0, 7, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 190, 247, 255, 255, 85, 0,
43, 0, 0, 0, 0, 0, 183, 1, 0, 0, 7, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 16, 1, 0,
0, 133, 16, 0, 0, 255, 255, 255, 255, 21, 1, 28, 0, 7, 0, 0, 0, 21, 1, 29, 0, 8, 0, 0, 0, 21,
1, 1, 0, 9, 0, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 183, 3, 0, 0, 9, 0, 0, 0, 5, 0, 41, 0, 0, 0, 0, 0,
21, 1, 26, 0, 17, 0, 0, 0, 21, 1, 27, 0, 18, 0, 0, 0, 21, 1, 28, 0, 19, 0, 0, 0, 99, 38, 4, 0,
0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 5, 0, 35, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 99,
54, 4, 0, 0, 0, 0, 0, 5, 0, 32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 10, 0, 0, 0, 5, 0, 30, 0, 0, 0, 0,
0, 183, 3, 0, 0, 5, 0, 0, 0, 5, 0, 28, 0, 0, 0, 0, 0, 183, 3, 0, 0, 15, 0, 0, 0, 5, 0, 26, 0,
0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 5, 0, 24, 0, 0, 0, 0, 0, 183, 3, 0, 0, 3, 0, 0, 0, 5, 0,
22, 0, 0, 0, 0, 0, 183, 3, 0, 0, 12, 0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 183, 3, 0, 0, 13, 0, 0,
0, 5, 0, 18, 0, 0, 0, 0, 0, 183, 3, 0, 0, 7, 0, 0, 0, 5, 0, 16, 0, 0, 0, 0, 0, 183, 3, 0, 0, 8,
0, 0, 0, 5, 0, 14, 0, 0, 0, 0, 0, 183, 3, 0, 0, 17, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 183, 3,
0, 0, 18, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 183, 3, 0, 0, 19, 0, 0, 0, 5, 0, 8, 0, 0, 0, 0, 0,
183, 1, 0, 0, 110, 111, 119, 110, 99, 16, 3, 0, 0, 0, 0, 0, 183, 1, 0, 0, 85, 110, 107, 110,
99, 16, 0, 0, 0, 0, 0, 0, 123, 118, 24, 0, 0, 0, 0, 0, 123, 118, 16, 0, 0, 0, 0, 0, 123, 6, 8,
0, 0, 0, 0, 0, 183, 3, 0, 0, 14, 0, 0, 0, 99, 54, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0,
191, 71, 0, 0, 0, 0, 0, 0, 191, 56, 0, 0, 0, 0, 0, 0, 191, 41, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0,
0, 0, 0, 0, 183, 1, 0, 0, 68, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 129, 247, 255,
255, 85, 0, 4, 0, 0, 0, 0, 0, 183, 1, 0, 0, 68, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0,
0, 211, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 145, 0, 0, 0, 0, 0, 0, 121, 146, 8, 0,
0, 0, 0, 0, 121, 147, 16, 0, 0, 0, 0, 0, 121, 148, 24, 0, 0, 0, 0, 0, 183, 5, 0, 0, 1, 1, 0, 0,
107, 80, 32, 0, 0, 0, 0, 0, 123, 64, 24, 0, 0, 0, 0, 0, 123, 48, 16, 0, 0, 0, 0, 0, 123, 32, 8,
0, 0, 0, 0, 0, 123, 16, 0, 0, 0, 0, 0, 0, 121, 129, 0, 0, 0, 0, 0, 0, 123, 16, 34, 0, 0, 0, 0,
0, 121, 129, 8, 0, 0, 0, 0, 0, 123, 16, 42, 0, 0, 0, 0, 0, 121, 129, 16, 0, 0, 0, 0, 0, 123,
16, 50, 0, 0, 0, 0, 0, 121, 129, 24, 0, 0, 0, 0, 0, 123, 16, 58, 0, 0, 0, 0, 0, 183, 1, 0, 0,
0, 1, 0, 0, 107, 16, 66, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 112, 255, 0, 0, 0,
0, 123, 26, 104, 255, 0, 0, 0, 0, 123, 26, 96, 255, 0, 0, 0, 0, 123, 26, 88, 255, 0, 0, 0, 0,
123, 122, 128, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 115, 26, 120, 255, 0, 0, 0, 0, 123,
26, 248, 255, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 10, 232, 255, 0, 0, 0, 0, 191,
162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 88, 255, 255, 255, 191, 167, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0,
120, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 97, 0, 0,
0, 0, 0, 0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 91, 251, 255, 255, 191, 113, 0, 0, 0, 0,
0, 0, 133, 16, 0, 0, 98, 247, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 35, 0, 0, 0, 0, 0, 0,
121, 18, 16, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 202, 8, 0, 0, 149, 0, 0,
0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 3, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
183, 3, 0, 0, 14, 0, 0, 0, 133, 16, 0, 0, 141, 8, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0,
0, 0, 0, 0, 133, 16, 0, 0, 14, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 24, 1, 0, 0, 17,
216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 46, 0, 0, 0, 133, 16, 0, 0, 4, 0, 0, 0, 133,
16, 0, 0, 249, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 3, 0, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255,
255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0,
139, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0,
0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 15, 52, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 45, 66, 1,
0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 1, 0, 0, 0, 85, 1, 27, 0, 0, 0, 0, 0,
121, 97, 8, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0, 45, 71, 1, 0,
0, 0, 0, 0, 191, 71, 0, 0, 0, 0, 0, 0, 37, 7, 1, 0, 8, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21,
1, 6, 0, 0, 0, 0, 0, 121, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 248, 255, 0,
0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 208, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 114, 0,
0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 57, 0, 0, 0, 121, 161, 208, 255, 0, 0,
0, 0, 85, 1, 4, 0, 1, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 133,
16, 0, 0, 92, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216, 255, 0, 0, 0, 0, 123,
118, 8, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161, 216, 255,
0, 0, 0, 0, 133, 16, 0, 0, 92, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 22, 0, 0, 0, 0,
0, 0, 191, 35, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 45, 50, 1,
0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 1, 0, 0, 0, 85, 1, 27, 0, 0, 0, 0, 0,
121, 97, 8, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0, 45, 55, 1, 0,
0, 0, 0, 0, 191, 55, 0, 0, 0, 0, 0, 0, 37, 7, 1, 0, 8, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21,
1, 6, 0, 0, 0, 0, 0, 121, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 248, 255, 0,
0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 208, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 114, 0,
0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 13, 0, 0, 0, 121, 161, 208, 255, 0, 0,
0, 0, 85, 1, 4, 0, 1, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 133,
16, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216, 255, 0, 0, 0, 0, 123,
118, 8, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161, 216, 255,
0, 0, 0, 0, 133, 16, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 56, 0, 0, 0, 0,
0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 85, 8, 4, 0, 0, 0, 0, 0, 123, 118,
8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0,
121, 65, 0, 0, 0, 0, 0, 0, 21, 1, 13, 0, 0, 0, 0, 0, 121, 66, 8, 0, 0, 0, 0, 0, 85, 2, 6, 0, 0,
0, 0, 0, 21, 7, 20, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 201, 246, 255, 255, 21, 0, 12, 0, 0, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 191, 131, 0,
0, 0, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 200, 246, 255, 255, 21, 0, 7, 0, 0,
0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 21, 7, 9, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191,
130, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 190, 246, 255, 255, 21, 0, 1, 0, 0, 0, 0, 0, 5, 0, 6, 0,
0, 0, 0, 0, 123, 118, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 191, 135, 0, 0, 0, 0, 0, 0,
5, 0, 4, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 191, 128, 0, 0, 0, 0, 0, 0, 123, 6, 8, 0, 0,
0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 123, 118, 16, 0, 0, 0, 0, 0, 149,
0, 0, 0, 0, 0, 0, 0, 24, 1, 0, 0, 91, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 17, 0,
0, 0, 24, 3, 0, 0, 8, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 121, 2, 0, 0, 133, 16,
0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 5, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 133,
16, 0, 0, 173, 246, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 98, 255, 255,
255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 111, 255, 255, 255, 133, 16, 0, 0, 255,
255, 255, 255, 191, 38, 0, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0,
121, 99, 40, 0, 0, 0, 0, 0, 121, 97, 0, 0, 0, 0, 0, 0, 121, 98, 8, 0, 0, 0, 0, 0, 191, 36, 0,
0, 0, 0, 0, 0, 103, 4, 0, 0, 4, 0, 0, 0, 21, 4, 9, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0,
191, 21, 0, 0, 0, 0, 0, 0, 7, 5, 0, 0, 8, 0, 0, 0, 121, 88, 0, 0, 0, 0, 0, 0, 15, 8, 0, 0, 0,
0, 0, 0, 7, 5, 0, 0, 16, 0, 0, 0, 7, 4, 0, 0, 240, 255, 255, 255, 191, 128, 0, 0, 0, 0, 0, 0,
85, 4, 250, 255, 0, 0, 0, 0, 21, 3, 17, 0, 0, 0, 0, 0, 21, 2, 6, 0, 0, 0, 0, 0, 121, 17, 8, 0,
0, 0, 0, 0, 85, 1, 4, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 183,
2, 0, 0, 16, 0, 0, 0, 45, 130, 22, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 15, 34, 0, 0, 0,
0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 45, 40,
1, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 1, 0, 0, 0, 191, 40, 0, 0, 0, 0, 0, 0,
85, 3, 12, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 21, 8, 9, 0, 0,
0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 120, 246, 255,
255, 191, 129, 0, 0, 0, 0, 0, 0, 85, 0, 4, 0, 0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 183, 2,
0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 201, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 183, 2,
0, 0, 0, 0, 0, 0, 123, 39, 16, 0, 0, 0, 0, 0, 123, 23, 8, 0, 0, 0, 0, 0, 123, 7, 0, 0, 0, 0, 0,
0, 123, 122, 200, 255, 0, 0, 0, 0, 191, 167, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 208, 255, 255, 255,
191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0,
0, 135, 14, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 200, 255, 255, 255, 24, 2, 0, 0, 184,
231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 85, 5, 0, 0, 21,
0, 11, 0, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255, 255, 24, 1, 0, 0,
108, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 51, 0, 0, 0, 24, 4, 0, 0, 120, 231, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 24, 5, 0, 0, 32, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 94,
2, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0,
0, 191, 22, 0, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0,
0, 32, 0, 0, 0, 37, 1, 12, 0, 127, 0, 0, 0, 121, 98, 16, 0, 0, 0, 0, 0, 121, 97, 8, 0, 0, 0, 0,
0, 93, 18, 3, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 68, 255, 255, 255, 121,
98, 16, 0, 0, 0, 0, 0, 121, 97, 0, 0, 0, 0, 0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0,
0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 38, 16, 0, 0, 0, 0, 0, 5, 0, 66, 0, 0, 0, 0, 0, 183, 2,
0, 0, 0, 0, 0, 0, 99, 42, 252, 255, 0, 0, 0, 0, 183, 2, 0, 0, 0, 8, 0, 0, 45, 18, 19, 0, 0, 0,
0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 183, 2,
0, 0, 0, 0, 1, 0, 45, 18, 1, 0, 0, 0, 0, 0, 5, 0, 22, 0, 0, 0, 0, 0, 87, 7, 0, 0, 63, 0, 0, 0,
71, 7, 0, 0, 128, 0, 0, 0, 115, 122, 254, 255, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2,
0, 0, 12, 0, 0, 0, 71, 2, 0, 0, 224, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 119, 1, 0, 0, 6,
0, 0, 0, 87, 1, 0, 0, 63, 0, 0, 0, 71, 1, 0, 0, 128, 0, 0, 0, 115, 26, 253, 255, 0, 0, 0, 0,
183, 7, 0, 0, 3, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 63,
0, 0, 0, 71, 1, 0, 0, 128, 0, 0, 0, 115, 26, 253, 255, 0, 0, 0, 0, 119, 7, 0, 0, 6, 0, 0, 0,
71, 7, 0, 0, 192, 0, 0, 0, 115, 122, 252, 255, 0, 0, 0, 0, 183, 7, 0, 0, 2, 0, 0, 0, 5, 0, 17,
0, 0, 0, 0, 0, 87, 7, 0, 0, 63, 0, 0, 0, 71, 7, 0, 0, 128, 0, 0, 0, 115, 122, 255, 255, 0, 0,
0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 18, 0, 0, 0, 71, 2, 0, 0, 240, 0, 0, 0, 115, 42,
252, 255, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 6, 0, 0, 0, 87, 2, 0, 0, 63, 0,
0, 0, 71, 2, 0, 0, 128, 0, 0, 0, 115, 42, 254, 255, 0, 0, 0, 0, 119, 1, 0, 0, 12, 0, 0, 0, 87,
1, 0, 0, 63, 0, 0, 0, 71, 1, 0, 0, 128, 0, 0, 0, 115, 26, 253, 255, 0, 0, 0, 0, 183, 7, 0, 0,
4, 0, 0, 0, 121, 104, 16, 0, 0, 0, 0, 0, 121, 97, 8, 0, 0, 0, 0, 0, 31, 129, 0, 0, 0, 0, 0, 0,
61, 113, 5, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 191, 115, 0,
0, 0, 0, 0, 0, 133, 16, 0, 0, 216, 254, 255, 255, 121, 104, 16, 0, 0, 0, 0, 0, 121, 97, 0, 0,
0, 0, 0, 0, 15, 129, 0, 0, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 252, 255, 255,
255, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 34, 14, 0, 0, 15, 120, 0, 0, 0, 0, 0, 0, 123,
134, 16, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 216, 255, 255, 255, 24, 3, 0, 0, 183, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
183, 4, 0, 0, 13, 0, 0, 0, 133, 16, 0, 0, 88, 7, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 123, 26,
240, 255, 0, 0, 0, 0, 121, 161, 216, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 123, 106,
248, 255, 0, 0, 0, 0, 191, 167, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 232, 255, 255, 255, 191, 164, 0,
0, 0, 0, 0, 0, 7, 4, 0, 0, 248, 255, 255, 255, 191, 113, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 196,
216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 5, 0, 0, 0, 24, 5, 0, 0, 56, 231, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 217, 2, 0, 0, 7, 6, 0, 0, 24, 0, 0, 0, 123, 106, 248, 255, 0,
0, 0, 0, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 248, 255, 255, 255, 191, 113, 0, 0, 0, 0, 0,
0, 24, 2, 0, 0, 201, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 5, 0, 0, 0, 24, 5, 0, 0,
88, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 206, 2, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 75, 3, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 54, 0, 0, 0, 0, 0, 0, 191, 40, 0, 0,
0, 0, 0, 0, 121, 23, 0, 0, 0, 0, 0, 0, 121, 121, 16, 0, 0, 0, 0, 0, 121, 113, 8, 0, 0, 0, 0, 0,
31, 145, 0, 0, 0, 0, 0, 0, 61, 97, 5, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 146, 0,
0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 158, 254, 255, 255, 121, 121, 16, 0,
0, 0, 0, 0, 121, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0,
191, 99, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 233, 13, 0, 0, 15, 105, 0, 0, 0, 0, 0, 0, 123, 151,
16, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 111, 255, 255, 255, 183, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121,
17, 0, 0, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0,
208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 218,
13, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 200, 255, 255, 255, 24, 2, 0, 0, 184, 231, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 168, 4, 0, 0, 149, 0, 0,
0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 34, 13, 0, 0, 149, 0, 0, 0, 0, 0, 0,
0, 191, 38, 0, 0, 0, 0, 0, 0, 121, 23, 0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0,
0, 4, 7, 0, 0, 85, 0, 8, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 5, 7, 0, 0,
85, 0, 1, 0, 0, 0, 0, 0, 5, 0, 8, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0,
0, 0, 0, 133, 16, 0, 0, 106, 10, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191,
98, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 56, 10, 0, 0, 5, 0, 3, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0,
0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 180, 11, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0,
121, 17, 0, 0, 0, 0, 0, 0, 121, 22, 16, 0, 0, 0, 0, 0, 121, 23, 0, 0, 0, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 216, 255, 255, 255, 133, 16, 0, 0, 3, 7, 0, 0, 121, 161, 224, 255,
0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 121, 161, 216, 255, 0, 0, 0, 0, 123, 26, 232, 255,
0, 0, 0, 0, 21, 6, 11, 0, 0, 0, 0, 0, 123, 122, 248, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 232, 255, 255, 255, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 248, 255, 255, 255,
24, 3, 0, 0, 152, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 211, 3, 0, 0, 7, 7, 0, 0,
1, 0, 0, 0, 7, 6, 0, 0, 255, 255, 255, 255, 85, 6, 245, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0,
0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 133, 16, 0, 0, 209, 3, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0,
121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255,
255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 133, 16,
0, 0, 235, 10, 0, 0, 191, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 19, 0, 0, 0, 0,
0, 121, 98, 40, 0, 0, 0, 0, 0, 121, 97, 32, 0, 0, 0, 0, 0, 24, 3, 0, 0, 208, 216, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 123, 58, 240, 255, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 123, 58, 248, 255,
0, 0, 0, 0, 123, 58, 224, 255, 0, 0, 0, 0, 24, 3, 0, 0, 232, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123, 58, 208, 255, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 216, 255, 0, 0, 0, 0, 191,
163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255, 255, 133, 16, 0, 0, 91, 4, 0, 0, 191, 1, 0,
0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 21, 1, 1, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 7,
7, 0, 0, 8, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 208,
10, 0, 0, 191, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 21, 1, 248, 255, 0, 0, 0, 0, 183,
0, 0, 0, 1, 0, 0, 0, 5, 0, 246, 255, 0, 0, 0, 0, 24, 0, 0, 0, 114, 113, 109, 195, 0, 0, 0, 0,
189, 57, 113, 200, 149, 0, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0,
0, 183, 1, 0, 0, 2, 0, 0, 0, 191, 117, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 32, 0, 0, 0, 119, 5, 0,
0, 32, 0, 0, 0, 101, 5, 9, 0, 33, 0, 0, 0, 183, 4, 0, 0, 116, 0, 0, 0, 21, 5, 173, 0, 9, 0, 0,
0, 21, 5, 4, 0, 10, 0, 0, 0, 21, 5, 1, 0, 13, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 183, 4, 0, 0,
114, 0, 0, 0, 5, 0, 168, 0, 0, 0, 0, 0, 183, 4, 0, 0, 110, 0, 0, 0, 5, 0, 166, 0, 0, 0, 0, 0,
21, 5, 92, 0, 34, 0, 0, 0, 21, 5, 160, 0, 39, 0, 0, 0, 21, 5, 95, 0, 92, 0, 0, 0, 87, 3, 0, 0,
1, 0, 0, 0, 21, 3, 3, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 244, 12, 0, 0,
85, 0, 26, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0,
32, 0, 0, 0, 183, 2, 0, 0, 0, 0, 1, 0, 45, 18, 87, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 2, 0, 45,
18, 1, 0, 0, 0, 0, 0, 5, 0, 103, 0, 0, 0, 0, 0, 24, 1, 0, 0, 97, 224, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 123, 26, 8, 240, 0, 0, 0, 0, 183, 1, 0, 0, 182, 1, 0, 0, 123, 26, 16, 240, 0, 0, 0, 0,
183, 1, 0, 0, 192, 0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 113,
0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 77, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 42, 0, 0,
0, 24, 4, 0, 0, 161, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 94, 9, 0, 0, 183, 1, 0,
0, 1, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 85, 0, 132, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0,
0, 71, 1, 0, 0, 1, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 191, 18, 0,
0, 0, 0, 0, 0, 119, 2, 0, 0, 1, 0, 0, 0, 79, 33, 0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0,
119, 2, 0, 0, 2, 0, 0, 0, 79, 33, 0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 4,
0, 0, 0, 79, 33, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 32, 0, 0, 0, 119, 7, 0, 0, 32, 0, 0, 0, 24, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 79, 39, 0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0,
119, 2, 0, 0, 8, 0, 0, 0, 79, 33, 0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0,
16, 0, 0, 0, 79, 33, 0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 32, 0, 0, 0,
79, 33, 0, 0, 0, 0, 0, 0, 167, 1, 0, 0, 255, 255, 255, 255, 24, 2, 0, 0, 85, 85, 85, 85, 0, 0,
0, 0, 85, 85, 85, 85, 191, 19, 0, 0, 0, 0, 0, 0, 119, 3, 0, 0, 1, 0, 0, 0, 95, 35, 0, 0, 0, 0,
0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 51, 51, 51, 51, 0, 0, 0, 0, 51, 51, 51, 51, 191,
18, 0, 0, 0, 0, 0, 0, 95, 50, 0, 0, 0, 0, 0, 0, 119, 1, 0, 0, 2, 0, 0, 0, 95, 49, 0, 0, 0, 0,
0, 0, 15, 18, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 119, 1, 0, 0, 4, 0, 0, 0, 15, 18, 0,
0, 0, 0, 0, 0, 24, 1, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 95, 18, 0, 0, 0, 0, 0,
0, 24, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 47, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 56,
0, 0, 0, 7, 2, 0, 0, 224, 255, 255, 255, 24, 1, 0, 0, 252, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0,
0, 95, 18, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 3, 0, 0, 0, 119, 2, 0, 0, 2, 0, 0, 0, 167, 2, 0, 0,
7, 0, 0, 0, 5, 0, 73, 0, 0, 0, 0, 0, 183, 4, 0, 0, 34, 0, 0, 0, 191, 53, 0, 0, 0, 0, 0, 0, 87,
5, 0, 0, 0, 0, 1, 0, 21, 5, 162, 255, 0, 0, 0, 0, 5, 0, 68, 0, 0, 0, 0, 0, 183, 4, 0, 0, 92, 0,
0, 0, 5, 0, 66, 0, 0, 0, 0, 0, 24, 1, 0, 0, 30, 222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 8,
240, 0, 0, 0, 0, 183, 1, 0, 0, 47, 1, 0, 0, 123, 26, 16, 240, 0, 0, 0, 0, 183, 1, 0, 0, 32, 1,
0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 24,
2, 0, 0, 174, 220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 40, 0, 0, 0, 24, 4, 0, 0, 254,
220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 10, 9, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 191,
116, 0, 0, 0, 0, 0, 0, 85, 0, 48, 0, 0, 0, 0, 0, 5, 0, 171, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0,
0, 0, 0, 87, 1, 0, 0, 224, 255, 31, 0, 21, 1, 168, 255, 224, 166, 2, 0, 191, 113, 0, 0, 0, 0,
0, 0, 7, 1, 0, 0, 199, 72, 253, 255, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 183,
2, 0, 0, 7, 0, 0, 0, 45, 18, 162, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0,
254, 255, 31, 0, 21, 1, 159, 255, 30, 184, 2, 0, 191, 113, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 94,
49, 253, 255, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 183, 2, 0, 0, 14, 0, 0, 0,
45, 18, 153, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 31, 20, 253, 255, 103, 1,
0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 183, 2, 0, 0, 31, 12, 0, 0, 45, 18, 147, 255, 0,
0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 226, 5, 253, 255, 103, 1, 0, 0, 32, 0, 0, 0,
119, 1, 0, 0, 32, 0, 0, 0, 183, 2, 0, 0, 226, 5, 0, 0, 45, 18, 141, 255, 0, 0, 0, 0, 191, 113,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 181, 236, 252, 255, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32,
0, 0, 0, 183, 2, 0, 0, 181, 237, 10, 0, 45, 18, 135, 255, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0,
191, 115, 0, 0, 0, 0, 0, 0, 103, 3, 0, 0, 32, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 191, 116, 0,
0, 0, 0, 0, 0, 37, 3, 129, 255, 239, 1, 14, 0, 5, 0, 4, 0, 0, 0, 0, 0, 183, 4, 0, 0, 39, 0, 0,
0, 191, 53, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0, 0, 1, 0, 0, 21, 5, 93, 255, 0, 0, 0, 0, 123, 38, 8,
0, 0, 0, 0, 0, 99, 70, 4, 0, 0, 0, 0, 0, 99, 22, 0, 0, 0, 0, 0, 0, 123, 118, 16, 0, 0, 0, 0, 0,
149, 0, 0, 0, 0, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 121, 38, 32, 0, 0, 0, 0, 0, 121, 39, 40,
0, 0, 0, 0, 0, 121, 116, 24, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 48, 217, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 12, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 183, 9, 0, 0,
1, 0, 0, 0, 85, 0, 93, 0, 0, 0, 0, 0, 121, 129, 16, 0, 0, 0, 0, 0, 21, 1, 26, 0, 0, 0, 0, 0,
123, 26, 152, 255, 0, 0, 0, 0, 24, 1, 0, 0, 48, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26,
168, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 152, 255, 255, 255, 123, 26, 160,
255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255,
0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0,
123, 26, 216, 255, 0, 0, 0, 0, 24, 1, 0, 0, 72, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26,
208, 255, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 123, 154, 248, 255, 0, 0, 0, 0, 191, 163, 0, 0,
0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 107, 3, 0, 0, 85, 0, 66, 0, 0, 0, 0, 0, 5, 0, 33, 0, 0, 0, 0, 0, 121, 137, 0,
0, 0, 0, 0, 0, 121, 129, 8, 0, 0, 0, 0, 0, 121, 18, 24, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0,
0, 141, 0, 0, 0, 2, 0, 0, 0, 24, 1, 0, 0, 244, 188, 199, 236, 0, 0, 0, 0, 30, 169, 242, 126,
93, 16, 25, 0, 0, 0, 0, 0, 123, 154, 152, 255, 0, 0, 0, 0, 24, 1, 0, 0, 200, 203, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 152,
255, 255, 255, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255,
255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0,
0, 183, 1, 0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 24, 1, 0, 0, 72, 232, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 123, 154, 248, 255,
0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0,
0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 73, 3, 0, 0, 85, 0, 32, 0, 0, 0, 0, 0, 121, 129,
24, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 20, 0, 0, 0, 123, 42, 192, 255, 0, 0,
0, 0, 24, 2, 0, 0, 72, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 42, 200, 255, 0, 0, 0, 0, 123,
42, 184, 255, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 16, 0, 0, 0, 123, 42, 176,
255, 0, 0, 0, 0, 24, 2, 0, 0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 42, 168, 255, 0, 0, 0,
0, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255,
123, 26, 240, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 183, 1,
0, 0, 3, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 24, 1, 0, 0,
248, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0,
0, 7, 3, 0, 0, 208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 41, 3, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 191, 144, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0,
0, 0, 0, 24, 4, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 74, 224, 255, 0, 0, 0, 0,
183, 4, 0, 0, 0, 0, 0, 0, 123, 74, 232, 255, 0, 0, 0, 0, 123, 74, 208, 255, 0, 0, 0, 0, 183, 4,
0, 0, 1, 0, 0, 0, 123, 74, 200, 255, 0, 0, 0, 0, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 240,
255, 255, 255, 123, 74, 192, 255, 0, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 123, 26, 240, 255,
0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 192, 255, 255, 255, 191, 50, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 29, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 123, 42, 168, 255, 0, 0, 0,
0, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255,
123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0, 183, 1,
0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 24, 1, 0, 0,
104, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0, 0, 32, 198, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 168, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 191, 50, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 1, 0,
0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 123, 42, 248, 255, 0, 0, 0, 0, 123, 26, 240, 255, 0,
0, 0, 0, 24, 1, 0, 0, 40, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 24,
1, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 191, 161, 0, 0,
0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 133, 16, 0, 0, 188, 252, 255, 255, 133, 16, 0, 0,
255, 255, 255, 255, 123, 42, 152, 255, 0, 0, 0, 0, 123, 26, 144, 255, 0, 0, 0, 0, 123, 74, 168,
255, 0, 0, 0, 0, 123, 58, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224,
255, 255, 255, 123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0,
0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0,
0, 24, 1, 0, 0, 136, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 24, 1,
0, 0, 56, 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0, 0, 0, 204, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 144, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
176, 255, 255, 255, 191, 82, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 213, 255, 255, 255, 133, 16, 0,
0, 255, 255, 255, 255, 191, 54, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0,
0, 0, 0, 21, 6, 11, 0, 0, 0, 0, 0, 121, 24, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 123,
42, 240, 255, 0, 0, 0, 0, 121, 17, 16, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 123, 138,
216, 255, 0, 0, 0, 0, 5, 0, 5, 0, 0, 0, 0, 0, 15, 151, 0, 0, 0, 0, 0, 0, 31, 150, 0, 0, 0, 0,
0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 85, 6, 1, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161,
248, 255, 0, 0, 0, 0, 113, 17, 0, 0, 0, 0, 0, 0, 85, 1, 136, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0,
0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 16, 0, 0, 0, 45, 33, 48, 0, 0, 0, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 7, 0,
0, 0, 87, 4, 0, 0, 248, 255, 255, 255, 31, 20, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 85,
4, 73, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 240, 255, 255, 255, 45, 65, 52, 0,
0, 0, 0, 0, 123, 122, 232, 255, 0, 0, 0, 0, 191, 117, 0, 0, 0, 0, 0, 0, 123, 58, 224, 255, 0,
0, 0, 0, 15, 53, 0, 0, 0, 0, 0, 0, 191, 80, 0, 0, 0, 0, 0, 0, 15, 16, 0, 0, 0, 0, 0, 0, 121, 8,
8, 0, 0, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 24, 7, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0, 10, 10,
10, 10, 175, 121, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 255, 254, 254, 254, 0, 0, 0, 0, 254, 254, 254,
254, 15, 57, 0, 0, 0, 0, 0, 0, 167, 8, 0, 0, 255, 255, 255, 255, 95, 152, 0, 0, 0, 0, 0, 0,
121, 0, 0, 0, 0, 0, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 175, 121, 0, 0, 0, 0, 0, 0, 15, 57, 0, 0,
0, 0, 0, 0, 167, 0, 0, 0, 255, 255, 255, 255, 95, 144, 0, 0, 0, 0, 0, 0, 79, 128, 0, 0, 0, 0,
0, 0, 24, 3, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 128, 128, 128, 128, 95, 48, 0, 0, 0, 0, 0,
0, 85, 0, 2, 0, 0, 0, 0, 0, 7, 1, 0, 0, 16, 0, 0, 0, 61, 20, 231, 255, 0, 0, 0, 0, 121, 168,
216, 255, 0, 0, 0, 0, 121, 167, 232, 255, 0, 0, 0, 0, 121, 163, 224, 255, 0, 0, 0, 0, 61, 18,
19, 0, 0, 0, 0, 0, 24, 3, 0, 0, 112, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 163, 5,
0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 183, 5, 0, 0, 0, 0, 0, 0, 191, 105, 0, 0, 0, 0, 0, 0,
21, 2, 67, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0,
0, 0, 0, 0, 191, 21, 0, 0, 0, 0, 0, 0, 15, 69, 0, 0, 0, 0, 0, 0, 113, 85, 0, 0, 0, 0, 0, 0, 21,
5, 38, 0, 10, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 191, 105, 0, 0, 0, 0,
0, 0, 29, 66, 56, 0, 0, 0, 0, 0, 5, 0, 247, 255, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 191,
105, 0, 0, 0, 0, 0, 0, 29, 33, 52, 0, 0, 0, 0, 0, 31, 18, 0, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0,
0, 0, 0, 15, 52, 0, 0, 0, 0, 0, 0, 191, 112, 0, 0, 0, 0, 0, 0, 15, 64, 0, 0, 0, 0, 0, 0, 183,
4, 0, 0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 15, 69, 0, 0, 0, 0, 0, 0, 113, 85, 0, 0, 0, 0,
0, 0, 21, 5, 18, 0, 10, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 191, 105, 0,
0, 0, 0, 0, 0, 29, 66, 38, 0, 0, 0, 0, 0, 5, 0, 247, 255, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0,
0, 45, 36, 1, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 191, 117, 0, 0, 0, 0, 0, 0, 15, 53, 0,
0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 191, 80, 0, 0, 0, 0, 0, 0, 15, 64, 0, 0, 0, 0, 0, 0,
113, 0, 0, 0, 0, 0, 0, 0, 21, 0, 5, 0, 10, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 29, 65, 171, 255,
0, 0, 0, 0, 5, 0, 249, 255, 0, 0, 0, 0, 15, 65, 0, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0,
15, 52, 0, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 1,
0, 0, 0, 45, 52, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 1, 0, 0, 0, 85, 1, 1,
0, 0, 0, 0, 0, 61, 54, 6, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0,
31, 50, 0, 0, 0, 0, 0, 0, 191, 105, 0, 0, 0, 0, 0, 0, 45, 99, 8, 0, 0, 0, 0, 0, 5, 0, 143, 255,
0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 65, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 1, 0, 0, 0,
113, 17, 0, 0, 0, 0, 0, 0, 191, 57, 0, 0, 0, 0, 0, 0, 21, 1, 1, 0, 10, 0, 0, 0, 5, 0, 243, 255,
0, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0, 115, 81, 0, 0, 0, 0, 0, 0, 45, 150, 21, 0, 0, 0, 0,
0, 29, 150, 1, 0, 0, 0, 0, 0, 5, 0, 25, 0, 0, 0, 0, 0, 121, 132, 24, 0, 0, 0, 0, 0, 121, 161,
240, 255, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4,
0, 0, 0, 191, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 117, 255, 0, 0, 0, 0, 5, 0,
112, 255, 0, 0, 0, 0, 121, 132, 24, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 24, 2, 0, 0,
244, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0,
191, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 107, 255, 0, 0, 0, 0, 5, 0, 110,
255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 113, 17, 0, 0, 0, 0, 0,
0, 103, 1, 0, 0, 56, 0, 0, 0, 199, 1, 0, 0, 56, 0, 0, 0, 101, 1, 8, 0, 191, 255, 255, 255, 191,
113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191, 148, 0, 0, 0,
0, 0, 0, 24, 5, 0, 0, 216, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 114, 6, 0, 0, 133,
16, 0, 0, 255, 255, 255, 255, 121, 132, 24, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 191,
114, 0, 0, 0, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 1, 0, 0, 0,
0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 84, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 15,
145, 0, 0, 0, 0, 0, 0, 113, 17, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 56, 0, 0, 0, 199, 1, 0, 0, 56,
0, 0, 0, 101, 1, 74, 255, 191, 255, 255, 255, 191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0,
0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 191, 100, 0, 0, 0, 0, 0, 0, 24, 5, 0, 0, 240, 232, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 92, 6, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 40, 0,
0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 113, 97, 8, 0, 0, 0, 0, 0,
183, 7, 0, 0, 1, 0, 0, 0, 85, 1, 90, 0, 0, 0, 0, 0, 113, 97, 9, 0, 0, 0, 0, 0, 121, 105, 0, 0,
0, 0, 0, 0, 97, 146, 48, 0, 0, 0, 0, 0, 87, 2, 0, 0, 4, 0, 0, 0, 123, 74, 144, 255, 0, 0, 0, 0,
123, 90, 136, 255, 0, 0, 0, 0, 123, 58, 152, 255, 0, 0, 0, 0, 85, 2, 42, 0, 0, 0, 0, 0, 24, 2,
0, 0, 188, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0, 24, 2, 0, 0, 186, 217,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 3, 0, 0, 0, 21, 1, 1, 0, 0, 0, 0, 0, 183, 3, 0, 0,
2, 0, 0, 0, 121, 145, 32, 0, 0, 0, 0, 0, 121, 148, 40, 0, 0, 0, 0, 0, 121, 68, 24, 0, 0, 0, 0,
0, 141, 0, 0, 0, 4, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 121, 163, 152,
255, 0, 0, 0, 0, 85, 0, 66, 0, 0, 0, 0, 0, 121, 145, 32, 0, 0, 0, 0, 0, 121, 146, 40, 0, 0, 0,
0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 183, 2,
0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 0, 58, 0, 0, 0, 0, 0, 121, 145, 32, 0, 0, 0, 0,
0, 121, 146, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 179, 217, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 121, 163, 136, 255, 0, 0,
0, 0, 121, 161, 144, 255, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85,
0, 46, 0, 0, 0, 0, 0, 121, 51, 24, 0, 0, 0, 0, 0, 191, 146, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3,
0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 5, 0, 40, 0, 0, 0, 0, 0, 21, 1,
43, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 115, 122, 191, 255, 0, 0, 0, 0, 121, 145, 32, 0,
0, 0, 0, 0, 121, 146, 40, 0, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 191, 255, 255,
255, 123, 58, 176, 255, 0, 0, 0, 0, 123, 42, 168, 255, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0, 0,
0, 121, 145, 48, 0, 0, 0, 0, 0, 121, 146, 0, 0, 0, 0, 0, 0, 121, 147, 8, 0, 0, 0, 0, 0, 121,
148, 16, 0, 0, 0, 0, 0, 121, 149, 24, 0, 0, 0, 0, 0, 113, 144, 56, 0, 0, 0, 0, 0, 115, 10, 248,
255, 0, 0, 0, 0, 24, 0, 0, 0, 168, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 10, 232, 255, 0, 0,
0, 0, 123, 90, 216, 255, 0, 0, 0, 0, 123, 74, 208, 255, 0, 0, 0, 0, 123, 58, 200, 255, 0, 0, 0,
0, 123, 42, 192, 255, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7,
1, 0, 0, 160, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 121,
163, 152, 255, 0, 0, 0, 0, 133, 16, 0, 0, 224, 254, 255, 255, 85, 0, 7, 0, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 24, 2, 0, 0, 179, 217, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 133, 16, 0, 0, 217, 254, 255, 255, 21, 0, 16, 0, 0, 0, 0,
0, 183, 2, 0, 0, 1, 0, 0, 0, 115, 38, 9, 0, 0, 0, 0, 0, 115, 118, 8, 0, 0, 0, 0, 0, 191, 96, 0,
0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 145, 32, 0, 0, 0, 0, 0, 121, 146, 40, 0, 0, 0, 0,
0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 181, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0,
0, 3, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0,
85, 0, 242, 255, 0, 0, 0, 0, 5, 0, 202, 255, 0, 0, 0, 0, 121, 161, 136, 255, 0, 0, 0, 0, 121,
19, 24, 0, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255, 121, 161,
144, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 233, 255, 0, 0, 0, 0, 121, 161, 232,
255, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 24, 2, 0, 0, 184,
217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 7,
0, 0, 0, 0, 0, 0, 5, 0, 224, 255, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 113, 97, 8, 0, 0, 0,
0, 0, 113, 98, 9, 0, 0, 0, 0, 0, 191, 16, 0, 0, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 87, 0, 0,
0, 255, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 85, 0, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0,
191, 16, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 18, 0, 0,
0, 0, 0, 121, 98, 0, 0, 0, 0, 0, 0, 97, 33, 48, 0, 0, 0, 0, 0, 87, 1, 0, 0, 4, 0, 0, 0, 85, 1,
7, 0, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0,
0, 0, 24, 2, 0, 0, 192, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 5, 0, 6,
0, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0,
0, 24, 2, 0, 0, 191, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 141, 0, 0, 0,
4, 0, 0, 0, 115, 6, 8, 0, 0, 0, 0, 0, 5, 0, 228, 255, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0,
113, 97, 16, 0, 0, 0, 0, 0, 21, 1, 3, 0, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 121, 97, 8, 0,
0, 0, 0, 0, 5, 0, 84, 0, 0, 0, 0, 0, 123, 42, 152, 255, 0, 0, 0, 0, 121, 100, 8, 0, 0, 0, 0, 0,
121, 103, 0, 0, 0, 0, 0, 0, 97, 113, 48, 0, 0, 0, 0, 0, 87, 1, 0, 0, 4, 0, 0, 0, 123, 74, 144,
255, 0, 0, 0, 0, 85, 1, 23, 0, 0, 0, 0, 0, 123, 58, 136, 255, 0, 0, 0, 0, 24, 2, 0, 0, 196,
217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 4, 2, 0, 0, 0, 0, 0, 24, 2, 0, 0, 186, 217, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 191, 72, 0, 0, 0, 0, 0,
0, 21, 8, 1, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0, 0, 121, 116,
40, 0, 0, 0, 0, 0, 121, 68, 24, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 129, 0, 0, 0, 0,
0, 0, 85, 0, 60, 0, 0, 0, 0, 0, 121, 161, 136, 255, 0, 0, 0, 0, 121, 19, 24, 0, 0, 0, 0, 0,
121, 161, 152, 255, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 5, 0, 52,
0, 0, 0, 0, 0, 191, 56, 0, 0, 0, 0, 0, 0, 85, 4, 10, 0, 0, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0,
0, 121, 114, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 194, 217, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 85, 0, 42, 0, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 115, 154, 191,
255, 0, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0, 0, 121, 114, 40, 0, 0, 0, 0, 0, 191, 163, 0, 0, 0,
0, 0, 0, 7, 3, 0, 0, 191, 255, 255, 255, 123, 58, 176, 255, 0, 0, 0, 0, 123, 42, 168, 255, 0,
0, 0, 0, 123, 26, 160, 255, 0, 0, 0, 0, 121, 113, 48, 0, 0, 0, 0, 0, 121, 114, 0, 0, 0, 0, 0,
0, 121, 115, 8, 0, 0, 0, 0, 0, 121, 116, 16, 0, 0, 0, 0, 0, 121, 117, 24, 0, 0, 0, 0, 0, 113,
112, 56, 0, 0, 0, 0, 0, 115, 10, 248, 255, 0, 0, 0, 0, 24, 0, 0, 0, 168, 232, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 123, 10, 232, 255, 0, 0, 0, 0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 160, 255,
255, 255, 123, 10, 224, 255, 0, 0, 0, 0, 123, 90, 216, 255, 0, 0, 0, 0, 123, 74, 208, 255, 0,
0, 0, 0, 123, 58, 200, 255, 0, 0, 0, 0, 123, 42, 192, 255, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0,
0, 0, 121, 131, 24, 0, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255,
121, 161, 152, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 8, 0, 0, 0, 0, 0, 121, 161,
232, 255, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 24, 2, 0, 0,
184, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0,
191, 9, 0, 0, 0, 0, 0, 0, 121, 161, 144, 255, 0, 0, 0, 0, 115, 150, 16, 0, 0, 0, 0, 0, 7, 1, 0,
0, 1, 0, 0, 0, 123, 22, 8, 0, 0, 0, 0, 0, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0,
191, 56, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 113, 97, 8, 0,
0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 1, 18, 0, 0, 0, 0, 0, 113, 97, 9, 0, 0, 0, 0, 0, 121,
105, 0, 0, 0, 0, 0, 0, 97, 147, 48, 0, 0, 0, 0, 0, 87, 3, 0, 0, 4, 0, 0, 0, 85, 3, 23, 0, 0, 0,
0, 0, 21, 1, 15, 0, 0, 0, 0, 0, 121, 145, 32, 0, 0, 0, 0, 0, 121, 147, 40, 0, 0, 0, 0, 0, 191,
39, 0, 0, 0, 0, 0, 0, 121, 52, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 186, 217, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 21, 0, 3, 0, 0, 0, 0, 0, 115, 54, 9, 0, 0, 0, 0,
0, 115, 118, 8, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 131, 24, 0, 0, 0, 0, 0, 191, 33,
0, 0, 0, 0, 0, 0, 191, 146, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0,
0, 191, 7, 0, 0, 0, 0, 0, 0, 5, 0, 246, 255, 0, 0, 0, 0, 123, 42, 152, 255, 0, 0, 0, 0, 21, 1,
43, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 115, 122, 191, 255, 0, 0, 0, 0, 121, 145, 32, 0,
0, 0, 0, 0, 121, 148, 40, 0, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 191, 255, 255,
255, 123, 58, 176, 255, 0, 0, 0, 0, 123, 74, 168, 255, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0, 0,
0, 121, 146, 48, 0, 0, 0, 0, 0, 121, 145, 0, 0, 0, 0, 0, 0, 121, 147, 8, 0, 0, 0, 0, 0, 121,
148, 16, 0, 0, 0, 0, 0, 121, 149, 24, 0, 0, 0, 0, 0, 113, 144, 56, 0, 0, 0, 0, 0, 115, 10, 248,
255, 0, 0, 0, 0, 24, 0, 0, 0, 168, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 10, 232, 255, 0, 0,
0, 0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 160, 255, 255, 255, 123, 10, 224, 255, 0, 0, 0,
0, 123, 90, 216, 255, 0, 0, 0, 0, 123, 74, 208, 255, 0, 0, 0, 0, 123, 58, 200, 255, 0, 0, 0, 0,
123, 26, 192, 255, 0, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 121, 131, 24, 0, 0, 0, 0, 0, 191,
162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255, 121, 161, 152, 255, 0, 0, 0, 0, 141, 0,
0, 0, 3, 0, 0, 0, 85, 0, 8, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 121, 20, 24, 0, 0,
0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 24, 2, 0, 0, 184, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
183, 3, 0, 0, 2, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1,
0, 0, 0, 5, 0, 201, 255, 0, 0, 0, 0, 121, 145, 32, 0, 0, 0, 0, 0, 121, 147, 40, 0, 0, 0, 0, 0,
121, 52, 24, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 24, 2, 0, 0, 199, 217, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 121, 162, 152, 255, 0, 0, 0, 0,
183, 3, 0, 0, 1, 0, 0, 0, 85, 0, 190, 255, 0, 0, 0, 0, 5, 0, 201, 255, 0, 0, 0, 0, 191, 22, 0,
0, 0, 0, 0, 0, 133, 16, 0, 0, 163, 255, 255, 255, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0,
0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 113, 18, 8, 0, 0, 0, 0, 0, 85, 2, 8, 0, 0, 0, 0, 0, 121, 18,
0, 0, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0,
0, 0, 24, 2, 0, 0, 201, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 141, 0, 0,
0, 4, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 99, 58, 252, 255, 0, 0, 0,
0, 191, 35, 0, 0, 0, 0, 0, 0, 103, 3, 0, 0, 32, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 183, 4, 0,
0, 128, 0, 0, 0, 45, 52, 21, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 8, 0, 0, 45, 52, 22, 0, 0, 0, 0,
0, 191, 35, 0, 0, 0, 0, 0, 0, 103, 3, 0, 0, 32, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 183, 4, 0,
0, 0, 0, 1, 0, 45, 52, 1, 0, 0, 0, 0, 0, 5, 0, 25, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 71,
2, 0, 0, 128, 0, 0, 0, 115, 42, 254, 255, 0, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0,
12, 0, 0, 0, 71, 2, 0, 0, 224, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 119, 3, 0, 0, 6, 0, 0,
0, 87, 3, 0, 0, 63, 0, 0, 0, 71, 3, 0, 0, 128, 0, 0, 0, 115, 58, 253, 255, 0, 0, 0, 0, 183, 3,
0, 0, 3, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0,
0, 0, 5, 0, 26, 0, 0, 0, 0, 0, 191, 35, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 63, 0, 0, 0, 71, 3, 0,
0, 128, 0, 0, 0, 115, 58, 253, 255, 0, 0, 0, 0, 119, 2, 0, 0, 6, 0, 0, 0, 71, 2, 0, 0, 192, 0,
0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 87, 2,
0, 0, 63, 0, 0, 0, 71, 2, 0, 0, 128, 0, 0, 0, 115, 42, 255, 255, 0, 0, 0, 0, 191, 50, 0, 0, 0,
0, 0, 0, 119, 2, 0, 0, 18, 0, 0, 0, 71, 2, 0, 0, 240, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0,
191, 50, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 6, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 71, 2, 0, 0,
128, 0, 0, 0, 115, 42, 254, 255, 0, 0, 0, 0, 119, 3, 0, 0, 12, 0, 0, 0, 87, 3, 0, 0, 63, 0, 0,
0, 71, 3, 0, 0, 128, 0, 0, 0, 115, 58, 253, 255, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 191,
162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 252, 255, 255, 255, 133, 16, 0, 0, 145, 253, 255, 255, 149,
0, 0, 0, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0,
208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 130,
9, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 200, 255, 255, 255, 24, 2, 0, 0, 64, 233, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 80, 0, 0, 0, 149, 0, 0, 0,
0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 129, 253, 255, 255, 149, 0, 0, 0, 0, 0,
0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 99, 58, 252, 255, 0, 0, 0, 0, 191,
35, 0, 0, 0, 0, 0, 0, 103, 3, 0, 0, 32, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 183, 4, 0, 0, 128,
0, 0, 0, 45, 52, 21, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 8, 0, 0, 45, 52, 22, 0, 0, 0, 0, 0, 191,
35, 0, 0, 0, 0, 0, 0, 103, 3, 0, 0, 32, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 183, 4, 0, 0, 0, 0,
1, 0, 45, 52, 1, 0, 0, 0, 0, 0, 5, 0, 25, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 71, 2, 0, 0,
128, 0, 0, 0, 115, 42, 254, 255, 0, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 12, 0, 0,
0, 71, 2, 0, 0, 224, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 119, 3, 0, 0, 6, 0, 0, 0, 87, 3,
0, 0, 63, 0, 0, 0, 71, 3, 0, 0, 128, 0, 0, 0, 115, 58, 253, 255, 0, 0, 0, 0, 183, 3, 0, 0, 3,
0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 5,
0, 26, 0, 0, 0, 0, 0, 191, 35, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 63, 0, 0, 0, 71, 3, 0, 0, 128, 0,
0, 0, 115, 58, 253, 255, 0, 0, 0, 0, 119, 2, 0, 0, 6, 0, 0, 0, 71, 2, 0, 0, 192, 0, 0, 0, 115,
42, 252, 255, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63,
0, 0, 0, 71, 2, 0, 0, 128, 0, 0, 0, 115, 42, 255, 255, 0, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0,
119, 2, 0, 0, 18, 0, 0, 0, 71, 2, 0, 0, 240, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 191, 50,
0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 6, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 71, 2, 0, 0, 128, 0, 0,
0, 115, 42, 254, 255, 0, 0, 0, 0, 119, 3, 0, 0, 12, 0, 0, 0, 87, 3, 0, 0, 63, 0, 0, 0, 71, 3,
0, 0, 128, 0, 0, 0, 115, 58, 253, 255, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 191, 162, 0, 0, 0,
0, 0, 0, 7, 2, 0, 0, 252, 255, 255, 255, 133, 16, 0, 0, 67, 253, 255, 255, 149, 0, 0, 0, 0, 0,
0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7,
6, 0, 0, 208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0,
0, 51, 9, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 200, 255, 255, 255, 24, 2, 0, 0, 64,
233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 1, 0, 0, 0, 149,
0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 3, 0, 0, 0, 115, 74, 248, 255, 0, 0, 0, 0, 24, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 123, 74, 240, 255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0,
123, 26, 224, 255, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 123, 122, 208, 255, 0, 0, 0, 0, 123,
122, 192, 255, 0, 0, 0, 0, 121, 56, 16, 0, 0, 0, 0, 0, 123, 58, 184, 255, 0, 0, 0, 0, 85, 8,
30, 0, 0, 0, 0, 0, 121, 54, 40, 0, 0, 0, 0, 0, 21, 6, 107, 0, 0, 0, 0, 0, 121, 161, 184, 255,
0, 0, 0, 0, 121, 24, 32, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 103, 6, 0, 0, 4, 0, 0, 0, 7,
8, 0, 0, 8, 0, 0, 0, 121, 25, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 8, 0, 0, 0, 121, 147, 0, 0, 0, 0,
0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 121, 20,
24, 0, 0, 0, 0, 0, 121, 146, 248, 255, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 141, 0, 0,
0, 4, 0, 0, 0, 85, 0, 110, 0, 0, 0, 0, 0, 121, 129, 248, 255, 0, 0, 0, 0, 121, 131, 0, 0, 0, 0,
0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255, 141, 0, 0, 0, 3, 0, 0, 0, 85,
0, 104, 0, 0, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 7, 8, 0, 0, 16, 0, 0, 0, 7, 9, 0, 0, 16, 0, 0,
0, 7, 6, 0, 0, 240, 255, 255, 255, 21, 6, 80, 0, 0, 0, 0, 0, 5, 0, 235, 255, 0, 0, 0, 0, 121,
57, 24, 0, 0, 0, 0, 0, 21, 9, 77, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 48, 0,
0, 0, 39, 9, 0, 0, 56, 0, 0, 0, 121, 161, 184, 255, 0, 0, 0, 0, 121, 22, 0, 0, 0, 0, 0, 0, 7,
6, 0, 0, 8, 0, 0, 0, 121, 99, 0, 0, 0, 0, 0, 0, 85, 3, 14, 0, 0, 0, 0, 0, 121, 161, 184, 255,
0, 0, 0, 0, 121, 18, 32, 0, 0, 0, 0, 0, 97, 129, 248, 255, 0, 0, 0, 0, 99, 26, 244, 255, 0, 0,
0, 0, 113, 129, 0, 0, 0, 0, 0, 0, 115, 26, 248, 255, 0, 0, 0, 0, 97, 129, 252, 255, 0, 0, 0, 0,
99, 26, 240, 255, 0, 0, 0, 0, 121, 129, 240, 255, 0, 0, 0, 0, 121, 132, 232, 255, 0, 0, 0, 0,
21, 4, 10, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 21, 4, 10, 0, 1, 0, 0, 0, 5, 0, 19, 0, 0,
0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 98, 248, 255, 0, 0,
0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 68, 0, 0, 0, 0, 0, 5, 0,
235, 255, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 103, 1, 0, 0, 4, 0, 0,
0, 191, 36, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 121, 69, 8, 0, 0, 0, 0, 0, 24, 0, 0, 0,
8, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 5, 3, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 121,
65, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 123, 58, 192,
255, 0, 0, 0, 0, 121, 129, 224, 255, 0, 0, 0, 0, 121, 132, 216, 255, 0, 0, 0, 0, 21, 4, 3, 0,
0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 21, 4, 3, 0, 1, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 183, 3,
0, 0, 1, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 103, 1, 0, 0, 4, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0,
15, 20, 0, 0, 0, 0, 0, 0, 121, 69, 8, 0, 0, 0, 0, 0, 24, 0, 0, 0, 8, 101, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 93, 5, 3, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 121, 65, 0, 0, 0, 0, 0, 0, 121, 17,
0, 0, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123, 58, 208, 255, 0, 0, 0, 0, 121, 129, 208,
255, 0, 0, 0, 0, 103, 1, 0, 0, 4, 0, 0, 0, 15, 18, 0, 0, 0, 0, 0, 0, 121, 33, 0, 0, 0, 0, 0, 0,
121, 35, 8, 0, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255, 141, 0,
0, 0, 3, 0, 0, 0, 85, 0, 24, 0, 0, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 7, 8, 0, 0, 56, 0, 0, 0, 7,
6, 0, 0, 16, 0, 0, 0, 7, 9, 0, 0, 200, 255, 255, 255, 85, 9, 185, 255, 0, 0, 0, 0, 191, 114, 0,
0, 0, 0, 0, 0, 103, 2, 0, 0, 4, 0, 0, 0, 121, 163, 184, 255, 0, 0, 0, 0, 121, 49, 0, 0, 0, 0,
0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 121, 50, 8, 0, 0, 0, 0, 0, 45, 114, 1, 0, 0, 0, 0, 0, 183, 1,
0, 0, 0, 0, 0, 0, 45, 114, 1, 0, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121, 162, 232, 255, 0, 0,
0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 121, 19, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 121,
161, 224, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 2, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0,
0, 0, 0, 5, 0, 1, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 80,
8, 240, 0, 0, 0, 0, 21, 2, 9, 0, 0, 0, 0, 0, 191, 56, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 17,
0, 97, 25, 48, 0, 0, 0, 0, 0, 191, 146, 0, 0, 0, 0, 0, 0, 87, 2, 0, 0, 1, 0, 0, 0, 191, 6, 0,
0, 0, 0, 0, 0, 21, 2, 7, 0, 0, 0, 0, 0, 183, 7, 0, 0, 43, 0, 0, 0, 5, 0, 3, 0, 0, 0, 0, 0, 191,
56, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 45, 0, 0, 0, 97, 25, 48, 0, 0, 0, 0, 0, 191, 6, 0, 0, 0, 0,
0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 123, 10, 232, 255, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191,
146, 0, 0, 0, 0, 0, 0, 87, 2, 0, 0, 4, 0, 0, 0, 21, 2, 1, 0, 0, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0,
0, 121, 82, 0, 240, 0, 0, 0, 0, 123, 42, 224, 255, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 21,
2, 31, 0, 1, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0,
200, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 0, 62, 0, 0, 0, 0, 0, 5, 0, 54, 0, 0, 0, 0, 0, 123,
122, 216, 255, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 123, 74, 240, 255, 0, 0, 0, 0, 191, 131,
0, 0, 0, 0, 0, 0, 21, 4, 8, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 121, 164, 240, 255, 0, 0,
0, 0, 191, 48, 0, 0, 0, 0, 0, 0, 5, 0, 9, 0, 0, 0, 0, 0, 15, 114, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
1, 0, 0, 0, 7, 4, 0, 0, 255, 255, 255, 255, 85, 4, 5, 0, 0, 0, 0, 0, 15, 98, 0, 0, 0, 0, 0, 0,
191, 38, 0, 0, 0, 0, 0, 0, 121, 164, 240, 255, 0, 0, 0, 0, 121, 167, 216, 255, 0, 0, 0, 0, 5,
0, 228, 255, 0, 0, 0, 0, 113, 8, 0, 0, 0, 0, 0, 0, 103, 8, 0, 0, 56, 0, 0, 0, 199, 8, 0, 0, 56,
0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 8, 242, 255, 191, 255, 255, 255, 183, 7, 0, 0, 0, 0, 0,
0, 5, 0, 240, 255, 0, 0, 0, 0, 121, 24, 8, 0, 0, 0, 0, 0, 61, 134, 22, 0, 0, 0, 0, 0, 87, 9, 0,
0, 8, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 21, 9, 1, 0, 0, 0, 0, 0, 5, 0, 33, 0, 0, 0, 0, 0,
123, 58, 192, 255, 0, 0, 0, 0, 123, 74, 240, 255, 0, 0, 0, 0, 113, 18, 56, 0, 0, 0, 0, 0, 183,
1, 0, 0, 1, 0, 0, 0, 21, 2, 1, 0, 3, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 31, 104, 0, 0, 0, 0,
0, 0, 183, 9, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 3, 0, 0, 0, 123, 138, 200, 255, 0, 0, 0, 0, 21, 1,
53, 0, 0, 0, 0, 0, 21, 1, 49, 0, 1, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 119, 9, 0, 0, 1, 0, 0,
0, 7, 8, 0, 0, 1, 0, 0, 0, 119, 8, 0, 0, 1, 0, 0, 0, 123, 138, 200, 255, 0, 0, 0, 0, 5, 0, 46,
0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 145, 0, 0,
0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 0, 7, 0, 0, 0, 0, 0, 121, 97, 32, 0, 0, 0, 0, 0, 121, 98, 40,
0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 121, 163, 232, 255,
0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 87, 7, 0, 0, 1, 0, 0, 0, 191,
112, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 97, 18, 52, 0, 0, 0, 0, 0, 123, 42, 216, 255,
0, 0, 0, 0, 183, 2, 0, 0, 48, 0, 0, 0, 99, 33, 52, 0, 0, 0, 0, 0, 113, 18, 56, 0, 0, 0, 0, 0,
123, 42, 200, 255, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 115, 113,
56, 0, 0, 0, 0, 0, 133, 16, 0, 0, 123, 0, 0, 0, 85, 0, 242, 255, 0, 0, 0, 0, 121, 161, 208,
255, 0, 0, 0, 0, 113, 18, 56, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 21, 2, 1, 0, 3, 0, 0, 0,
191, 33, 0, 0, 0, 0, 0, 0, 31, 104, 0, 0, 0, 0, 0, 0, 183, 9, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 3,
0, 0, 0, 123, 138, 240, 255, 0, 0, 0, 0, 21, 1, 65, 0, 0, 0, 0, 0, 21, 1, 61, 0, 1, 0, 0, 0,
191, 137, 0, 0, 0, 0, 0, 0, 119, 9, 0, 0, 1, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 119, 8, 0, 0, 1,
0, 0, 0, 123, 138, 240, 255, 0, 0, 0, 0, 5, 0, 58, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0,
123, 26, 200, 255, 0, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 123, 122, 216, 255, 0, 0, 0, 0, 7,
9, 0, 0, 1, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0, 97, 18, 52, 0, 0, 0, 0, 0, 123, 42, 248,
255, 0, 0, 0, 0, 121, 24, 40, 0, 0, 0, 0, 0, 121, 22, 32, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0,
0, 7, 9, 0, 0, 255, 255, 255, 255, 21, 9, 6, 0, 0, 0, 0, 0, 121, 131, 32, 0, 0, 0, 0, 0, 191,
97, 0, 0, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 207,
255, 0, 0, 0, 0, 5, 0, 248, 255, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 121, 161, 248, 255, 0,
0, 0, 0, 21, 1, 203, 255, 0, 0, 17, 0, 121, 161, 208, 255, 0, 0, 0, 0, 121, 162, 216, 255, 0,
0, 0, 0, 121, 163, 192, 255, 0, 0, 0, 0, 121, 164, 240, 255, 0, 0, 0, 0, 133, 16, 0, 0, 78, 0,
0, 0, 85, 0, 197, 255, 0, 0, 0, 0, 121, 162, 208, 255, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0,
121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 121,
163, 232, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 189, 255, 0, 0, 0, 0, 183, 7, 0, 0,
0, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0, 121, 24, 40, 0, 0, 0, 0, 0, 121, 22, 32, 0, 0, 0,
0, 0, 121, 169, 200, 255, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 29, 121, 8, 0, 0, 0, 0, 0,
121, 131, 32, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 141, 0,
0, 0, 3, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 21, 0, 248, 255, 0, 0, 0, 0, 7, 7, 0, 0, 255, 255,
255, 255, 191, 113, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 45, 25, 172, 255, 0, 0, 0, 0,
183, 7, 0, 0, 0, 0, 0, 0, 5, 0, 170, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 240,
255, 0, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 121, 161, 208, 255, 0, 0,
0, 0, 97, 18, 52, 0, 0, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 24, 40, 0, 0, 0, 0, 0,
121, 22, 32, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0, 255, 255, 255, 255, 21, 9, 6,
0, 0, 0, 0, 0, 121, 131, 32, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 121, 162, 248, 255, 0,
0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 153, 255, 0, 0, 0, 0, 5, 0, 248, 255, 0, 0, 0, 0,
183, 7, 0, 0, 1, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0, 21, 1, 149, 255, 0, 0, 17, 0, 121,
162, 208, 255, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24,
0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 121, 163, 232, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4,
0, 0, 0, 85, 0, 141, 255, 0, 0, 0, 0, 183, 9, 0, 0, 0, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0,
121, 24, 40, 0, 0, 0, 0, 0, 121, 22, 32, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 29,
145, 9, 0, 0, 0, 0, 0, 121, 131, 32, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 121, 162, 248,
255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 21, 0, 248, 255, 0, 0, 0, 0,
7, 9, 0, 0, 255, 255, 255, 255, 121, 161, 240, 255, 0, 0, 0, 0, 45, 145, 126, 255, 0, 0, 0, 0,
121, 161, 208, 255, 0, 0, 0, 0, 121, 162, 200, 255, 0, 0, 0, 0, 115, 33, 56, 0, 0, 0, 0, 0,
121, 162, 216, 255, 0, 0, 0, 0, 99, 33, 52, 0, 0, 0, 0, 0, 5, 0, 204, 255, 0, 0, 0, 0, 191, 70,
0, 0, 0, 0, 0, 0, 191, 55, 0, 0, 0, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0,
0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 21, 1, 7, 0, 0, 0, 17, 0, 121, 129,
32, 0, 0, 0, 0, 0, 121, 131, 40, 0, 0, 0, 0, 0, 121, 51, 32, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0,
0, 0, 191, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 2, 0, 0, 0, 0, 0, 183, 0, 0,
0, 0, 0, 0, 0, 85, 7, 1, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 129, 32, 0, 0, 0, 0, 0,
121, 130, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 191, 99,
0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 5, 0, 248, 255, 0, 0, 0, 0, 121, 20, 16, 0, 0, 0,
0, 0, 121, 21, 0, 0, 0, 0, 0, 0, 21, 5, 2, 0, 1, 0, 0, 0, 21, 4, 3, 0, 1, 0, 0, 0, 5, 0, 101,
0, 0, 0, 0, 0, 21, 4, 1, 0, 1, 0, 0, 0, 5, 0, 72, 0, 0, 0, 0, 0, 123, 90, 248, 255, 0, 0, 0, 0,
183, 5, 0, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 123, 58, 232, 255, 0, 0, 0, 0, 15, 52, 0,
0, 0, 0, 0, 0, 121, 19, 24, 0, 0, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 191, 40, 0, 0, 0, 0,
0, 0, 21, 3, 40, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 121, 168, 240, 255, 0, 0, 0, 0, 183,
7, 0, 0, 0, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 29, 73, 53, 0, 0, 0, 0, 0, 191, 152, 0, 0, 0,
0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 113, 144, 0, 0, 0, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 103, 6,
0, 0, 56, 0, 0, 0, 199, 6, 0, 0, 56, 0, 0, 0, 101, 6, 24, 0, 255, 255, 255, 255, 191, 152, 0,
0, 0, 0, 0, 0, 7, 8, 0, 0, 2, 0, 0, 0, 183, 2, 0, 0, 224, 0, 0, 0, 45, 2, 20, 0, 0, 0, 0, 0,
191, 152, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 3, 0, 0, 0, 183, 2, 0, 0, 240, 0, 0, 0, 45, 2, 16, 0,
0, 0, 0, 0, 113, 150, 1, 0, 0, 0, 0, 0, 87, 6, 0, 0, 63, 0, 0, 0, 103, 6, 0, 0, 12, 0, 0, 0,
113, 146, 2, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 103, 2, 0, 0, 6, 0, 0, 0, 79, 98, 0, 0,
0, 0, 0, 0, 113, 150, 3, 0, 0, 0, 0, 0, 87, 6, 0, 0, 63, 0, 0, 0, 79, 98, 0, 0, 0, 0, 0, 0,
103, 0, 0, 0, 18, 0, 0, 0, 87, 0, 0, 0, 0, 0, 28, 0, 79, 2, 0, 0, 0, 0, 0, 0, 191, 152, 0, 0,
0, 0, 0, 0, 7, 8, 0, 0, 4, 0, 0, 0, 21, 2, 22, 0, 0, 0, 17, 0, 7, 7, 0, 0, 1, 0, 0, 0, 31, 149,
0, 0, 0, 0, 0, 0, 15, 133, 0, 0, 0, 0, 0, 0, 45, 115, 219, 255, 0, 0, 0, 0, 29, 72, 17, 0, 0,
0, 0, 0, 113, 132, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 240, 0, 0, 0, 45, 66, 66, 0, 0, 0, 0, 0,
113, 130, 1, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 103, 2, 0, 0, 12, 0, 0, 0, 113, 131, 2,
0, 0, 0, 0, 0, 87, 3, 0, 0, 63, 0, 0, 0, 103, 3, 0, 0, 6, 0, 0, 0, 79, 35, 0, 0, 0, 0, 0, 0,
113, 130, 3, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 79, 35, 0, 0, 0, 0, 0, 0, 103, 4, 0, 0,
18, 0, 0, 0, 87, 4, 0, 0, 0, 0, 28, 0, 79, 67, 0, 0, 0, 0, 0, 0, 85, 3, 52, 0, 0, 0, 17, 0,
121, 163, 232, 255, 0, 0, 0, 0, 121, 162, 240, 255, 0, 0, 0, 0, 121, 164, 248, 255, 0, 0, 0, 0,
21, 4, 1, 0, 1, 0, 0, 0, 5, 0, 27, 0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 121, 25, 8, 0, 0,
0, 0, 0, 21, 3, 8, 0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 191, 52, 0, 0, 0, 0, 0, 0, 191, 37,
0, 0, 0, 0, 0, 0, 5, 0, 13, 0, 0, 0, 0, 0, 15, 8, 0, 0, 0, 0, 0, 0, 7, 5, 0, 0, 1, 0, 0, 0, 7,
4, 0, 0, 255, 255, 255, 255, 85, 4, 9, 0, 0, 0, 0, 0, 61, 152, 15, 0, 0, 0, 0, 0, 123, 42, 240,
255, 0, 0, 0, 0, 123, 58, 232, 255, 0, 0, 0, 0, 113, 21, 56, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0,
0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 21, 5, 18, 0, 3, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 5, 0, 16,
0, 0, 0, 0, 0, 113, 86, 0, 0, 0, 0, 0, 0, 103, 6, 0, 0, 56, 0, 0, 0, 199, 6, 0, 0, 56, 0, 0, 0,
183, 0, 0, 0, 1, 0, 0, 0, 101, 6, 238, 255, 191, 255, 255, 255, 183, 0, 0, 0, 0, 0, 0, 0, 5, 0,
236, 255, 0, 0, 0, 0, 121, 21, 32, 0, 0, 0, 0, 0, 121, 17, 40, 0, 0, 0, 0, 0, 121, 20, 24, 0,
0, 0, 0, 0, 191, 81, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 87,
6, 0, 0, 1, 0, 0, 0, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 31, 137, 0, 0, 0, 0,
0, 0, 87, 4, 0, 0, 3, 0, 0, 0, 123, 154, 224, 255, 0, 0, 0, 0, 21, 4, 19, 0, 0, 0, 0, 0, 21, 4,
15, 0, 1, 0, 0, 0, 191, 151, 0, 0, 0, 0, 0, 0, 119, 7, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0,
0, 119, 9, 0, 0, 1, 0, 0, 0, 123, 154, 224, 255, 0, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 183, 3,
0, 0, 0, 0, 0, 0, 121, 166, 232, 255, 0, 0, 0, 0, 121, 167, 240, 255, 0, 0, 0, 0, 21, 5, 59, 0,
0, 0, 0, 0, 45, 86, 49, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 29,
101, 55, 0, 0, 0, 0, 0, 5, 0, 56, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 123, 42, 224, 255,
0, 0, 0, 0, 191, 151, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 97, 24, 52, 0, 0, 0, 0, 0, 121,
18, 40, 0, 0, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 25, 32, 0, 0, 0, 0, 0, 183, 6, 0, 0,
1, 0, 0, 0, 7, 7, 0, 0, 255, 255, 255, 255, 21, 7, 7, 0, 0, 0, 0, 0, 121, 161, 248, 255, 0, 0,
0, 0, 121, 19, 32, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 141,
0, 0, 0, 3, 0, 0, 0, 85, 0, 216, 255, 0, 0, 0, 0, 5, 0, 247, 255, 0, 0, 0, 0, 183, 6, 0, 0, 1,
0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 21, 1, 212, 255, 0, 0, 17, 0, 121, 161, 248, 255, 0, 0, 0,
0, 121, 20, 24, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 121, 162, 240, 255, 0, 0, 0, 0, 121,
163, 232, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 205, 255, 0, 0, 0, 0, 183, 6, 0, 0,
0, 0, 0, 0, 121, 167, 224, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 29, 103, 9, 0, 0, 0, 0,
0, 121, 161, 248, 255, 0, 0, 0, 0, 121, 19, 32, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191,
130, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 21, 0, 247, 255, 0, 0,
0, 0, 7, 6, 0, 0, 255, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 45,
23, 190, 255, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 5, 0, 188, 255, 0, 0, 0, 0, 191, 114, 0, 0,
0, 0, 0, 0, 15, 82, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 113, 34, 0, 0, 0, 0, 0, 0, 103,
2, 0, 0, 56, 0, 0, 0, 199, 2, 0, 0, 56, 0, 0, 0, 183, 0, 0, 0, 192, 255, 255, 255, 191, 83, 0,
0, 0, 0, 0, 0, 109, 32, 2, 0, 0, 0, 0, 0, 191, 53, 0, 0, 0, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0,
0, 21, 4, 1, 0, 0, 0, 0, 0, 191, 86, 0, 0, 0, 0, 0, 0, 123, 106, 232, 255, 0, 0, 0, 0, 21, 4,
1, 0, 0, 0, 0, 0, 191, 71, 0, 0, 0, 0, 0, 0, 123, 122, 240, 255, 0, 0, 0, 0, 5, 0, 132, 255, 0,
0, 0, 0, 121, 20, 32, 0, 0, 0, 0, 0, 121, 17, 40, 0, 0, 0, 0, 0, 121, 21, 24, 0, 0, 0, 0, 0,
191, 65, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 5, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 22, 40, 0,
0, 0, 0, 0, 121, 23, 32, 0, 0, 0, 0, 0, 191, 168, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 208, 255, 255,
255, 191, 129, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 205, 6, 0, 0, 191,
113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0,
157, 253, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 97, 16, 48, 0, 0, 0, 0, 0, 87, 0, 0, 0, 16, 0, 0,
0, 119, 0, 0, 0, 4, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 97, 16, 48, 0, 0, 0, 0, 0, 87, 0, 0, 0,
32, 0, 0, 0, 119, 0, 0, 0, 5, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0,
191, 23, 0, 0, 0, 0, 0, 0, 121, 97, 40, 0, 0, 0, 0, 0, 121, 21, 24, 0, 0, 0, 0, 0, 121, 97, 32,
0, 0, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 5, 0, 0, 0,
183, 1, 0, 0, 1, 0, 0, 0, 85, 0, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 103, 0, 0, 0,
0, 0, 0, 123, 23, 8, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 191,
23, 0, 0, 0, 0, 0, 0, 121, 97, 40, 0, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 97, 32, 0,
0, 0, 0, 0, 183, 8, 0, 0, 1, 0, 0, 0, 24, 2, 0, 0, 200, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 1, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 1, 0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0,
0, 123, 103, 0, 0, 0, 0, 0, 0, 123, 135, 8, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 36,
0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 254, 254, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 121,
33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 35, 32, 0, 0, 0, 0, 0, 123, 26, 224,
255, 0, 0, 0, 0, 183, 2, 0, 0, 39, 0, 0, 0, 123, 58, 216, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0,
0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 0, 86, 0, 0, 0, 0, 0, 97, 130, 0, 0, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 232, 255, 255, 255, 183, 3, 0, 0, 1, 1, 0, 0, 133, 16, 0, 0, 23,
249, 255, 255, 113, 169, 252, 255, 0, 0, 0, 0, 97, 161, 248, 255, 0, 0, 0, 0, 123, 26, 200,
255, 0, 0, 0, 0, 121, 166, 240, 255, 0, 0, 0, 0, 97, 168, 232, 255, 0, 0, 0, 0, 97, 161, 236,
255, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 17, 0, 183, 7, 0, 0, 1, 0,
0, 0, 5, 0, 16, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 5, 0, 71, 0, 0, 0, 0, 0, 21, 3, 6, 0,
1, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 183, 2, 0, 0, 39, 0, 0, 0, 121, 163, 216, 255, 0,
0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 5, 0, 62, 0, 0, 0, 0, 0, 183, 8,
0, 0, 0, 0, 0, 0, 121, 162, 208, 255, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 121, 161, 224,
255, 0, 0, 0, 0, 121, 163, 216, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 55, 0, 0, 0,
0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 103, 8, 0, 0, 32, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 119, 3,
0, 0, 32, 0, 0, 0, 101, 3, 1, 0, 1, 0, 0, 0, 5, 0, 236, 255, 0, 0, 0, 0, 183, 8, 0, 0, 1, 0, 0,
0, 183, 2, 0, 0, 92, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 21, 3, 242, 255, 2, 0, 0, 0, 183, 8,
0, 0, 3, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 255, 0, 0, 0, 101, 3, 6, 0, 2, 0, 0,
0, 183, 9, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 125, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 21, 3, 234,
255, 1, 0, 0, 0, 21, 3, 5, 0, 2, 0, 0, 0, 5, 0, 223, 255, 0, 0, 0, 0, 21, 3, 20, 0, 3, 0, 0, 0,
21, 3, 22, 0, 4, 0, 0, 0, 183, 9, 0, 0, 4, 0, 0, 0, 5, 0, 227, 255, 0, 0, 0, 0, 191, 18, 0, 0,
0, 0, 0, 0, 103, 2, 0, 0, 2, 0, 0, 0, 87, 2, 0, 0, 28, 0, 0, 0, 121, 163, 200, 255, 0, 0, 0, 0,
127, 35, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 15, 0, 0, 0, 183, 2, 0, 0, 48, 0, 0, 0, 183, 4, 0, 0,
10, 0, 0, 0, 45, 52, 1, 0, 0, 0, 0, 0, 183, 2, 0, 0, 87, 0, 0, 0, 15, 50, 0, 0, 0, 0, 0, 0,
183, 6, 0, 0, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 21, 1, 214, 255, 0, 0, 0, 0, 183, 9, 0, 0,
2, 0, 0, 0, 7, 1, 0, 0, 255, 255, 255, 255, 5, 0, 210, 255, 0, 0, 0, 0, 183, 9, 0, 0, 2, 0, 0,
0, 183, 2, 0, 0, 123, 0, 0, 0, 5, 0, 207, 255, 0, 0, 0, 0, 183, 8, 0, 0, 3, 0, 0, 0, 183, 2, 0,
0, 117, 0, 0, 0, 183, 9, 0, 0, 3, 0, 0, 0, 5, 0, 203, 255, 0, 0, 0, 0, 183, 9, 0, 0, 2, 0, 0,
0, 183, 2, 0, 0, 123, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 121,
163, 216, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 21, 0, 2, 0, 0, 0, 0, 0, 191, 112, 0, 0,
0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 92, 0, 0, 0,
103, 8, 0, 0, 32, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 183, 8, 0, 0,
1, 0, 0, 0, 21, 3, 243, 255, 2, 0, 0, 0, 21, 3, 1, 0, 3, 0, 0, 0, 5, 0, 177, 255, 0, 0, 0, 0,
183, 8, 0, 0, 3, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 255, 0, 0, 0, 101, 3, 6, 0,
2, 0, 0, 0, 183, 9, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 125, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0,
21, 3, 233, 255, 1, 0, 0, 0, 21, 3, 5, 0, 2, 0, 0, 0, 5, 0, 167, 255, 0, 0, 0, 0, 21, 3, 227,
255, 3, 0, 0, 0, 21, 3, 19, 0, 4, 0, 0, 0, 183, 9, 0, 0, 4, 0, 0, 0, 5, 0, 226, 255, 0, 0, 0,
0, 191, 18, 0, 0, 0, 0, 0, 0, 103, 2, 0, 0, 2, 0, 0, 0, 87, 2, 0, 0, 28, 0, 0, 0, 121, 163,
200, 255, 0, 0, 0, 0, 127, 35, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 15, 0, 0, 0, 183, 2, 0, 0, 48, 0,
0, 0, 183, 4, 0, 0, 10, 0, 0, 0, 45, 52, 1, 0, 0, 0, 0, 0, 183, 2, 0, 0, 87, 0, 0, 0, 15, 50,
0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 21, 1, 213, 255, 0, 0, 0,
0, 183, 9, 0, 0, 2, 0, 0, 0, 7, 1, 0, 0, 255, 255, 255, 255, 5, 0, 209, 255, 0, 0, 0, 0, 183,
8, 0, 0, 3, 0, 0, 0, 183, 2, 0, 0, 117, 0, 0, 0, 183, 9, 0, 0, 3, 0, 0, 0, 5, 0, 205, 255, 0,
0, 0, 0, 123, 42, 168, 255, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0,
123, 26, 192, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123,
26, 184, 255, 0, 0, 0, 0, 24, 1, 0, 0, 136, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 176,
255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 168, 255, 255, 255, 123, 26, 240, 255,
0, 0, 0, 0, 24, 1, 0, 0, 32, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0,
123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123,
26, 224, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 191, 50,
0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 208, 249, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 123,
42, 168, 255, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 224, 255, 255, 255, 123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 192,
255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0,
0, 0, 0, 24, 1, 0, 0, 168, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0,
191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 168, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 24,
1, 0, 0, 32, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 123, 26, 232,
255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 224, 255,
0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 191, 50, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 180, 249, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 123, 42, 168, 255, 0,
0, 0, 0, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255,
255, 123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0,
183, 1, 0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 24, 1,
0, 0, 200, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 168, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0, 0, 32, 198,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0,
191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 191, 50, 0, 0, 0, 0, 0, 0, 133, 16, 0,
0, 152, 249, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 123, 26, 248, 255, 0, 0, 0, 0, 191,
49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 241, 255, 255, 255, 183, 4, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0,
1, 0, 0, 0, 45, 49, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 85, 5, 1, 0, 0, 0, 0, 0, 191,
20, 0, 0, 0, 0, 0, 0, 21, 3, 101, 0, 0, 0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 7, 5, 0, 0, 7, 0,
0, 0, 87, 5, 0, 0, 248, 255, 255, 255, 31, 37, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 24,
7, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 128, 128, 128, 128, 183, 8, 0, 0, 0, 0, 0, 0, 5, 0,
61, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 15, 6, 0, 0, 0, 0, 0, 0, 113, 96, 0, 0, 0, 0, 0,
0, 21, 9, 29, 0, 224, 0, 0, 0, 21, 9, 33, 0, 237, 0, 0, 0, 191, 150, 0, 0, 0, 0, 0, 0, 7, 6, 0,
0, 31, 0, 0, 0, 87, 6, 0, 0, 255, 0, 0, 0, 183, 7, 0, 0, 12, 0, 0, 0, 45, 103, 1, 0, 0, 0, 0,
0, 5, 0, 37, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 103, 9, 0, 0,
56, 0, 0, 0, 199, 9, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 9, 185, 0, 255, 255,
255, 255, 183, 7, 0, 0, 1, 0, 0, 0, 37, 0, 183, 0, 191, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 191,
137, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 2, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 61, 57, 178, 0, 0, 0,
0, 0, 191, 32, 0, 0, 0, 0, 0, 0, 15, 144, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 2, 0, 0, 0, 113, 0,
0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0,
0, 101, 0, 170, 0, 191, 255, 255, 255, 5, 0, 163, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 87,
0, 0, 0, 224, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 21, 0, 238, 255, 160, 0, 0, 0, 5, 0, 164, 0,
0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 103, 9, 0, 0, 56, 0, 0, 0, 199,
9, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 9, 158, 0, 255, 255, 255, 255, 183, 7, 0,
0, 1, 0, 0, 0, 183, 9, 0, 0, 160, 0, 0, 0, 45, 9, 228, 255, 0, 0, 0, 0, 5, 0, 154, 0, 0, 0, 0,
0, 183, 6, 0, 0, 1, 0, 0, 0, 87, 9, 0, 0, 254, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 9, 150,
0, 238, 0, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 103, 9, 0, 0, 56, 0, 0, 0, 199, 9, 0, 0, 56, 0, 0,
0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 9, 145, 0, 255, 255, 255, 255, 183, 7, 0, 0, 1, 0, 0, 0, 183,
9, 0, 0, 192, 0, 0, 0, 45, 9, 215, 255, 0, 0, 0, 0, 5, 0, 141, 0, 0, 0, 0, 0, 191, 32, 0, 0, 0,
0, 0, 0, 15, 128, 0, 0, 0, 0, 0, 0, 113, 9, 0, 0, 0, 0, 0, 0, 191, 144, 0, 0, 0, 0, 0, 0, 103,
0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0, 0, 109, 1, 33, 0, 0, 0, 0, 0, 21, 5, 29, 0, 255,
255, 255, 255, 191, 80, 0, 0, 0, 0, 0, 0, 31, 128, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 7, 0, 0, 0,
85, 0, 25, 0, 0, 0, 0, 0, 61, 72, 9, 0, 0, 0, 0, 0, 191, 32, 0, 0, 0, 0, 0, 0, 15, 128, 0, 0,
0, 0, 0, 0, 121, 6, 8, 0, 0, 0, 0, 0, 121, 0, 0, 0, 0, 0, 0, 0, 79, 96, 0, 0, 0, 0, 0, 0, 95,
112, 0, 0, 0, 0, 0, 0, 85, 0, 2, 0, 0, 0, 0, 0, 7, 8, 0, 0, 16, 0, 0, 0, 45, 132, 247, 255, 0,
0, 0, 0, 61, 56, 15, 0, 0, 0, 0, 0, 191, 32, 0, 0, 0, 0, 0, 0, 15, 128, 0, 0, 0, 0, 0, 0, 113,
0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0, 0, 109, 1, 9, 0, 0, 0,
0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 45, 131, 248, 255, 0, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0,
123, 49, 16, 0, 0, 0, 0, 0, 191, 19, 0, 0, 0, 0, 0, 0, 123, 35, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0,
0, 0, 0, 0, 5, 0, 112, 0, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 45, 131, 217, 255, 0, 0, 0, 0, 5,
0, 247, 255, 0, 0, 0, 0, 24, 0, 0, 0, 41, 219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 144, 0, 0, 0,
0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 21, 0, 19, 0, 4, 0, 0, 0, 21, 0, 42, 0, 3, 0, 0, 0, 183, 6,
0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 85, 0, 92, 0, 2, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0,
191, 137, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 45, 147, 1, 0, 0,
0, 0, 0, 5, 0, 86, 0, 0, 0, 0, 0, 191, 32, 0, 0, 0, 0, 0, 0, 15, 144, 0, 0, 0, 0, 0, 0, 183, 6,
0, 0, 1, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0,
0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 0, 78, 0, 191, 255, 255, 255, 5, 0, 71, 0, 0, 0, 0, 0, 183,
6, 0, 0, 0, 0, 0, 0, 191, 128, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0,
0, 61, 48, 72, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 15, 6, 0, 0, 0, 0, 0, 0, 113, 96, 0,
0, 0, 0, 0, 0, 21, 9, 21, 0, 240, 0, 0, 0, 21, 9, 27, 0, 244, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0,
0, 7, 9, 0, 0, 15, 0, 0, 0, 87, 9, 0, 0, 255, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 37, 9, 62, 0,
2, 0, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 103, 9, 0, 0, 56, 0, 0, 0, 199, 9, 0, 0, 56, 0, 0, 0,
183, 7, 0, 0, 1, 0, 0, 0, 101, 9, 57, 0, 255, 255, 255, 255, 183, 7, 0, 0, 1, 0, 0, 0, 183, 9,
0, 0, 192, 0, 0, 0, 45, 9, 22, 0, 0, 0, 0, 0, 5, 0, 53, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0,
0, 191, 128, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 45, 3, 102,
255, 0, 0, 0, 0, 5, 0, 47, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 112, 0, 0, 0,
87, 0, 0, 0, 255, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 183, 9, 0, 0, 48, 0, 0, 0, 45, 9, 9, 0, 0,
0, 0, 0, 5, 0, 40, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 191, 9, 0, 0, 0, 0, 0, 0, 103, 9,
0, 0, 56, 0, 0, 0, 199, 9, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 9, 34, 0, 255,
255, 255, 255, 183, 7, 0, 0, 1, 0, 0, 0, 37, 0, 32, 0, 143, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0,
191, 128, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 61, 48, 27, 0, 0,
0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 15, 7, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 2, 0, 0, 0, 113,
112, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0, 1,
0, 0, 0, 101, 0, 19, 0, 191, 255, 255, 255, 183, 6, 0, 0, 0, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0,
0, 7, 9, 0, 0, 3, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 61, 57, 14, 0, 0, 0, 0, 0, 191, 32, 0, 0,
0, 0, 0, 0, 15, 144, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 3, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 103,
0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 101, 0, 6, 0, 191,
255, 255, 255, 7, 9, 0, 0, 1, 0, 0, 0, 191, 152, 0, 0, 0, 0, 0, 0, 24, 7, 0, 0, 128, 128, 128,
128, 0, 0, 0, 0, 128, 128, 128, 128, 45, 131, 116, 255, 0, 0, 0, 0, 5, 0, 146, 255, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 121, 163, 248, 255, 0, 0, 0, 0, 115, 19, 23, 0, 0, 0, 0, 0, 107, 19,
21, 0, 0, 0, 0, 0, 99, 99, 17, 0, 0, 0, 0, 0, 115, 115, 16, 0, 0, 0, 0, 0, 123, 131, 8, 0, 0,
0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 123, 19, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 123,
74, 56, 255, 0, 0, 0, 0, 123, 58, 48, 255, 0, 0, 0, 0, 24, 6, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 1, 0, 0, 191, 41, 0, 0, 0, 0, 0, 0, 45,
32, 9, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 1, 0, 0, 183, 8, 0, 0, 192, 255, 255, 255, 183, 9, 0, 0,
0, 0, 0, 0, 183, 7, 0, 0, 5, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 24, 6, 0, 0, 41, 220, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 255, 255, 255, 255, 85, 0, 8, 0, 0, 0, 0, 0, 123, 154, 72,
255, 0, 0, 0, 0, 123, 26, 64, 255, 0, 0, 0, 0, 123, 122, 88, 255, 0, 0, 0, 0, 123, 106, 80,
255, 0, 0, 0, 0, 45, 35, 22, 0, 0, 0, 0, 0, 45, 36, 21, 0, 0, 0, 0, 0, 45, 67, 50, 0, 0, 0, 0,
0, 5, 0, 80, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 15, 6, 0, 0, 0, 0, 0, 0, 113, 102, 0, 0,
0, 0, 0, 0, 103, 6, 0, 0, 56, 0, 0, 0, 199, 6, 0, 0, 56, 0, 0, 0, 109, 104, 238, 255, 0, 0, 0,
0, 24, 6, 0, 0, 41, 220, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 5, 0, 0, 0, 191, 9, 0, 0,
0, 0, 0, 0, 45, 2, 237, 255, 0, 0, 0, 0, 191, 41, 0, 0, 0, 0, 0, 0, 29, 2, 235, 255, 0, 0, 0,
0, 183, 3, 0, 0, 0, 0, 0, 0, 191, 4, 0, 0, 0, 0, 0, 0, 24, 5, 0, 0, 232, 233, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 133, 16, 0, 0, 213, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 45, 35, 1, 0,
0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 123, 58, 112, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 176, 255, 255, 255, 123, 26, 160, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0,
123, 26, 144, 255, 0, 0, 0, 0, 183, 1, 0, 0, 3, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 123,
26, 136, 255, 0, 0, 0, 0, 24, 1, 0, 0, 0, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 128, 255,
0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 80, 255, 255, 255, 123, 26, 208, 255, 0, 0,
0, 0, 24, 1, 0, 0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123,
26, 200, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 64, 255, 255, 255, 123, 26,
192, 255, 0, 0, 0, 0, 24, 1, 0, 0, 32, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 184, 255, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 112, 255, 255, 255, 5, 0, 142, 0, 0, 0, 0, 0,
191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 123, 26, 160, 255, 0, 0, 0, 0, 183,
1, 0, 0, 0, 0, 0, 0, 123, 26, 144, 255, 0, 0, 0, 0, 183, 1, 0, 0, 4, 0, 0, 0, 123, 26, 168,
255, 0, 0, 0, 0, 123, 26, 136, 255, 0, 0, 0, 0, 24, 1, 0, 0, 48, 234, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 123, 26, 128, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 80, 255, 255, 255,
123, 26, 224, 255, 0, 0, 0, 0, 24, 1, 0, 0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 232,
255, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 64,
255, 255, 255, 123, 26, 208, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 56, 255,
255, 255, 123, 26, 192, 255, 0, 0, 0, 0, 24, 1, 0, 0, 32, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123, 26, 200, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1,
0, 0, 48, 255, 255, 255, 5, 0, 111, 0, 0, 0, 0, 0, 21, 3, 10, 0, 0, 0, 0, 0, 45, 50, 2, 0, 0,
0, 0, 0, 29, 50, 8, 0, 0, 0, 0, 0, 5, 0, 8, 0, 0, 0, 0, 0, 191, 16, 0, 0, 0, 0, 0, 0, 15, 48,
0, 0, 0, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 56, 0, 0, 0, 199, 0, 0, 0, 56, 0, 0,
0, 183, 6, 0, 0, 192, 255, 255, 255, 109, 6, 1, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 123,
58, 96, 255, 0, 0, 0, 0, 21, 3, 12, 0, 0, 0, 0, 0, 45, 50, 2, 0, 0, 0, 0, 0, 29, 50, 46, 0, 0,
0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 15, 52, 0, 0, 0, 0, 0, 0, 113, 68,
0, 0, 0, 0, 0, 0, 103, 4, 0, 0, 56, 0, 0, 0, 199, 4, 0, 0, 56, 0, 0, 0, 101, 4, 4, 0, 191, 255,
255, 255, 7, 3, 0, 0, 255, 255, 255, 255, 21, 3, 1, 0, 0, 0, 0, 0, 5, 0, 244, 255, 0, 0, 0, 0,
183, 3, 0, 0, 0, 0, 0, 0, 29, 35, 34, 0, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0, 0, 0, 113, 16, 0, 0,
0, 0, 0, 0, 191, 2, 0, 0, 0, 0, 0, 0, 103, 2, 0, 0, 56, 0, 0, 0, 199, 2, 0, 0, 56, 0, 0, 0,
101, 2, 34, 0, 255, 255, 255, 255, 113, 18, 1, 0, 0, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 191, 4,
0, 0, 0, 0, 0, 0, 87, 4, 0, 0, 31, 0, 0, 0, 191, 70, 0, 0, 0, 0, 0, 0, 103, 6, 0, 0, 6, 0, 0,
0, 79, 38, 0, 0, 0, 0, 0, 0, 37, 0, 1, 0, 223, 0, 0, 0, 5, 0, 74, 0, 0, 0, 0, 0, 103, 2, 0, 0,
6, 0, 0, 0, 113, 22, 2, 0, 0, 0, 0, 0, 87, 6, 0, 0, 63, 0, 0, 0, 79, 98, 0, 0, 0, 0, 0, 0, 191,
71, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 12, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 79, 118, 0, 0, 0,
0, 0, 0, 183, 7, 0, 0, 240, 0, 0, 0, 45, 7, 64, 0, 0, 0, 0, 0, 103, 2, 0, 0, 6, 0, 0, 0, 113,
17, 3, 0, 0, 0, 0, 0, 87, 1, 0, 0, 63, 0, 0, 0, 79, 18, 0, 0, 0, 0, 0, 0, 103, 4, 0, 0, 18, 0,
0, 0, 87, 4, 0, 0, 0, 0, 28, 0, 79, 66, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 85, 2, 55,
0, 0, 0, 17, 0, 24, 1, 0, 0, 4, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 43, 0, 0, 0,
191, 83, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 214, 247, 255, 255, 133, 16, 0, 0, 255, 255, 255,
255, 99, 10, 108, 255, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 123, 58, 112, 255, 0, 0, 0, 0, 15,
49, 0, 0, 0, 0, 0, 0, 123, 26, 120, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
176, 255, 255, 255, 123, 26, 160, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 144, 255,
0, 0, 0, 0, 183, 1, 0, 0, 5, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 123, 26, 136, 255, 0, 0,
0, 0, 24, 1, 0, 0, 112, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 128, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 80, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0,
0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 64, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0,
0, 24, 1, 0, 0, 40, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 112, 255, 255, 255, 123, 26, 208, 255, 0, 0, 0, 0, 24, 1, 0, 0,
40, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 108, 255, 255, 255, 123, 26, 192, 255, 0, 0, 0, 0, 24, 1, 0, 0, 32, 198, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
96, 255, 255, 255, 123, 26, 176, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128,
255, 255, 255, 191, 82, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 211, 247, 255, 255, 133, 16, 0, 0,
255, 255, 255, 255, 183, 1, 0, 0, 1, 0, 0, 0, 99, 106, 108, 255, 0, 0, 0, 0, 183, 2, 0, 0, 128,
0, 0, 0, 45, 98, 205, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 183, 2, 0, 0, 0, 8, 0, 0, 45,
98, 202, 255, 0, 0, 0, 0, 183, 1, 0, 0, 3, 0, 0, 0, 183, 2, 0, 0, 0, 0, 1, 0, 45, 98, 199, 255,
0, 0, 0, 0, 183, 1, 0, 0, 4, 0, 0, 0, 5, 0, 197, 255, 0, 0, 0, 0, 191, 25, 0, 0, 0, 0, 0, 0,
121, 81, 16, 240, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 121, 86, 8, 240, 0, 0, 0, 0, 21,
3, 42, 0, 0, 0, 0, 0, 103, 3, 0, 0, 1, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0,
0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 121, 88, 0, 240, 0, 0, 0, 0, 191, 147, 0, 0, 0, 0, 0, 0,
87, 3, 0, 0, 0, 255, 0, 0, 119, 3, 0, 0, 8, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 123, 74, 224,
255, 0, 0, 0, 0, 123, 138, 232, 255, 0, 0, 0, 0, 5, 0, 4, 0, 0, 0, 0, 0, 45, 49, 29, 0, 0, 0,
0, 0, 191, 80, 0, 0, 0, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0, 29, 18, 26, 0, 0, 0, 0, 0,
113, 39, 1, 0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 15, 117, 0, 0, 0, 0, 0, 0, 113, 33, 0, 0,
0, 0, 0, 0, 7, 2, 0, 0, 2, 0, 0, 0, 29, 49, 1, 0, 0, 0, 0, 0, 5, 0, 245, 255, 0, 0, 0, 0, 45,
80, 57, 0, 0, 0, 0, 0, 45, 133, 62, 0, 0, 0, 0, 0, 15, 4, 0, 0, 0, 0, 0, 0, 21, 7, 9, 0, 0, 0,
0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 255, 255, 255, 255, 191, 145, 0, 0, 0, 0, 0, 0, 87,
1, 0, 0, 255, 0, 0, 0, 113, 72, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 93, 24, 248, 255, 0,
0, 0, 0, 87, 0, 0, 0, 1, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 80, 0, 0, 0, 0, 0, 0, 121,
164, 224, 255, 0, 0, 0, 0, 121, 168, 232, 255, 0, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0, 29,
18, 1, 0, 0, 0, 0, 0, 5, 0, 230, 255, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 121, 161, 240, 255,
0, 0, 0, 0, 21, 1, 245, 255, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0,
0, 0, 15, 18, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 87, 9, 0, 0, 255, 255, 0, 0, 183, 3,
0, 0, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 191, 86, 0, 0, 0, 0, 0, 0, 31, 73, 0, 0, 0, 0, 0, 0,
103, 9, 0, 0, 32, 0, 0, 0, 199, 9, 0, 0, 32, 0, 0, 0, 109, 147, 233, 255, 0, 0, 0, 0, 167, 0,
0, 0, 1, 0, 0, 0, 29, 38, 231, 255, 0, 0, 0, 0, 191, 101, 0, 0, 0, 0, 0, 0, 7, 5, 0, 0, 1, 0,
0, 0, 113, 100, 0, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 56, 0, 0, 0, 199, 1,
0, 0, 56, 0, 0, 0, 109, 19, 1, 0, 0, 0, 0, 0, 5, 0, 241, 255, 0, 0, 0, 0, 93, 37, 7, 0, 0, 0,
0, 0, 24, 1, 0, 0, 4, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 43, 0, 0, 0, 24, 3, 0,
0, 216, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 73, 247, 255, 255, 133, 16, 0, 0,
255, 255, 255, 255, 87, 4, 0, 0, 127, 0, 0, 0, 103, 4, 0, 0, 8, 0, 0, 0, 113, 97, 1, 0, 0, 0,
0, 0, 79, 20, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 2, 0, 0, 0, 5, 0, 228, 255, 0, 0, 0, 0, 191, 1, 0,
0, 0, 0, 0, 0, 191, 82, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 192, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 184, 253, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 191, 81, 0, 0, 0, 0, 0,
0, 121, 162, 232, 255, 0, 0, 0, 0, 24, 3, 0, 0, 192, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 150, 253, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 183, 3, 0, 0, 0, 0, 0, 0, 113,
20, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 10, 0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0,
0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 128, 255, 255, 255, 15, 48, 0, 0, 0, 0, 0, 0, 115,
80, 127, 0, 0, 0, 0, 0, 7, 3, 0, 0, 255, 255, 255, 255, 191, 69, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0,
255, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 119, 4, 0, 0, 4, 0, 0, 0, 37, 5, 9, 0, 15, 0, 0, 0,
191, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 183, 4, 0, 0, 129, 0, 0, 0, 45, 20, 11, 0,
0, 0, 0, 0, 183, 2, 0, 0, 128, 0, 0, 0, 24, 3, 0, 0, 40, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 98, 253, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 191, 64, 0, 0, 0, 0, 0, 0,
87, 0, 0, 0, 15, 0, 0, 0, 183, 5, 0, 0, 48, 0, 0, 0, 45, 1, 232, 255, 0, 0, 0, 0, 183, 5, 0, 0,
87, 0, 0, 0, 5, 0, 230, 255, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 0, 0,
123, 26, 8, 240, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 255, 255, 255, 15,
49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0,
0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 229, 217, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 2, 0, 0, 0, 133, 16, 0, 0, 190, 250, 255, 255, 149, 0, 0, 0,
0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 113, 20, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 10, 0, 0, 0, 5,
0, 20, 0, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 128,
255, 255, 255, 15, 48, 0, 0, 0, 0, 0, 0, 115, 80, 127, 0, 0, 0, 0, 0, 7, 3, 0, 0, 255, 255,
255, 255, 191, 69, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0, 255, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 119,
4, 0, 0, 4, 0, 0, 0, 37, 5, 9, 0, 15, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0,
0, 0, 183, 4, 0, 0, 129, 0, 0, 0, 45, 20, 11, 0, 0, 0, 0, 0, 183, 2, 0, 0, 128, 0, 0, 0, 24, 3,
0, 0, 40, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 52, 253, 255, 255, 133, 16, 0, 0,
255, 255, 255, 255, 191, 64, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 15, 0, 0, 0, 183, 5, 0, 0, 48, 0,
0, 0, 45, 1, 232, 255, 0, 0, 0, 0, 183, 5, 0, 0, 55, 0, 0, 0, 5, 0, 230, 255, 0, 0, 0, 0, 191,
49, 0, 0, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 0, 0, 123, 26, 8, 240, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 128, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0,
123, 26, 0, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0,
0, 1, 0, 0, 0, 24, 3, 0, 0, 229, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 2, 0, 0, 0,
133, 16, 0, 0, 144, 250, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 97, 35, 48, 0, 0, 0, 0, 0, 191,
52, 0, 0, 0, 0, 0, 0, 87, 4, 0, 0, 16, 0, 0, 0, 85, 4, 16, 0, 0, 0, 0, 0, 87, 3, 0, 0, 32, 0,
0, 0, 21, 3, 1, 0, 0, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 113, 17, 0, 0, 0, 0, 0, 0, 37, 1, 82,
0, 99, 0, 0, 0, 183, 3, 0, 0, 38, 0, 0, 0, 183, 4, 0, 0, 10, 0, 0, 0, 45, 20, 93, 0, 0, 0, 0,
0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0,
0, 0, 0, 0, 105, 49, 0, 0, 0, 0, 0, 0, 107, 26, 165, 255, 0, 0, 0, 0, 183, 3, 0, 0, 37, 0, 0,
0, 5, 0, 90, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 113, 20, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0,
10, 0, 0, 0, 5, 0, 46, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 113, 20, 0, 0, 0, 0, 0, 0, 183,
1, 0, 0, 10, 0, 0, 0, 5, 0, 16, 0, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 191, 160, 0, 0, 0, 0,
0, 0, 7, 0, 0, 0, 128, 255, 255, 255, 15, 48, 0, 0, 0, 0, 0, 0, 115, 80, 127, 0, 0, 0, 0, 0, 7,
3, 0, 0, 255, 255, 255, 255, 191, 69, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0, 255, 0, 0, 0, 191, 84, 0,
0, 0, 0, 0, 0, 119, 4, 0, 0, 4, 0, 0, 0, 37, 5, 5, 0, 15, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0,
7, 1, 0, 0, 128, 0, 0, 0, 183, 4, 0, 0, 129, 0, 0, 0, 45, 20, 33, 0, 0, 0, 0, 0, 5, 0, 21, 0,
0, 0, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 15, 0, 0, 0, 183, 5, 0, 0, 48, 0, 0, 0, 45,
1, 236, 255, 0, 0, 0, 0, 183, 5, 0, 0, 55, 0, 0, 0, 5, 0, 234, 255, 0, 0, 0, 0, 15, 5, 0, 0, 0,
0, 0, 0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 128, 255, 255, 255, 15, 48, 0, 0, 0, 0, 0, 0,
115, 80, 127, 0, 0, 0, 0, 0, 7, 3, 0, 0, 255, 255, 255, 255, 191, 69, 0, 0, 0, 0, 0, 0, 87, 5,
0, 0, 255, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 119, 4, 0, 0, 4, 0, 0, 0, 37, 5, 9, 0, 15, 0, 0,
0, 191, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 183, 4, 0, 0, 129, 0, 0, 0, 45, 20, 11,
0, 0, 0, 0, 0, 183, 2, 0, 0, 128, 0, 0, 0, 24, 3, 0, 0, 40, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 216, 252, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 191, 64, 0, 0, 0, 0, 0,
0, 87, 0, 0, 0, 15, 0, 0, 0, 183, 5, 0, 0, 48, 0, 0, 0, 45, 1, 232, 255, 0, 0, 0, 0, 183, 5, 0,
0, 87, 0, 0, 0, 5, 0, 230, 255, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 0,
0, 123, 26, 8, 240, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 255, 255, 255, 15,
49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0,
0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 229, 217, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 2, 0, 0, 0, 5, 0, 32, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0,
0, 55, 4, 0, 0, 100, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 39, 3, 0, 0, 100, 0, 0, 0, 31, 49, 0,
0, 0, 0, 0, 0, 87, 1, 0, 0, 255, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 231, 217, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0, 105, 49, 0, 0, 0, 0, 0, 0, 107, 26, 165,
255, 0, 0, 0, 0, 183, 3, 0, 0, 36, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 191, 164, 0, 0, 0, 0, 0,
0, 7, 4, 0, 0, 128, 255, 255, 255, 15, 52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0, 0, 0, 115, 20,
0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 255, 255, 255, 15, 49, 0, 0, 0,
0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0, 39, 0, 0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 123,
26, 8, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1,
0, 0, 0, 24, 3, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 19, 250, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 97, 35, 48, 0, 0, 0, 0, 0, 191, 52, 0,
0, 0, 0, 0, 0, 87, 4, 0, 0, 16, 0, 0, 0, 85, 4, 50, 0, 0, 0, 0, 0, 87, 3, 0, 0, 32, 0, 0, 0,
21, 3, 1, 0, 0, 0, 0, 0, 5, 0, 51, 0, 0, 0, 0, 0, 183, 3, 0, 0, 39, 0, 0, 0, 121, 17, 0, 0, 0,
0, 0, 0, 183, 4, 0, 0, 16, 39, 0, 0, 45, 20, 32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191,
20, 0, 0, 0, 0, 0, 0, 55, 1, 0, 0, 16, 39, 0, 0, 191, 21, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 16,
39, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 31, 80, 0, 0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 87, 5,
0, 0, 255, 255, 0, 0, 55, 5, 0, 0, 100, 0, 0, 0, 191, 86, 0, 0, 0, 0, 0, 0, 39, 6, 0, 0, 100,
0, 0, 0, 31, 96, 0, 0, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 128, 255, 255, 255,
15, 54, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 1, 0, 0, 0, 24, 7, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 87, 0, 0, 0, 0, 0, 0, 105, 117, 0, 0, 0, 0, 0, 0, 107, 86, 35, 0, 0, 0, 0, 0, 87,
0, 0, 0, 255, 255, 0, 0, 103, 0, 0, 0, 1, 0, 0, 0, 24, 5, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0, 0, 0, 0, 0, 107, 86, 37, 0, 0, 0, 0, 0, 7, 3,
0, 0, 252, 255, 255, 255, 37, 4, 226, 255, 255, 224, 245, 5, 7, 3, 0, 0, 39, 0, 0, 0, 101, 1,
79, 0, 99, 0, 0, 0, 183, 4, 0, 0, 10, 0, 0, 0, 109, 20, 1, 0, 0, 0, 0, 0, 5, 0, 95, 0, 0, 0, 0,
0, 7, 3, 0, 0, 255, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 128, 255, 255, 255,
15, 52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0, 0, 0, 115, 20, 0, 0, 0, 0, 0, 0, 5, 0, 98, 0, 0,
0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 121, 21, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 10, 0, 0, 0, 5, 0,
43, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 121, 21, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 10, 0, 0,
0, 5, 0, 14, 0, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
128, 255, 255, 255, 15, 48, 0, 0, 0, 0, 0, 0, 115, 80, 127, 0, 0, 0, 0, 0, 7, 3, 0, 0, 255,
255, 255, 255, 191, 69, 0, 0, 0, 0, 0, 0, 119, 5, 0, 0, 4, 0, 0, 0, 37, 4, 5, 0, 15, 0, 0, 0,
191, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 183, 4, 0, 0, 129, 0, 0, 0, 45, 20, 33, 0,
0, 0, 0, 0, 5, 0, 20, 0, 0, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 87,
0, 0, 0, 15, 0, 0, 0, 183, 5, 0, 0, 48, 0, 0, 0, 45, 1, 237, 255, 0, 0, 0, 0, 183, 5, 0, 0, 55,
0, 0, 0, 5, 0, 235, 255, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 191, 160, 0, 0, 0, 0, 0, 0, 7, 0,
0, 0, 128, 255, 255, 255, 15, 48, 0, 0, 0, 0, 0, 0, 115, 80, 127, 0, 0, 0, 0, 0, 7, 3, 0, 0,
255, 255, 255, 255, 191, 69, 0, 0, 0, 0, 0, 0, 119, 5, 0, 0, 4, 0, 0, 0, 37, 4, 9, 0, 15, 0, 0,
0, 191, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 183, 4, 0, 0, 129, 0, 0, 0, 45, 20, 12,
0, 0, 0, 0, 0, 183, 2, 0, 0, 128, 0, 0, 0, 24, 3, 0, 0, 40, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 60, 252, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 191, 84, 0, 0, 0, 0, 0, 0,
191, 64, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 15, 0, 0, 0, 183, 5, 0, 0, 48, 0, 0, 0, 45, 1, 233,
255, 0, 0, 0, 0, 183, 5, 0, 0, 87, 0, 0, 0, 5, 0, 231, 255, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0,
0, 135, 1, 0, 0, 0, 0, 0, 0, 123, 26, 8, 240, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 128, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 0, 0, 0, 123, 26, 0, 240, 0,
0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 24,
3, 0, 0, 229, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 2, 0, 0, 0, 5, 0, 42, 0, 0, 0,
0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 87, 4, 0, 0, 255, 255, 0, 0, 55, 4, 0, 0, 100, 0, 0, 0, 191,
69, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 100, 0, 0, 0, 31, 81, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 255,
255, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 5, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15,
21, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255, 255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
128, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0, 0, 0, 0, 0, 107, 81, 0, 0, 0, 0,
0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 5, 0, 158, 255, 0, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 4,
0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255,
255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 128, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0,
105, 68, 0, 0, 0, 0, 0, 0, 107, 65, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
128, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0, 39, 0,
0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 123, 26, 8, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191,
33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 108, 249, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0,
113, 17, 0, 0, 0, 0, 0, 0, 37, 1, 11, 0, 99, 0, 0, 0, 183, 3, 0, 0, 38, 0, 0, 0, 183, 4, 0, 0,
10, 0, 0, 0, 45, 20, 22, 0, 0, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 231, 217, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0, 105, 49, 0, 0, 0, 0, 0, 0, 107, 26, 254, 255,
0, 0, 0, 0, 183, 3, 0, 0, 37, 0, 0, 0, 5, 0, 19, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 55,
4, 0, 0, 100, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 39, 3, 0, 0, 100, 0, 0, 0, 31, 49, 0, 0, 0,
0, 0, 0, 87, 1, 0, 0, 255, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 231, 217, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0, 105, 49, 0, 0, 0, 0, 0, 0, 107, 26, 254, 255, 0,
0, 0, 0, 183, 3, 0, 0, 36, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 191, 164, 0, 0, 0, 0, 0, 0, 7,
4, 0, 0, 217, 255, 255, 255, 15, 52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0, 0, 0, 115, 20, 0, 0,
0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0,
0, 123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0, 39, 0, 0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 123, 26,
8, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0,
0, 0, 24, 3, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 133, 16,
0, 0, 61, 249, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 39, 0, 0, 0, 97, 17, 0, 0, 0,
0, 0, 0, 183, 4, 0, 0, 16, 39, 0, 0, 45, 20, 32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191,
20, 0, 0, 0, 0, 0, 0, 55, 1, 0, 0, 16, 39, 0, 0, 191, 21, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 16,
39, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 31, 80, 0, 0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 87, 5,
0, 0, 255, 255, 0, 0, 55, 5, 0, 0, 100, 0, 0, 0, 191, 86, 0, 0, 0, 0, 0, 0, 39, 6, 0, 0, 100,
0, 0, 0, 31, 96, 0, 0, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 217, 255, 255, 255,
15, 54, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 1, 0, 0, 0, 24, 7, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 87, 0, 0, 0, 0, 0, 0, 105, 117, 0, 0, 0, 0, 0, 0, 107, 86, 35, 0, 0, 0, 0, 0, 87,
0, 0, 0, 255, 255, 0, 0, 103, 0, 0, 0, 1, 0, 0, 0, 24, 5, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0, 0, 0, 0, 0, 107, 86, 37, 0, 0, 0, 0, 0, 7, 3,
0, 0, 252, 255, 255, 255, 37, 4, 226, 255, 255, 224, 245, 5, 7, 3, 0, 0, 39, 0, 0, 0, 37, 1,
10, 0, 99, 0, 0, 0, 183, 4, 0, 0, 10, 0, 0, 0, 109, 20, 1, 0, 0, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0,
0, 7, 3, 0, 0, 255, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 217, 255, 255, 255,
15, 52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0, 0, 0, 115, 20, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0,
0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 87, 4, 0, 0, 255, 255, 0, 0, 55, 4, 0, 0, 100, 0, 0, 0,
191, 69, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 100, 0, 0, 0, 31, 81, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0,
255, 255, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 5, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 21, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255, 255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0, 0, 0, 0, 0, 107, 81, 0, 0, 0,
0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 5, 0, 227, 255, 0, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24,
4, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254,
255, 255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0,
0, 0, 105, 68, 0, 0, 0, 0, 0, 0, 107, 65, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1,
0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0,
39, 0, 0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 123, 26, 8, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0,
191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 226, 248, 255, 255, 149, 0, 0, 0, 0, 0, 0,
0, 183, 3, 0, 0, 39, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 16, 39, 0, 0, 45, 20,
32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 55, 1, 0, 0, 16, 39, 0,
0, 191, 21, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 16, 39, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 31, 80, 0,
0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0, 255, 255, 0, 0, 55, 5, 0, 0, 100, 0, 0,
0, 191, 86, 0, 0, 0, 0, 0, 0, 39, 6, 0, 0, 100, 0, 0, 0, 31, 96, 0, 0, 0, 0, 0, 0, 191, 166, 0,
0, 0, 0, 0, 0, 7, 6, 0, 0, 217, 255, 255, 255, 15, 54, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 1, 0, 0,
0, 24, 7, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 87, 0, 0, 0, 0, 0, 0, 105, 117, 0,
0, 0, 0, 0, 0, 107, 86, 35, 0, 0, 0, 0, 0, 87, 0, 0, 0, 255, 255, 0, 0, 103, 0, 0, 0, 1, 0, 0,
0, 24, 5, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0,
0, 0, 0, 0, 107, 86, 37, 0, 0, 0, 0, 0, 7, 3, 0, 0, 252, 255, 255, 255, 37, 4, 226, 255, 255,
224, 245, 5, 7, 3, 0, 0, 39, 0, 0, 0, 101, 1, 10, 0, 99, 0, 0, 0, 183, 4, 0, 0, 10, 0, 0, 0,
109, 20, 1, 0, 0, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0, 0, 7, 3, 0, 0, 255, 255, 255, 255, 191, 164,
0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 217, 255, 255, 255, 15, 52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0,
0, 0, 115, 20, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 87, 4, 0,
0, 255, 255, 0, 0, 55, 4, 0, 0, 100, 0, 0, 0, 191, 69, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 100, 0,
0, 0, 31, 81, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 255, 255, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 5,
0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 21, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255,
255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0,
105, 85, 0, 0, 0, 0, 0, 0, 107, 81, 0, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 5, 0, 227,
255, 0, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 4, 0, 0, 231, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 20, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255, 255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 105, 68, 0, 0, 0, 0, 0, 0, 107, 65, 0, 0, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0,
123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0, 39, 0, 0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 123, 26, 8,
240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0,
0, 24, 3, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 133, 16, 0,
0, 135, 248, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0,
0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 63, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
3, 0, 0, 5, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 19, 0, 0, 0, 0,
0, 0, 121, 17, 8, 0, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 141, 0,
0, 0, 4, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 231, 253,
255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0, 0, 121, 23, 0, 0, 0, 0, 0, 0, 113,
113, 0, 0, 0, 0, 0, 0, 21, 1, 8, 0, 1, 0, 0, 0, 121, 97, 32, 0, 0, 0, 0, 0, 121, 98, 40, 0, 0,
0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 0, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3,
0, 0, 4, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 5, 0, 56, 0, 0, 0, 0, 0, 121, 97, 40, 0, 0, 0, 0,
0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 97, 32, 0, 0, 0, 0, 0, 24, 2, 0, 0, 248, 216, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 4, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 115, 10, 240, 255, 0, 0,
0, 0, 123, 106, 224, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 115, 26, 241, 255, 0, 0, 0, 0,
123, 26, 232, 255, 0, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 123, 122, 248, 255, 0, 0, 0, 0, 191,
161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0,
248, 255, 255, 255, 24, 3, 0, 0, 8, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 98, 246,
255, 255, 113, 166, 240, 255, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 21, 1, 28, 0, 0, 0,
0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 85, 2, 25, 0, 0, 0, 0, 0, 121, 167,
224, 255, 0, 0, 0, 0, 85, 1, 5, 0, 1, 0, 0, 0, 113, 161, 241, 255, 0, 0, 0, 0, 21, 1, 3, 0, 0,
0, 0, 0, 97, 113, 48, 0, 0, 0, 0, 0, 87, 1, 0, 0, 4, 0, 0, 0, 21, 1, 9, 0, 0, 0, 0, 0, 121,
113, 32, 0, 0, 0, 0, 0, 121, 114, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0,
198, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0,
191, 6, 0, 0, 0, 0, 0, 0, 5, 0, 9, 0, 0, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0, 0, 121, 114, 40, 0,
0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 24, 2, 0, 0, 197, 217, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 21, 0, 238, 255, 0,
0, 0, 0, 87, 6, 0, 0, 255, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 6, 1, 0, 0, 0, 0, 0, 183, 0,
0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 1, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 27, 254, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 121, 17,
0, 0, 0, 0, 0, 0, 121, 19, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 35, 249, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 121,
19, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 29,
249, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 121, 38, 40, 0, 0, 0, 0, 0, 121, 39, 32, 0, 0, 0, 0,
0, 121, 18, 0, 0, 0, 0, 0, 0, 191, 168, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 208, 255, 255, 255, 191,
129, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 180, 0, 0, 0, 191, 113, 0, 0,
0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 132, 247,
255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 121,
113, 40, 0, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0, 0, 24, 2, 0, 0,
68, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 9, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 183,
1, 0, 0, 1, 0, 0, 0, 85, 0, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 122, 232, 255, 0,
0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 191, 167, 0, 0, 0, 0,
0, 0, 7, 7, 0, 0, 232, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 248, 255, 255,
255, 191, 113, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 77, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0,
0, 11, 0, 0, 0, 24, 5, 0, 0, 56, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 102, 245,
255, 255, 7, 6, 0, 0, 8, 0, 0, 0, 123, 106, 248, 255, 0, 0, 0, 0, 191, 164, 0, 0, 0, 0, 0, 0,
7, 4, 0, 0, 248, 255, 255, 255, 191, 113, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 88, 226, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 9, 0, 0, 0, 24, 5, 0, 0, 88, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 91, 245, 255, 255, 113, 160, 240, 255, 0, 0, 0, 0, 113, 161, 241, 255, 0, 0, 0,
0, 21, 1, 21, 0, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 18, 0,
0, 0, 0, 0, 121, 162, 232, 255, 0, 0, 0, 0, 97, 33, 48, 0, 0, 0, 0, 0, 87, 1, 0, 0, 4, 0, 0, 0,
85, 1, 7, 0, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24,
0, 0, 0, 0, 0, 24, 2, 0, 0, 192, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 2, 0, 0, 0,
5, 0, 6, 0, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0,
0, 0, 0, 0, 24, 2, 0, 0, 191, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 141,
0, 0, 0, 4, 0, 0, 0, 87, 0, 0, 0, 255, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 85, 0, 1, 0, 0, 0, 0,
0, 183, 1, 0, 0, 0, 0, 0, 0, 191, 16, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0,
0, 0, 0, 0, 183, 3, 0, 0, 32, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 103, 4, 0, 0, 11, 0, 0, 0,
183, 5, 0, 0, 32, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 191, 50, 0, 0, 0, 0,
0, 0, 191, 83, 0, 0, 0, 0, 0, 0, 31, 35, 0, 0, 0, 0, 0, 0, 45, 37, 1, 0, 0, 0, 0, 0, 5, 0, 20,
0, 0, 0, 0, 0, 119, 3, 0, 0, 1, 0, 0, 0, 15, 35, 0, 0, 0, 0, 0, 0, 191, 48, 0, 0, 0, 0, 0, 0,
103, 0, 0, 0, 2, 0, 0, 0, 24, 6, 0, 0, 100, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 6, 0, 0, 0,
0, 0, 0, 97, 96, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 11, 0, 0, 0, 103, 0, 0, 0, 32, 0, 0, 0, 191,
70, 0, 0, 0, 0, 0, 0, 103, 6, 0, 0, 32, 0, 0, 0, 119, 0, 0, 0, 32, 0, 0, 0, 119, 6, 0, 0, 32,
0, 0, 0, 45, 6, 235, 255, 0, 0, 0, 0, 191, 53, 0, 0, 0, 0, 0, 0, 29, 96, 1, 0, 0, 0, 0, 0, 5,
0, 235, 255, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 37, 2, 69, 0, 31,
0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 2, 0, 0, 0, 24, 0, 0, 0, 100, 226, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 195, 2, 0, 0, 21, 2, 4, 0, 31, 0, 0, 0, 191, 83, 0, 0, 0, 0,
0, 0, 15, 3, 0, 0, 0, 0, 0, 0, 97, 52, 4, 0, 0, 0, 0, 0, 119, 4, 0, 0, 21, 0, 0, 0, 191, 35, 0,
0, 0, 0, 0, 0, 7, 3, 0, 0, 255, 255, 255, 255, 183, 6, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0,
0, 45, 35, 1, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 87, 7, 0, 0, 1, 0, 0, 0, 85, 7, 14, 0,
0, 0, 0, 0, 183, 2, 0, 0, 32, 0, 0, 0, 45, 50, 6, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0,
183, 2, 0, 0, 32, 0, 0, 0, 24, 3, 0, 0, 32, 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0,
242, 243, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 103, 3, 0, 0, 2, 0, 0, 0, 24, 2, 0, 0,
100, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 50, 0, 0, 0, 0, 0, 0, 97, 38, 0, 0, 0, 0, 0, 0, 87,
6, 0, 0, 255, 255, 31, 0, 15, 80, 0, 0, 0, 0, 0, 0, 97, 0, 0, 0, 0, 0, 0, 0, 119, 0, 0, 0, 21,
0, 0, 0, 191, 2, 0, 0, 0, 0, 0, 0, 167, 2, 0, 0, 255, 255, 255, 255, 15, 36, 0, 0, 0, 0, 0, 0,
21, 4, 22, 0, 0, 0, 0, 0, 31, 97, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 228, 226, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 15, 3, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1,
0, 0, 32, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 191, 2, 0, 0, 0, 0, 0, 0, 15, 98, 0, 0, 0, 0, 0,
0, 37, 2, 13, 0, 194, 2, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 15, 98, 0, 0, 0, 0, 0, 0, 113, 34, 0,
0, 0, 0, 0, 0, 15, 37, 0, 0, 0, 0, 0, 0, 191, 82, 0, 0, 0, 0, 0, 0, 103, 2, 0, 0, 32, 0, 0, 0,
119, 2, 0, 0, 32, 0, 0, 0, 45, 18, 2, 0, 0, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 45, 100, 243, 255,
0, 0, 0, 0, 15, 96, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 1, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191,
33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 195, 2, 0, 0, 24, 3, 0, 0, 8, 235, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 133, 16, 0, 0, 199, 243, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 191, 33, 0, 0, 0,
0, 0, 0, 183, 2, 0, 0, 32, 0, 0, 0, 24, 3, 0, 0, 240, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 193, 243, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 191, 22, 0, 0, 0, 0, 0, 0,
191, 52, 0, 0, 0, 0, 0, 0, 119, 4, 0, 0, 3, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0,
249, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 37, 1, 24, 0, 15, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0,
0, 183, 5, 0, 0, 8, 0, 0, 0, 45, 53, 11, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0,
0, 0, 0, 0, 191, 96, 0, 0, 0, 0, 0, 0, 15, 16, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 15,
23, 0, 0, 0, 0, 0, 0, 121, 119, 0, 0, 0, 0, 0, 0, 123, 112, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 8, 0,
0, 0, 7, 5, 0, 0, 1, 0, 0, 0, 45, 84, 247, 255, 0, 0, 0, 0, 125, 49, 11, 0, 0, 0, 0, 0, 191,
100, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 15, 21, 0, 0, 0, 0,
0, 0, 113, 85, 0, 0, 0, 0, 0, 0, 115, 84, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 1, 0, 0, 0, 109, 19,
248, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0,
191, 52, 0, 0, 0, 0, 0, 0, 119, 4, 0, 0, 3, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0,
249, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 37, 1, 23, 0, 15, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0,
0, 183, 5, 0, 0, 8, 0, 0, 0, 45, 53, 13, 0, 0, 0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0,
255, 0, 0, 0, 24, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 47, 21, 0, 0, 0, 0, 0, 0, 183,
1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 191, 103, 0, 0, 0, 0, 0, 0, 15, 23, 0, 0, 0, 0,
0, 0, 123, 87, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 8, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 45, 4, 250,
255, 0, 0, 0, 0, 125, 49, 9, 0, 0, 0, 0, 0, 191, 100, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0,
0, 115, 36, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 1, 0, 0, 0, 109, 19, 251, 255, 0, 0, 0, 0, 5, 0, 3,
0, 0, 0, 0, 0, 87, 2, 0, 0, 255, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 255, 255,
255, 255, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 53, 0, 0, 0, 0, 0, 0, 119,
5, 0, 0, 3, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 39, 4, 0, 0, 249, 255, 255, 255, 15, 52, 0, 0,
0, 0, 0, 0, 37, 4, 29, 0, 15, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 8, 0, 0, 0, 183,
4, 0, 0, 0, 0, 0, 0, 45, 54, 11, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0,
0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 121, 120, 0, 0, 0, 0, 0, 0, 121, 105, 0, 0, 0, 0, 0, 0, 93,
137, 4, 0, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 7, 7, 0, 0, 8, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0,
45, 69, 249, 255, 0, 0, 0, 0, 103, 4, 0, 0, 3, 0, 0, 0, 125, 52, 19, 0, 0, 0, 0, 0, 5, 0, 2, 0,
0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 125, 52, 16, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 15,
70, 0, 0, 0, 0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 15, 69, 0, 0, 0, 0, 0, 0, 113, 85, 0, 0, 0, 0,
0, 0, 113, 102, 0, 0, 0, 0, 0, 0, 29, 86, 247, 255, 0, 0, 0, 0, 31, 86, 0, 0, 0, 0, 0, 0, 191,
96, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 99, 74, 252, 255, 0, 0,
0, 0, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 252, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255,
255, 97, 160, 252, 255, 0, 0, 0, 0, 103, 0, 0, 0, 32, 0, 0, 0, 199, 0, 0, 0, 32, 0, 0, 0, 149,
0, 0, 0, 0, 0, 0, 0, 47, 67, 0, 0, 0, 0, 0, 0, 47, 37, 0, 0, 0, 0, 0, 0, 15, 53, 0, 0, 0, 0, 0,
0, 191, 32, 0, 0, 0, 0, 0, 0, 119, 0, 0, 0, 32, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 119, 3, 0,
0, 32, 0, 0, 0, 191, 54, 0, 0, 0, 0, 0, 0, 47, 6, 0, 0, 0, 0, 0, 0, 15, 101, 0, 0, 0, 0, 0, 0,
103, 4, 0, 0, 32, 0, 0, 0, 119, 4, 0, 0, 32, 0, 0, 0, 191, 70, 0, 0, 0, 0, 0, 0, 47, 6, 0, 0,
0, 0, 0, 0, 103, 2, 0, 0, 32, 0, 0, 0, 119, 2, 0, 0, 32, 0, 0, 0, 47, 36, 0, 0, 0, 0, 0, 0,
191, 64, 0, 0, 0, 0, 0, 0, 119, 0, 0, 0, 32, 0, 0, 0, 15, 96, 0, 0, 0, 0, 0, 0, 191, 6, 0, 0,
0, 0, 0, 0, 119, 6, 0, 0, 32, 0, 0, 0, 15, 101, 0, 0, 0, 0, 0, 0, 47, 35, 0, 0, 0, 0, 0, 0,
103, 0, 0, 0, 32, 0, 0, 0, 119, 0, 0, 0, 32, 0, 0, 0, 15, 48, 0, 0, 0, 0, 0, 0, 191, 2, 0, 0,
0, 0, 0, 0, 119, 2, 0, 0, 32, 0, 0, 0, 15, 37, 0, 0, 0, 0, 0, 0, 123, 81, 8, 0, 0, 0, 0, 0,
103, 0, 0, 0, 32, 0, 0, 0, 103, 4, 0, 0, 32, 0, 0, 0, 119, 4, 0, 0, 32, 0, 0, 0, 79, 64, 0, 0,
0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 32, 40, 98, 121, 116, 101, 115,
32, 84, 114, 97, 110, 115, 102, 101, 114, 84, 114, 97, 110, 115, 102, 101, 114, 105, 110, 103,
32, 102, 114, 111, 109, 40, 41, 32, 116, 111, 40, 41, 32, 108, 97, 109, 112, 111, 114, 116,
115, 40, 41, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76,
77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 255, 255, 255, 255, 255,
255, 255, 9, 10, 11, 12, 13, 14, 15, 16, 255, 17, 18, 19, 20, 21, 255, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 255, 255, 255, 255, 255, 255, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
255, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 255, 255, 255, 255, 255, 115, 114,
99, 47, 101, 110, 99, 111, 100, 101, 46, 114, 115, 115, 114, 99, 47, 101, 110, 116, 114, 121,
112, 111, 105, 110, 116, 46, 114, 115, 0, 0, 0, 0, 0, 0, 99, 97, 108, 108, 101, 100, 32, 96,
82, 101, 115, 117, 108, 116, 58, 58, 117, 110, 119, 114, 97, 112, 40, 41, 96, 32, 111, 110, 32,
97, 110, 32, 96, 69, 114, 114, 96, 32, 118, 97, 108, 117, 101, 66, 117, 102, 102, 101, 114, 84,
111, 111, 83, 109, 97, 108, 108, 69, 114, 114, 111, 114, 58, 32, 109, 101, 109, 111, 114, 121,
32, 97, 108, 108, 111, 99, 97, 116, 105, 111, 110, 32, 102, 97, 105, 108, 101, 100, 44, 32,
111, 117, 116, 32, 111, 102, 32, 109, 101, 109, 111, 114, 121, 108, 105, 98, 114, 97, 114, 121,
47, 97, 108, 108, 111, 99, 47, 115, 114, 99, 47, 114, 97, 119, 95, 118, 101, 99, 46, 114, 115,
99, 97, 112, 97, 99, 105, 116, 121, 32, 111, 118, 101, 114, 102, 108, 111, 119, 97, 32, 102,
111, 114, 109, 97, 116, 116, 105, 110, 103, 32, 116, 114, 97, 105, 116, 32, 105, 109, 112, 108,
101, 109, 101, 110, 116, 97, 116, 105, 111, 110, 32, 114, 101, 116, 117, 114, 110, 101, 100,
32, 97, 110, 32, 101, 114, 114, 111, 114, 108, 105, 98, 114, 97, 114, 121, 47, 97, 108, 108,
111, 99, 47, 115, 114, 99, 47, 102, 109, 116, 46, 114, 115, 70, 114, 111, 109, 85, 116, 102,
56, 69, 114, 114, 111, 114, 98, 121, 116, 101, 115, 101, 114, 114, 111, 114, 0, 0, 46, 46, 0,
0, 41, 32, 119, 104, 101, 110, 32, 115, 108, 105, 99, 105, 110, 103, 32, 96, 114, 97, 110, 103,
101, 32, 101, 110, 100, 32, 105, 110, 100, 101, 120, 32, 32, 32, 32, 32, 83, 111, 109, 101, 32,
60, 61, 32, 78, 111, 110, 101, 99, 97, 108, 108, 101, 100, 32, 96, 79, 112, 116, 105, 111, 110,
58, 58, 117, 110, 119, 114, 97, 112, 40, 41, 96, 32, 111, 110, 32, 97, 32, 96, 78, 111, 110,
101, 96, 32, 118, 97, 108, 117, 101, 58, 112, 97, 110, 105, 99, 107, 101, 100, 32, 97, 116, 32,
39, 39, 44, 32, 108, 105, 98, 114, 97, 114, 121, 47, 99, 111, 114, 101, 47, 115, 114, 99, 47,
115, 108, 105, 99, 101, 47, 109, 101, 109, 99, 104, 114, 46, 114, 115, 105, 110, 100, 101, 120,
32, 111, 117, 116, 32, 111, 102, 32, 98, 111, 117, 110, 100, 115, 58, 32, 116, 104, 101, 32,
108, 101, 110, 32, 105, 115, 32, 108, 105, 98, 114, 97, 114, 121, 47, 99, 111, 114, 101, 47,
115, 114, 99, 47, 102, 109, 116, 47, 98, 117, 105, 108, 100, 101, 114, 115, 46, 114, 115, 32,
98, 117, 116, 32, 116, 104, 101, 32, 105, 110, 100, 101, 120, 32, 105, 115, 32, 96, 58, 32, 32,
123, 10, 44, 10, 44, 32, 32, 123, 32, 125, 32, 125, 40, 10, 40, 44, 41, 10, 91, 93, 108, 105,
98, 114, 97, 114, 121, 47, 99, 111, 114, 101, 47, 115, 114, 99, 47, 102, 109, 116, 47, 110,
117, 109, 46, 114, 115, 48, 120, 48, 48, 48, 49, 48, 50, 48, 51, 48, 52, 48, 53, 48, 54, 48,
55, 48, 56, 48, 57, 49, 48, 49, 49, 49, 50, 49, 51, 49, 52, 49, 53, 49, 54, 49, 55, 49, 56, 49,
57, 50, 48, 50, 49, 50, 50, 50, 51, 50, 52, 50, 53, 50, 54, 50, 55, 50, 56, 50, 57, 51, 48, 51,
49, 51, 50, 51, 51, 51, 52, 51, 53, 51, 54, 51, 55, 51, 56, 51, 57, 52, 48, 52, 49, 52, 50, 52,
51, 52, 52, 52, 53, 52, 54, 52, 55, 52, 56, 52, 57, 53, 48, 53, 49, 53, 50, 53, 51, 53, 52, 53,
53, 53, 54, 53, 55, 53, 56, 53, 57, 54, 48, 54, 49, 54, 50, 54, 51, 54, 52, 54, 53, 54, 54, 54,
55, 54, 56, 54, 57, 55, 48, 55, 49, 55, 50, 55, 51, 55, 52, 55, 53, 55, 54, 55, 55, 55, 56, 55,
57, 56, 48, 56, 49, 56, 50, 56, 51, 56, 52, 56, 53, 56, 54, 56, 55, 56, 56, 56, 57, 57, 48, 57,
49, 57, 50, 57, 51, 57, 52, 57, 53, 57, 54, 57, 55, 57, 56, 57, 57, 114, 97, 110, 103, 101, 32,
115, 116, 97, 114, 116, 32, 105, 110, 100, 101, 120, 32, 32, 111, 117, 116, 32, 111, 102, 32,
114, 97, 110, 103, 101, 32, 102, 111, 114, 32, 115, 108, 105, 99, 101, 32, 111, 102, 32, 108,
101, 110, 103, 116, 104, 32, 115, 108, 105, 99, 101, 32, 105, 110, 100, 101, 120, 32, 115, 116,
97, 114, 116, 115, 32, 97, 116, 32, 32, 98, 117, 116, 32, 101, 110, 100, 115, 32, 97, 116, 32,
108, 105, 98, 114, 97, 114, 121, 47, 99, 111, 114, 101, 47, 115, 114, 99, 47, 115, 116, 114,
47, 118, 97, 108, 105, 100, 97, 116, 105, 111, 110, 115, 46, 114, 115, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 46, 46, 46, 93, 98,
121, 116, 101, 32, 105, 110, 100, 101, 120, 32, 32, 105, 115, 32, 111, 117, 116, 32, 111, 102,
32, 98, 111, 117, 110, 100, 115, 32, 111, 102, 32, 96, 98, 101, 103, 105, 110, 32, 60, 61, 32,
101, 110, 100, 32, 40, 32, 105, 115, 32, 110, 111, 116, 32, 97, 32, 99, 104, 97, 114, 32, 98,
111, 117, 110, 100, 97, 114, 121, 59, 32, 105, 116, 32, 105, 115, 32, 105, 110, 115, 105, 100,
101, 32, 41, 32, 111, 102, 32, 96, 108, 105, 98, 114, 97, 114, 121, 47, 99, 111, 114, 101, 47,
115, 114, 99, 47, 117, 110, 105, 99, 111, 100, 101, 47, 112, 114, 105, 110, 116, 97, 98, 108,
101, 46, 114, 115, 0, 1, 3, 5, 5, 6, 6, 2, 7, 6, 8, 7, 9, 17, 10, 28, 11, 25, 12, 26, 13, 16,
14, 13, 15, 4, 16, 3, 18, 18, 19, 9, 22, 1, 23, 4, 24, 1, 25, 3, 26, 7, 27, 1, 28, 2, 31, 22,
32, 3, 43, 3, 45, 11, 46, 1, 48, 3, 49, 2, 50, 1, 167, 2, 169, 2, 170, 4, 171, 8, 250, 2, 251,
5, 253, 2, 254, 3, 255, 9, 173, 120, 121, 139, 141, 162, 48, 87, 88, 139, 140, 144, 28, 221,
14, 15, 75, 76, 251, 252, 46, 47, 63, 92, 93, 95, 226, 132, 141, 142, 145, 146, 169, 177, 186,
187, 197, 198, 201, 202, 222, 228, 229, 255, 0, 4, 17, 18, 41, 49, 52, 55, 58, 59, 61, 73, 74,
93, 132, 142, 146, 169, 177, 180, 186, 187, 198, 202, 206, 207, 228, 229, 0, 4, 13, 14, 17, 18,
41, 49, 52, 58, 59, 69, 70, 73, 74, 94, 100, 101, 132, 145, 155, 157, 201, 206, 207, 13, 17,
41, 58, 59, 69, 73, 87, 91, 92, 94, 95, 100, 101, 141, 145, 169, 180, 186, 187, 197, 201, 223,
228, 229, 240, 13, 17, 69, 73, 100, 101, 128, 132, 178, 188, 190, 191, 213, 215, 240, 241, 131,
133, 139, 164, 166, 190, 191, 197, 199, 206, 207, 218, 219, 72, 152, 189, 205, 198, 206, 207,
73, 78, 79, 87, 89, 94, 95, 137, 142, 143, 177, 182, 183, 191, 193, 198, 199, 215, 17, 22, 23,
91, 92, 246, 247, 254, 255, 128, 109, 113, 222, 223, 14, 31, 110, 111, 28, 29, 95, 125, 126,
174, 175, 127, 187, 188, 22, 23, 30, 31, 70, 71, 78, 79, 88, 90, 92, 94, 126, 127, 181, 197,
212, 213, 220, 240, 241, 245, 114, 115, 143, 116, 117, 150, 38, 46, 47, 167, 175, 183, 191,
199, 207, 215, 223, 154, 64, 151, 152, 48, 143, 31, 210, 212, 206, 255, 78, 79, 90, 91, 7, 8,
15, 16, 39, 47, 238, 239, 110, 111, 55, 61, 63, 66, 69, 144, 145, 83, 103, 117, 200, 201, 208,
209, 216, 217, 231, 254, 255, 0, 32, 95, 34, 130, 223, 4, 130, 68, 8, 27, 4, 6, 17, 129, 172,
14, 128, 171, 5, 31, 9, 129, 27, 3, 25, 8, 1, 4, 47, 4, 52, 4, 7, 3, 1, 7, 6, 7, 17, 10, 80,
15, 18, 7, 85, 7, 3, 4, 28, 10, 9, 3, 8, 3, 7, 3, 2, 3, 3, 3, 12, 4, 5, 3, 11, 6, 1, 14, 21, 5,
78, 7, 27, 7, 87, 7, 2, 6, 22, 13, 80, 4, 67, 3, 45, 3, 1, 4, 17, 6, 15, 12, 58, 4, 29, 37, 95,
32, 109, 4, 106, 37, 128, 200, 5, 130, 176, 3, 26, 6, 130, 253, 3, 89, 7, 22, 9, 24, 9, 20, 12,
20, 12, 106, 6, 10, 6, 26, 6, 89, 7, 43, 5, 70, 10, 44, 4, 12, 4, 1, 3, 49, 11, 44, 4, 26, 6,
11, 3, 128, 172, 6, 10, 6, 47, 49, 77, 3, 128, 164, 8, 60, 3, 15, 3, 60, 7, 56, 8, 43, 5, 130,
255, 17, 24, 8, 47, 17, 45, 3, 33, 15, 33, 15, 128, 140, 4, 130, 151, 25, 11, 21, 136, 148, 5,
47, 5, 59, 7, 2, 14, 24, 9, 128, 190, 34, 116, 12, 128, 214, 26, 12, 5, 128, 255, 5, 128, 223,
12, 242, 157, 3, 55, 9, 129, 92, 20, 128, 184, 8, 128, 203, 5, 10, 24, 59, 3, 10, 6, 56, 8, 70,
8, 12, 6, 116, 11, 30, 3, 90, 4, 89, 9, 128, 131, 24, 28, 10, 22, 9, 76, 4, 128, 138, 6, 171,
164, 12, 23, 4, 49, 161, 4, 129, 218, 38, 7, 12, 5, 5, 128, 166, 16, 129, 245, 7, 1, 32, 42, 6,
76, 4, 128, 141, 4, 128, 190, 3, 27, 3, 15, 13, 0, 6, 1, 1, 3, 1, 4, 2, 5, 7, 7, 2, 8, 8, 9, 2,
10, 5, 11, 2, 14, 4, 16, 1, 17, 2, 18, 5, 19, 17, 20, 1, 21, 2, 23, 2, 25, 13, 28, 5, 29, 8,
36, 1, 106, 4, 107, 2, 175, 3, 188, 2, 207, 2, 209, 2, 212, 12, 213, 9, 214, 2, 215, 2, 218, 1,
224, 5, 225, 2, 231, 4, 232, 2, 238, 32, 240, 4, 248, 2, 250, 2, 251, 1, 12, 39, 59, 62, 78,
79, 143, 158, 158, 159, 123, 139, 147, 150, 162, 178, 186, 134, 177, 6, 7, 9, 54, 61, 62, 86,
243, 208, 209, 4, 20, 24, 54, 55, 86, 87, 127, 170, 174, 175, 189, 53, 224, 18, 135, 137, 142,
158, 4, 13, 14, 17, 18, 41, 49, 52, 58, 69, 70, 73, 74, 78, 79, 100, 101, 92, 182, 183, 27, 28,
7, 8, 10, 11, 20, 23, 54, 57, 58, 168, 169, 216, 217, 9, 55, 144, 145, 168, 7, 10, 59, 62, 102,
105, 143, 146, 111, 95, 191, 238, 239, 90, 98, 244, 252, 255, 154, 155, 46, 47, 39, 40, 85,
157, 160, 161, 163, 164, 167, 168, 173, 186, 188, 196, 6, 11, 12, 21, 29, 58, 63, 69, 81, 166,
167, 204, 205, 160, 7, 25, 26, 34, 37, 62, 63, 231, 236, 239, 255, 197, 198, 4, 32, 35, 37, 38,
40, 51, 56, 58, 72, 74, 76, 80, 83, 85, 86, 88, 90, 92, 94, 96, 99, 101, 102, 107, 115, 120,
125, 127, 138, 164, 170, 175, 176, 192, 208, 174, 175, 110, 111, 147, 94, 34, 123, 5, 3, 4, 45,
3, 102, 3, 1, 47, 46, 128, 130, 29, 3, 49, 15, 28, 4, 36, 9, 30, 5, 43, 5, 68, 4, 14, 42, 128,
170, 6, 36, 4, 36, 4, 40, 8, 52, 11, 78, 67, 129, 55, 9, 22, 10, 8, 24, 59, 69, 57, 3, 99, 8,
9, 48, 22, 5, 33, 3, 27, 5, 1, 64, 56, 4, 75, 5, 47, 4, 10, 7, 9, 7, 64, 32, 39, 4, 12, 9, 54,
3, 58, 5, 26, 7, 4, 12, 7, 80, 73, 55, 51, 13, 51, 7, 46, 8, 10, 129, 38, 82, 78, 40, 8, 42,
22, 26, 38, 28, 20, 23, 9, 78, 4, 36, 9, 68, 13, 25, 7, 10, 6, 72, 8, 39, 9, 117, 11, 63, 65,
42, 6, 59, 5, 10, 6, 81, 6, 1, 5, 16, 3, 5, 128, 139, 98, 30, 72, 8, 10, 128, 166, 94, 34, 69,
11, 10, 6, 13, 19, 58, 6, 10, 54, 44, 4, 23, 128, 185, 60, 100, 83, 12, 72, 9, 10, 70, 69, 27,
72, 8, 83, 13, 73, 129, 7, 70, 10, 29, 3, 71, 73, 55, 3, 14, 8, 10, 6, 57, 7, 10, 129, 54, 25,
128, 183, 1, 15, 50, 13, 131, 155, 102, 117, 11, 128, 196, 138, 76, 99, 13, 132, 47, 143, 209,
130, 71, 161, 185, 130, 57, 7, 42, 4, 92, 6, 38, 10, 70, 10, 40, 5, 19, 130, 176, 91, 101, 75,
4, 57, 7, 17, 64, 5, 11, 2, 14, 151, 248, 8, 132, 214, 42, 9, 162, 231, 129, 51, 45, 3, 17, 4,
8, 129, 140, 137, 4, 107, 5, 13, 3, 9, 7, 16, 146, 96, 71, 9, 116, 60, 128, 246, 10, 115, 8,
112, 21, 70, 128, 154, 20, 12, 87, 9, 25, 128, 135, 129, 71, 3, 133, 66, 15, 21, 132, 80, 31,
128, 225, 43, 128, 213, 45, 3, 26, 4, 2, 129, 64, 31, 17, 58, 5, 1, 132, 224, 128, 247, 41, 76,
4, 10, 4, 2, 131, 17, 68, 76, 61, 128, 194, 60, 6, 1, 4, 85, 5, 27, 52, 2, 129, 14, 44, 4, 100,
12, 86, 10, 128, 174, 56, 29, 13, 44, 4, 9, 7, 2, 14, 6, 128, 154, 131, 216, 5, 16, 3, 13, 3,
116, 12, 89, 7, 12, 4, 1, 15, 12, 4, 56, 8, 10, 6, 40, 8, 34, 78, 129, 84, 12, 21, 3, 5, 3, 7,
9, 29, 3, 11, 5, 6, 10, 10, 6, 8, 8, 7, 9, 128, 203, 37, 10, 132, 6, 108, 105, 98, 114, 97,
114, 121, 47, 99, 111, 114, 101, 47, 115, 114, 99, 47, 117, 110, 105, 99, 111, 100, 101, 47,
117, 110, 105, 99, 111, 100, 101, 95, 100, 97, 116, 97, 46, 114, 115, 69, 114, 114, 111, 114,
85, 116, 102, 56, 69, 114, 114, 111, 114, 118, 97, 108, 105, 100, 95, 117, 112, 95, 116, 111,
101, 114, 114, 111, 114, 95, 108, 101, 110, 0, 0, 0, 0, 3, 0, 0, 131, 4, 32, 0, 145, 5, 96, 0,
93, 19, 160, 0, 18, 23, 32, 31, 12, 32, 96, 31, 239, 44, 160, 43, 42, 48, 32, 44, 111, 166,
224, 44, 2, 168, 96, 45, 30, 251, 96, 46, 0, 254, 32, 54, 158, 255, 96, 54, 253, 1, 225, 54, 1,
10, 33, 55, 36, 13, 225, 55, 171, 14, 97, 57, 47, 24, 161, 57, 48, 28, 225, 71, 243, 30, 33,
76, 240, 106, 225, 79, 79, 111, 33, 80, 157, 188, 161, 80, 0, 207, 97, 81, 101, 209, 161, 81,
0, 218, 33, 82, 0, 224, 225, 83, 48, 225, 97, 85, 174, 226, 161, 86, 208, 232, 225, 86, 32, 0,
110, 87, 240, 1, 255, 87, 0, 112, 0, 7, 0, 45, 1, 1, 1, 2, 1, 2, 1, 1, 72, 11, 48, 21, 16, 1,
101, 7, 2, 6, 2, 2, 1, 4, 35, 1, 30, 27, 91, 11, 58, 9, 9, 1, 24, 4, 1, 9, 1, 3, 1, 5, 43, 3,
60, 8, 42, 24, 1, 32, 55, 1, 1, 1, 4, 8, 4, 1, 3, 7, 10, 2, 29, 1, 58, 1, 1, 1, 2, 4, 8, 1, 9,
1, 10, 2, 26, 1, 2, 2, 57, 1, 4, 2, 4, 2, 2, 3, 3, 1, 30, 2, 3, 1, 11, 2, 57, 1, 4, 5, 1, 2, 4,
1, 20, 2, 22, 6, 1, 1, 58, 1, 1, 2, 1, 4, 8, 1, 7, 3, 10, 2, 30, 1, 59, 1, 1, 1, 12, 1, 9, 1,
40, 1, 3, 1, 55, 1, 1, 3, 5, 3, 1, 4, 7, 2, 11, 2, 29, 1, 58, 1, 2, 1, 2, 1, 3, 1, 5, 2, 7, 2,
11, 2, 28, 2, 57, 2, 1, 1, 2, 4, 8, 1, 9, 1, 10, 2, 29, 1, 72, 1, 4, 1, 2, 3, 1, 1, 8, 1, 81,
1, 2, 7, 12, 8, 98, 1, 2, 9, 11, 6, 74, 2, 27, 1, 1, 1, 1, 1, 55, 14, 1, 5, 1, 2, 5, 11, 1, 36,
9, 1, 102, 4, 1, 6, 1, 2, 2, 2, 25, 2, 4, 3, 16, 4, 13, 1, 2, 2, 6, 1, 15, 1, 0, 3, 0, 3, 29,
2, 30, 2, 30, 2, 64, 2, 1, 7, 8, 1, 2, 11, 9, 1, 45, 3, 1, 1, 117, 2, 34, 1, 118, 3, 4, 2, 9,
1, 6, 3, 219, 2, 2, 1, 58, 1, 1, 7, 1, 1, 1, 1, 2, 8, 6, 10, 2, 1, 48, 31, 49, 4, 48, 7, 1, 1,
5, 1, 40, 9, 12, 2, 32, 4, 2, 2, 1, 3, 56, 1, 1, 2, 3, 1, 1, 3, 58, 8, 2, 2, 152, 3, 1, 13, 1,
7, 4, 1, 6, 1, 3, 2, 198, 64, 0, 1, 195, 33, 0, 3, 141, 1, 96, 32, 0, 6, 105, 2, 0, 4, 1, 10,
32, 2, 80, 2, 0, 1, 3, 1, 4, 1, 25, 2, 5, 1, 151, 2, 26, 18, 13, 1, 38, 8, 25, 11, 46, 3, 48,
1, 2, 4, 2, 2, 39, 1, 67, 6, 2, 2, 2, 2, 12, 1, 8, 1, 47, 1, 51, 1, 1, 3, 2, 2, 5, 2, 1, 1, 42,
2, 8, 1, 238, 1, 2, 1, 4, 1, 0, 1, 0, 16, 16, 16, 0, 2, 0, 1, 226, 1, 149, 5, 0, 3, 1, 2, 5, 4,
40, 3, 4, 1, 165, 2, 0, 4, 0, 2, 153, 11, 49, 4, 123, 1, 54, 15, 41, 1, 2, 2, 10, 3, 49, 4, 2,
2, 7, 1, 61, 3, 36, 5, 1, 8, 62, 1, 12, 2, 52, 9, 10, 4, 2, 1, 95, 3, 2, 1, 1, 2, 6, 1, 160, 1,
3, 8, 21, 2, 57, 2, 1, 1, 1, 1, 22, 1, 14, 7, 3, 5, 195, 8, 2, 3, 1, 1, 23, 1, 81, 1, 2, 6, 1,
1, 2, 1, 1, 2, 1, 2, 235, 1, 2, 4, 6, 2, 1, 2, 27, 2, 85, 8, 2, 1, 1, 2, 106, 1, 1, 1, 2, 6, 1,
1, 101, 3, 2, 4, 1, 5, 0, 9, 1, 2, 245, 1, 10, 2, 1, 1, 4, 1, 144, 4, 2, 2, 4, 1, 32, 10, 40,
6, 2, 4, 8, 1, 9, 6, 2, 3, 46, 13, 1, 2, 0, 7, 1, 6, 1, 1, 82, 22, 2, 7, 1, 2, 1, 2, 122, 6, 3,
1, 1, 2, 1, 7, 1, 1, 72, 2, 3, 1, 1, 1, 0, 2, 0, 5, 59, 7, 0, 1, 63, 4, 81, 1, 0, 2, 0, 46, 2,
23, 0, 1, 1, 3, 4, 5, 8, 8, 2, 7, 30, 4, 148, 3, 0, 55, 4, 50, 8, 1, 14, 1, 22, 5, 1, 15, 0, 7,
1, 17, 2, 7, 1, 2, 1, 5, 0, 7, 0, 1, 61, 4, 0, 7, 109, 7, 0, 96, 128, 240, 0, 0, 0, 0, 0, 0,
216, 214, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233, 214, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 238, 214, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249, 214, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 250, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 215, 0, 0, 13, 0, 0,
0, 0, 0, 0, 0, 81, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 180, 215, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0,
230, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 180, 215, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 85, 1, 0, 0,
26, 0, 0, 0, 0, 0, 0, 0, 180, 215, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 94, 1, 0, 0, 13, 0, 0, 0, 0,
0, 0, 0, 180, 215, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 104, 1, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 180,
215, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 108, 1, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 180, 215, 0, 0, 13,
0, 0, 0, 0, 0, 0, 0, 109, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 216, 215, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 193, 215, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 94, 1, 0, 0, 27, 0, 0, 0, 0, 0, 0,
0, 88, 17, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 97, 0, 0, 0,
0, 0, 0, 80, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 86, 0,
0, 0, 0, 0, 0, 63, 216, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 6, 2, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 159,
216, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 85, 2, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 128, 87, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 100, 0, 0, 0, 0, 0, 0, 128, 87, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 99, 0, 0, 0, 0, 0, 0, 128, 87,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 200, 0, 0, 0, 0, 0, 0,
128, 87, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 99, 0, 0, 0, 0,
0, 0, 128, 87, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 98, 0, 0,
0, 0, 0, 0, 232, 98, 0, 0, 0, 0, 0, 0, 8, 99, 0, 0, 0, 0, 0, 0, 208, 216, 0, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 217, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 217, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 101, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 102, 0, 0, 0, 0, 0, 0, 60, 217,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 217, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
96, 217, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 217, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 208, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, 217, 0, 0, 2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 32, 101, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
80, 114, 0, 0, 0, 0, 0, 0, 232, 131, 0, 0, 0, 0, 0, 0, 208, 133, 0, 0, 0, 0, 0, 0, 128, 217, 0,
0, 32, 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 128, 217, 0, 0, 32, 0, 0, 0,
0, 0, 0, 0, 48, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 32, 101, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 201, 0, 0, 0, 0, 0, 0, 202, 217, 0, 0, 27, 0, 0, 0, 0, 0, 0,
0, 101, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 32, 101, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 56, 134, 0, 0, 0, 0, 0, 0, 80, 134, 0, 0, 0, 0, 0, 0, 64, 136, 0, 0, 0, 0,
0, 0, 64, 217, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 91, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 175, 218, 0,
0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 193, 218, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
228, 216, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 193, 218, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 227, 218, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249, 218, 0, 0, 13, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 6, 219, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 30, 1, 0, 0, 17, 0, 0, 0, 0, 0,
0, 0, 46, 220, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 220, 0, 0, 22, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 178, 217, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 220, 0, 0, 14, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 252, 216, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 212, 216, 0, 0, 16,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 217, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 220,
0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 220, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
200, 214, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 220, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 178, 217, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 137, 220, 0, 0, 37, 0, 0, 0, 0, 0,
0, 0, 10, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 137, 220, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0,
0, 54, 0, 0, 0, 0, 0, 0, 0, 23, 226, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 40, 0, 0, 0,
0, 0, 0, 0, 23, 226, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 23,
226, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 32, 101, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 203, 0, 0, 0, 0, 0, 0, 32, 101, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 201, 0, 0, 30, 0, 0, 0, 0,
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 104, 237, 0, 0, 0, 0, 0, 0, 18, 0, 0,
0, 0, 0, 0, 0, 96, 20, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 250,
255, 255, 111, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 40, 236, 0, 0, 0,
0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 237, 0,
0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16, 0, 0, 0, 18, 0, 1, 0, 176, 11, 0, 0, 0, 0, 0, 0, 56, 2, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 18,
0, 1, 0, 200, 15, 0, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87,
0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 108, 95,
108, 111, 103, 95, 0, 97, 98, 111, 114, 116, 0, 101, 110, 116, 114, 121, 112, 111, 105, 110,
116, 0, 99, 117, 115, 116, 111, 109, 95, 112, 97, 110, 105, 99, 0, 115, 111, 108, 95, 109, 101,
109, 115, 101, 116, 95, 0, 115, 111, 108, 95, 105, 110, 118, 111, 107, 101, 95, 115, 105, 103,
110, 101, 100, 95, 114, 117, 115, 116, 0, 115, 111, 108, 95, 109, 101, 109, 99, 112, 121, 95,
0, 115, 111, 108, 95, 109, 101, 109, 99, 109, 112, 95, 0, 0, 0, 0, 0, 0, 136, 3, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 4, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 4, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 120, 4, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 16, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 16, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 26,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96, 28, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
120, 28, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 28, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 224, 28, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 38, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 16, 39, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 39, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 56, 39, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 39, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 152, 39, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 42, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 48, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 48, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 48, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 74,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 86, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
248, 86, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 91, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 160, 91, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232, 93, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 32, 94, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 56, 94, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 72, 94, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 48, 97, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 160, 97, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 97, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248, 97, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 98, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 99, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 100,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 101, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
152, 101, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 103, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 160, 103, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 103, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 248, 105, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 106, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 106, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 108, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 108, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 109, 0,
0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 109, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 24,
110, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 110, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 200, 110, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 111, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 128, 111, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96, 112, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 144, 112, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 113, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 24, 113, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 113, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 113, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248,
113, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 116, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 56, 119, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 119, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 120, 120, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 121, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 32, 121, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 224, 121, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 224, 122, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 123, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 208, 123, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96,
124, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 48, 125, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 104, 125, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 126, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 32, 126, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 224, 126, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 152, 127, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 56, 128, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 129, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 48, 130, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 208, 130, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 131,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 192, 131, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
16, 134, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 136, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 48, 139, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 208, 139, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 176, 156, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232, 161, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 24, 162, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 162, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248, 162, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 168,
163, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 163, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 248, 167, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 128, 171, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 216, 171, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 172, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 176, 172, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 173, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 173, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 173, 0,
0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 48,
174, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 128, 174, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 168, 176, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 177, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 112, 177, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 168, 177, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 216, 177, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 178, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 181, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 181, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 128, 181, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 181,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 182, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
24, 183, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 224, 183, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 136, 184, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 24, 185, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 192, 186, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 187, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 192, 187, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 188, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 120, 189, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176,
189, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 191, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 80, 192, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 192, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 16, 193, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 168, 193, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 0, 194, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 194, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 195, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 240, 195, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 196, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 197,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96, 197, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
248, 197, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 198, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 0, 199, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 199, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 56, 200, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 208, 200, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 16, 201, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 201, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248, 201, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 202,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 203, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88,
203, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 192, 204, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 56, 205, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 205, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 144, 205, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 168, 205, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 40, 206, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96, 206, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 48, 207, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 207, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 208, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 208,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248, 208, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
192, 209, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 240, 209, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 168, 229, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 229, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 200, 229, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 229, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 232, 229, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248, 229, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 230,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
88, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 136, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 230, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 176, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 230, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 224, 230, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232, 230, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 231,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
56, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 88, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 120, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 231, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 152, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 231, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 208, 231,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
224, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 248, 231, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 24, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 232, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 64, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 72, 232, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 232, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 120, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136,
232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 152, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 168, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 192, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 200, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 208, 232, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 216, 232, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 240, 232, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 233, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 233,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
96, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 112, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 233, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 152, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 168, 233, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 233, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232,
233, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 16, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 48, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 80, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96, 234, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 112, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 128, 234, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 234, 0,
0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 192,
234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
0, 240, 234, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 235, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 32, 235, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 56, 235, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 80, 235, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 235, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 112, 235, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 3, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 1, 0, 0, 0, 232, 4, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 160, 16, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 56, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 112, 5,
0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 120, 5, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0,
160, 19, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 216, 19, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2,
0, 0, 0, 112, 21, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 168, 21, 0, 0, 0, 0, 0, 0, 10, 0,
0, 0, 2, 0, 0, 0, 184, 26, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 160, 28, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 2, 0, 0, 0, 248, 28, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 200, 38, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 80, 39, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 128,
39, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 176, 39, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0,
0, 80, 40, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 184, 40, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0,
2, 0, 0, 0, 240, 42, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 56, 43, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 2, 0, 0, 0, 64, 43, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 208, 47, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 2, 0, 0, 0, 80, 74, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 64, 83, 0, 0, 0,
0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 40, 85, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 240, 86,
0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 32, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0,
48, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 80, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0,
0, 0, 88, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 96, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0,
2, 0, 0, 0, 104, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 120, 87, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 2, 0, 0, 0, 168, 88, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 224, 88, 0, 0, 0, 0,
0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 8, 90, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 64, 90, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 184, 91, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 200,
91, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 216, 91, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0,
0, 232, 91, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 248, 91, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0,
2, 0, 0, 0, 120, 93, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 96, 94, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 2, 0, 0, 0, 16, 101, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 24, 101, 0, 0, 0, 0,
0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 8, 112, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 232, 112, 0,
0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 72, 113, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 72,
114, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 128, 116, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0,
0, 0, 224, 119, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 144, 120, 0, 0, 0, 0, 0, 0, 10, 0,
0, 0, 2, 0, 0, 0, 112, 162, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 80, 163, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 2, 0, 0, 0, 48, 164, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 200, 172, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 208, 176, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 88,
178, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 56, 181, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0,
0, 0, 152, 181, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 200, 181, 0, 0, 0, 0, 0, 0, 10, 0,
0, 0, 2, 0, 0, 0, 136, 182, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 248, 183, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 2, 0, 0, 0, 216, 186, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 184, 191, 0,
0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 128, 208, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0,
216, 209, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 8, 210, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 2,
0, 0, 0, 72, 87, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 40, 212, 0, 0, 0, 0, 0, 0, 10, 0,
0, 0, 5, 0, 0, 0, 120, 77, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 6, 0, 0, 0, 16, 211, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 7, 0, 0, 0, 120, 213, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 8, 0, 0, 0, 0, 46, 116,
101, 120, 116, 0, 46, 100, 121, 110, 115, 116, 114, 0, 46, 100, 97, 116, 97, 46, 114, 101, 108,
46, 114, 111, 0, 46, 114, 101, 108, 46, 100, 121, 110, 0, 46, 100, 121, 110, 115, 121, 109, 0,
46, 100, 121, 110, 97, 109, 105, 99, 0, 46, 115, 104, 115, 116, 114, 116, 97, 98, 0, 46, 114,
111, 100, 97, 116, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0,
0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 168, 213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 1, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 200, 214,
0, 0, 0, 0, 0, 0, 200, 214, 0, 0, 0, 0, 0, 0, 223, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0,
0, 0, 168, 229, 0, 0, 0, 0, 0, 0, 168, 229, 0, 0, 0, 0, 0, 0, 208, 5, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 6, 0, 0, 0, 3,
0, 0, 0, 0, 0, 0, 0, 120, 235, 0, 0, 0, 0, 0, 0, 120, 235, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0,
0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0,
11, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 40, 236, 0, 0, 0, 0, 0, 0, 40, 236, 0, 0, 0, 0, 0, 0, 216,
0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0,
7, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0,
0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 28, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 104, 237, 0, 0, 0, 0, 0, 0, 104, 237,
0, 0, 0, 0, 0, 0, 96, 20, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16,
0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
200, 1, 1, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
];
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/test_programs/hello_world.rs
|
pub const PROGRAM_BYTES: &[u8] = &[
127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 247, 0, 1, 0, 0, 0, 32, 1, 0, 0, 0,
0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 8, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 56, 0, 4, 0, 64,
0, 9, 0, 8, 0, 1, 0, 0, 0, 5, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 32, 1,
0, 0, 0, 0, 0, 0, 176, 61, 0, 0, 0, 0, 0, 0, 176, 61, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 6, 0, 0, 0, 208, 62, 0, 0, 0, 0, 0, 0, 208, 62, 0, 0, 0, 0, 0, 0, 208, 62, 0, 0,
0, 0, 0, 0, 56, 3, 0, 0, 0, 0, 0, 0, 56, 3, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 4, 0, 0, 0, 184, 66, 0, 0, 0, 0, 0, 0, 184, 66, 0, 0, 0, 0, 0, 0, 184, 66, 0, 0, 0, 0, 0, 0,
8, 7, 0, 0, 0, 0, 0, 0, 8, 7, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0,
0, 8, 66, 0, 0, 0, 0, 0, 0, 8, 66, 0, 0, 0, 0, 0, 0, 8, 66, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0,
0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 208, 255, 255, 255, 133, 16, 0, 0, 254, 0, 0, 0, 121, 168, 232,
255, 0, 0, 0, 0, 121, 166, 224, 255, 0, 0, 0, 0, 121, 167, 216, 255, 0, 0, 0, 0, 24, 1, 0, 0,
208, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 13, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255,
255, 21, 8, 19, 0, 0, 0, 0, 0, 39, 8, 0, 0, 48, 0, 0, 0, 191, 121, 0, 0, 0, 0, 0, 0, 7, 9, 0,
0, 16, 0, 0, 0, 5, 0, 23, 0, 0, 0, 0, 0, 121, 145, 0, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0,
7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 0, 0, 0, 0, 0, 0, 85, 2, 7, 0, 0, 0, 0, 0, 121, 18, 8,
0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123, 33, 8, 0, 0, 0, 0, 0, 85, 2, 3, 0, 0, 0, 0,
0, 183, 2, 0, 0, 40, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 126, 0, 0, 0, 7, 9, 0,
0, 48, 0, 0, 0, 7, 8, 0, 0, 208, 255, 255, 255, 85, 8, 8, 0, 0, 0, 0, 0, 21, 6, 20, 0, 0, 0, 0,
0, 39, 6, 0, 0, 48, 0, 0, 0, 21, 6, 18, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0,
0, 0, 0, 0, 0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 116, 0, 0, 0, 5, 0, 13, 0, 0, 0, 0, 0,
121, 145, 248, 255, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255, 255, 255, 255, 123,
33, 0, 0, 0, 0, 0, 0, 85, 2, 228, 255, 0, 0, 0, 0, 121, 18, 8, 0, 0, 0, 0, 0, 7, 2, 0, 0, 255,
255, 255, 255, 123, 33, 8, 0, 0, 0, 0, 0, 85, 2, 224, 255, 0, 0, 0, 0, 183, 2, 0, 0, 32, 0, 0,
0, 183, 3, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 103, 0, 0, 0, 5, 0, 220, 255, 0, 0, 0, 0, 183, 0,
0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 24, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
121, 51, 0, 0, 0, 0, 0, 0, 24, 4, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 21, 3, 1, 0, 0,
0, 0, 0, 191, 52, 0, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 31, 19, 0, 0, 0, 0, 0, 0, 183,
0, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 1, 0, 0, 0, 45, 67, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0,
0, 183, 1, 0, 0, 0, 0, 0, 0, 85, 5, 1, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 135, 2, 0, 0,
0, 0, 0, 0, 95, 33, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 45, 18,
4, 0, 0, 0, 0, 0, 24, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 123, 18, 0, 0, 0, 0, 0, 0,
191, 16, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 21, 0, 0,
0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 24, 6,
0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 21, 1, 1, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0,
191, 97, 0, 0, 0, 0, 0, 0, 31, 65, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1,
0, 0, 0, 45, 97, 1, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 85, 7,
1, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 135, 3, 0, 0, 0, 0, 0, 0, 95, 54, 0, 0, 0, 0, 0,
0, 24, 1, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 45, 97, 10, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 123, 97, 0, 0, 0, 0, 0, 0, 45, 66, 1, 0, 0, 0, 0, 0, 191, 36,
0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 191, 82, 0, 0, 0, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 254, 6, 0, 0, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 123, 26,
160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 240, 255, 255, 255, 123, 26, 224,
255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0,
0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 24, 1, 0, 0, 176, 64, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0, 24, 1, 0, 0, 200, 5, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255,
255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 168, 255, 255,
255, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255, 133, 16, 0, 0, 32, 2, 0, 0,
121, 166, 176, 255, 0, 0, 0, 0, 121, 167, 168, 255, 0, 0, 0, 0, 121, 162, 184, 255, 0, 0, 0, 0,
191, 113, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 21, 6, 5, 0, 0, 0, 0, 0, 21, 7,
4, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0,
0, 133, 16, 0, 0, 6, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0,
0, 227, 2, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 157, 255, 255, 255, 149, 0, 0, 0, 0,
0, 0, 0, 133, 16, 0, 0, 181, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 180, 255,
255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 6, 2, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191,
22, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 1, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0,
0, 45, 18, 1, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 1, 0, 0, 0, 85, 3, 41, 0,
0, 0, 0, 0, 121, 105, 8, 0, 0, 0, 0, 0, 191, 151, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0,
45, 23, 1, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 37, 7, 1, 0, 4, 0, 0, 0, 183, 7, 0, 0, 4,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 192, 255, 255, 255, 183, 8, 0, 0, 0, 0, 0, 0,
191, 114, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 48, 0, 0, 0, 183, 5, 0, 0,
0, 0, 0, 0, 133, 16, 0, 0, 218, 6, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 121, 162, 200, 255, 0, 0, 0,
0, 85, 2, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 85, 1, 1, 0, 0, 0, 0, 0, 183, 8, 0, 0, 8,
0, 0, 0, 121, 162, 192, 255, 0, 0, 0, 0, 21, 9, 6, 0, 0, 0, 0, 0, 121, 97, 0, 0, 0, 0, 0, 0,
183, 3, 0, 0, 8, 0, 0, 0, 123, 58, 248, 255, 0, 0, 0, 0, 39, 9, 0, 0, 48, 0, 0, 0, 123, 154,
240, 255, 0, 0, 0, 0, 5, 0, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 208, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0,
0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 131, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 13, 0, 0, 0, 121,
161, 208, 255, 0, 0, 0, 0, 85, 1, 4, 0, 1, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6,
0, 0, 0, 0, 0, 133, 16, 0, 0, 200, 1, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216,
255, 0, 0, 0, 0, 123, 118, 8, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0,
0, 121, 161, 216, 255, 0, 0, 0, 0, 133, 16, 0, 0, 200, 1, 0, 0, 133, 16, 0, 0, 255, 255, 255,
255, 191, 56, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 85, 8, 4,
0, 0, 0, 0, 0, 123, 118, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0,
5, 0, 29, 0, 0, 0, 0, 0, 121, 65, 0, 0, 0, 0, 0, 0, 21, 1, 13, 0, 0, 0, 0, 0, 121, 66, 8, 0, 0,
0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 21, 7, 20, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191,
130, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 174, 255, 255, 255, 21, 0, 12, 0, 0, 0, 0, 0, 5, 0, 17,
0, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 173, 255,
255, 255, 21, 0, 7, 0, 0, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 21, 7, 9, 0, 0, 0, 0, 0, 191, 113,
0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 163, 255, 255, 255, 21, 0, 1, 0,
0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 123, 118, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 191,
135, 0, 0, 0, 0, 0, 0, 5, 0, 4, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 191, 128, 0, 0, 0, 0,
0, 0, 123, 6, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 123, 118,
16, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 123, 42, 192, 255, 0,
0, 0, 0, 121, 34, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 208, 255, 255, 255,
183, 7, 0, 0, 0, 0, 0, 0, 123, 42, 152, 255, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 183, 4, 0,
0, 48, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 132, 6, 0, 0, 183, 1, 0, 0, 1, 0, 0,
0, 121, 162, 216, 255, 0, 0, 0, 0, 85, 2, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 85, 1, 1,
0, 0, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0, 133, 16, 0, 0, 133, 1, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 121, 168, 208, 255, 0, 0, 0, 0, 123, 106, 128, 255, 0, 0, 0,
0, 21, 8, 10, 0, 0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16,
0, 0, 124, 255, 255, 255, 121, 163, 192, 255, 0, 0, 0, 0, 21, 0, 1, 0, 0, 0, 0, 0, 5, 0, 6, 0,
0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 127, 1, 0,
0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 112, 0, 0, 0, 0, 0, 0, 121, 163, 192, 255, 0, 0, 0,
0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 10, 224, 255, 0, 0, 0, 0, 183,
9, 0, 0, 8, 0, 0, 0, 121, 161, 152, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 21, 1, 33,
0, 0, 0, 0, 0, 183, 9, 0, 0, 8, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0,
183, 4, 0, 0, 0, 0, 0, 0, 5, 0, 47, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 48,
0, 0, 0, 191, 3, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0, 115, 83, 42, 0, 0, 0, 0, 0, 115,
99, 41, 0, 0, 0, 0, 0, 115, 67, 40, 0, 0, 0, 0, 0, 121, 161, 160, 255, 0, 0, 0, 0, 123, 19, 32,
0, 0, 0, 0, 0, 123, 115, 24, 0, 0, 0, 0, 0, 123, 131, 16, 0, 0, 0, 0, 0, 121, 161, 168, 255, 0,
0, 0, 0, 123, 19, 8, 0, 0, 0, 0, 0, 121, 161, 176, 255, 0, 0, 0, 0, 123, 19, 0, 0, 0, 0, 0, 0,
97, 161, 251, 255, 0, 0, 0, 0, 99, 19, 43, 0, 0, 0, 0, 0, 113, 161, 255, 255, 0, 0, 0, 0, 115,
19, 47, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 121, 163, 192,
255, 0, 0, 0, 0, 121, 164, 200, 255, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0, 8, 0, 0,
0, 191, 7, 0, 0, 0, 0, 0, 0, 121, 161, 152, 255, 0, 0, 0, 0, 45, 65, 19, 0, 0, 0, 0, 0, 191,
49, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 121, 162, 240, 255,
0, 0, 0, 0, 121, 164, 128, 255, 0, 0, 0, 0, 123, 36, 24, 0, 0, 0, 0, 0, 121, 162, 232, 255, 0,
0, 0, 0, 123, 36, 16, 0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 123, 36, 8, 0, 0, 0, 0, 0,
7, 9, 0, 0, 8, 0, 0, 0, 191, 50, 0, 0, 0, 0, 0, 0, 15, 146, 0, 0, 0, 0, 0, 0, 123, 36, 32, 0,
0, 0, 0, 0, 123, 20, 40, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 15, 19, 0, 0, 0, 0, 0, 0,
123, 52, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0,
0, 0, 0, 0, 113, 17, 0, 0, 0, 0, 0, 0, 123, 74, 200, 255, 0, 0, 0, 0, 21, 1, 59, 0, 255, 0, 0,
0, 45, 18, 4, 0, 0, 0, 0, 0, 24, 3, 0, 0, 192, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0,
141, 2, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 123, 154, 184, 255, 0, 0, 0, 0, 39, 1, 0, 0,
48, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 121, 70, 8, 0, 0, 0, 0, 0,
121, 104, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 37, 8, 2, 0, 1, 0, 0, 0, 133, 16, 0, 0,
255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 113, 69, 41, 0, 0, 0, 0, 0, 113, 67, 40,
0, 0, 0, 0, 0, 121, 73, 0, 0, 0, 0, 0, 0, 123, 154, 176, 255, 0, 0, 0, 0, 123, 134, 0, 0, 0, 0,
0, 0, 121, 72, 16, 0, 0, 0, 0, 0, 121, 132, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 1, 0, 0, 0, 37, 4, 1,
0, 1, 0, 0, 0, 5, 0, 244, 255, 0, 0, 0, 0, 123, 106, 168, 255, 0, 0, 0, 0, 123, 72, 0, 0, 0, 0,
0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 1, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 85, 4, 1,
0, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 1, 0, 0, 0, 121, 169, 184, 255, 0, 0, 0,
0, 85, 3, 1, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 15, 23, 0, 0, 0, 0, 0, 0, 113, 113, 42,
0, 0, 0, 0, 0, 85, 1, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 121, 113, 32, 0, 0, 0, 0, 0,
123, 26, 160, 255, 0, 0, 0, 0, 121, 119, 24, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 93,
18, 159, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 122,
136, 255, 0, 0, 0, 0, 191, 87, 0, 0, 0, 0, 0, 0, 123, 106, 144, 255, 0, 0, 0, 0, 191, 70, 0, 0,
0, 0, 0, 0, 133, 16, 0, 0, 7, 255, 255, 255, 191, 100, 0, 0, 0, 0, 0, 0, 121, 166, 144, 255, 0,
0, 0, 0, 191, 117, 0, 0, 0, 0, 0, 0, 121, 167, 136, 255, 0, 0, 0, 0, 121, 160, 224, 255, 0, 0,
0, 0, 121, 162, 240, 255, 0, 0, 0, 0, 5, 0, 145, 255, 0, 0, 0, 0, 123, 42, 184, 255, 0, 0, 0,
0, 191, 150, 0, 0, 0, 0, 0, 0, 15, 54, 0, 0, 0, 0, 0, 0, 113, 97, 3, 0, 0, 0, 0, 0, 123, 26,
160, 255, 0, 0, 0, 0, 113, 97, 2, 0, 0, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 113, 97, 1, 0,
0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 183, 1, 0, 0, 32, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0,
133, 16, 0, 0, 236, 254, 255, 255, 85, 0, 2, 0, 0, 0, 0, 0, 183, 1, 0, 0, 32, 0, 0, 0, 5, 0,
84, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 16, 16, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0,
0, 123, 16, 8, 0, 0, 0, 0, 0, 123, 16, 0, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
72, 0, 0, 0, 123, 10, 144, 255, 0, 0, 0, 0, 123, 16, 24, 0, 0, 0, 0, 0, 121, 103, 80, 0, 0, 0,
0, 0, 99, 118, 4, 0, 0, 0, 0, 0, 183, 1, 0, 0, 40, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0, 133, 16,
0, 0, 219, 254, 255, 255, 191, 8, 0, 0, 0, 0, 0, 0, 85, 8, 2, 0, 0, 0, 0, 0, 183, 1, 0, 0, 40,
0, 0, 0, 5, 0, 66, 0, 0, 0, 0, 0, 121, 161, 160, 255, 0, 0, 0, 0, 191, 19, 0, 0, 0, 0, 0, 0,
183, 4, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 183, 5, 0, 0, 1, 0, 0, 0, 121, 162, 184,
255, 0, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 121, 163, 168, 255, 0, 0,
0, 0, 123, 72, 16, 0, 0, 0, 0, 0, 183, 4, 0, 0, 1, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 183, 4, 0,
0, 0, 0, 0, 0, 121, 163, 176, 255, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0,
0, 183, 0, 0, 0, 0, 0, 0, 0, 123, 10, 168, 255, 0, 0, 0, 0, 123, 74, 176, 255, 0, 0, 0, 0, 191,
99, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 40, 0, 0, 0, 123, 58, 160, 255, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0,
0, 0, 123, 24, 8, 0, 0, 0, 0, 0, 123, 24, 0, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 121,
163, 192, 255, 0, 0, 0, 0, 15, 49, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 88, 0, 0, 0, 123, 24, 24, 0,
0, 0, 0, 0, 123, 120, 32, 0, 0, 0, 0, 0, 15, 121, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 95, 40, 0, 0,
87, 9, 0, 0, 248, 255, 255, 255, 191, 49, 0, 0, 0, 0, 0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 121, 23,
0, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 93, 18, 7, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0,
0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 90, 184, 255, 0, 0, 0, 0, 133, 16, 0, 0, 180,
254, 255, 255, 121, 165, 184, 255, 0, 0, 0, 0, 121, 163, 192, 255, 0, 0, 0, 0, 121, 162, 240,
255, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 48, 0, 0, 0, 121, 160, 224, 255, 0, 0,
0, 0, 191, 4, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 115, 84, 42, 0, 0, 0, 0, 0, 121, 161,
176, 255, 0, 0, 0, 0, 115, 20, 41, 0, 0, 0, 0, 0, 121, 161, 168, 255, 0, 0, 0, 0, 115, 20, 40,
0, 0, 0, 0, 0, 123, 116, 32, 0, 0, 0, 0, 0, 121, 161, 160, 255, 0, 0, 0, 0, 123, 20, 24, 0, 0,
0, 0, 0, 123, 132, 16, 0, 0, 0, 0, 0, 121, 161, 144, 255, 0, 0, 0, 0, 123, 20, 8, 0, 0, 0, 0,
0, 123, 100, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 1, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 5, 0, 68,
255, 0, 0, 0, 0, 183, 2, 0, 0, 8, 0, 0, 0, 133, 16, 0, 0, 156, 0, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 133, 16, 0, 0, 14, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 24, 1, 0, 0, 238,
62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 46, 0, 0, 0, 133, 16, 0, 0, 4, 0, 0, 0, 133,
16, 0, 0, 249, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 3, 0, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255,
255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0,
139, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0,
0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 15, 52, 0, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 45, 66, 1,
0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 1, 0, 0, 0, 85, 1, 27, 0, 0, 0, 0, 0,
121, 97, 8, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0, 45, 71, 1, 0,
0, 0, 0, 0, 191, 71, 0, 0, 0, 0, 0, 0, 37, 7, 1, 0, 8, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21,
1, 6, 0, 0, 0, 0, 0, 121, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 248, 255, 0,
0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 208, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 114, 0,
0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 57, 0, 0, 0, 121, 161, 208, 255, 0, 0,
0, 0, 85, 1, 4, 0, 1, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 133,
16, 0, 0, 92, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216, 255, 0, 0, 0, 0, 123,
118, 8, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161, 216, 255,
0, 0, 0, 0, 133, 16, 0, 0, 92, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 22, 0, 0, 0, 0,
0, 0, 191, 35, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 45, 50, 1,
0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 1, 0, 0, 0, 85, 1, 27, 0, 0, 0, 0, 0,
121, 97, 8, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 103, 7, 0, 0, 1, 0, 0, 0, 45, 55, 1, 0,
0, 0, 0, 0, 191, 55, 0, 0, 0, 0, 0, 0, 37, 7, 1, 0, 8, 0, 0, 0, 183, 7, 0, 0, 8, 0, 0, 0, 21,
1, 6, 0, 0, 0, 0, 0, 121, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 123, 58, 248, 255, 0,
0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 208, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 232, 255, 255, 255, 191, 114, 0,
0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 13, 0, 0, 0, 121, 161, 208, 255, 0, 0,
0, 0, 85, 1, 4, 0, 1, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 85, 2, 6, 0, 0, 0, 0, 0, 133,
16, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 121, 161, 216, 255, 0, 0, 0, 0, 123,
118, 8, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 161, 216, 255,
0, 0, 0, 0, 133, 16, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 191, 56, 0, 0, 0, 0,
0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 85, 8, 4, 0, 0, 0, 0, 0, 123, 118,
8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0,
121, 65, 0, 0, 0, 0, 0, 0, 21, 1, 13, 0, 0, 0, 0, 0, 121, 66, 8, 0, 0, 0, 0, 0, 85, 2, 6, 0, 0,
0, 0, 0, 21, 7, 20, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 22, 254, 255, 255, 21, 0, 12, 0, 0, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 191, 131, 0, 0,
0, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 21, 254, 255, 255, 21, 0, 7, 0, 0, 0, 0,
0, 5, 0, 12, 0, 0, 0, 0, 0, 21, 7, 9, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 130, 0,
0, 0, 0, 0, 0, 133, 16, 0, 0, 11, 254, 255, 255, 21, 0, 1, 0, 0, 0, 0, 0, 5, 0, 6, 0, 0, 0, 0,
0, 123, 118, 8, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 191, 135, 0, 0, 0, 0, 0, 0, 5, 0, 4,
0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 191, 128, 0, 0, 0, 0, 0, 0, 123, 6, 8, 0, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 22, 0, 0, 0, 0, 0, 0, 123, 118, 16, 0, 0, 0, 0, 0, 149, 0, 0, 0,
0, 0, 0, 0, 24, 1, 0, 0, 56, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 17, 0, 0, 0, 24,
3, 0, 0, 216, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 68, 1, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 133, 16, 0, 0, 5, 0, 0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0,
250, 253, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 98, 255, 255, 255, 133,
16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 111, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255,
255, 191, 38, 0, 0, 0, 0, 0, 0, 191, 23, 0, 0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 121, 99,
40, 0, 0, 0, 0, 0, 121, 97, 0, 0, 0, 0, 0, 0, 121, 98, 8, 0, 0, 0, 0, 0, 191, 36, 0, 0, 0, 0,
0, 0, 103, 4, 0, 0, 4, 0, 0, 0, 21, 4, 9, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 191, 21, 0,
0, 0, 0, 0, 0, 7, 5, 0, 0, 8, 0, 0, 0, 121, 88, 0, 0, 0, 0, 0, 0, 15, 8, 0, 0, 0, 0, 0, 0, 7,
5, 0, 0, 16, 0, 0, 0, 7, 4, 0, 0, 240, 255, 255, 255, 191, 128, 0, 0, 0, 0, 0, 0, 85, 4, 250,
255, 0, 0, 0, 0, 21, 3, 17, 0, 0, 0, 0, 0, 21, 2, 6, 0, 0, 0, 0, 0, 121, 17, 8, 0, 0, 0, 0, 0,
85, 1, 4, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 16,
0, 0, 0, 45, 130, 22, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 15, 34, 0, 0, 0, 0, 0, 0, 183,
1, 0, 0, 0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 45, 40, 1, 0, 0, 0, 0,
0, 183, 3, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 1, 0, 0, 0, 191, 40, 0, 0, 0, 0, 0, 0, 85, 3, 12, 0,
0, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 21, 8, 9, 0, 0, 0, 0, 0, 191,
129, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 197, 253, 255, 255, 191, 129,
0, 0, 0, 0, 0, 0, 85, 0, 4, 0, 0, 0, 0, 0, 191, 129, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0,
0, 133, 16, 0, 0, 201, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 183, 2, 0, 0, 0, 0, 0,
0, 123, 39, 16, 0, 0, 0, 0, 0, 123, 23, 8, 0, 0, 0, 0, 0, 123, 7, 0, 0, 0, 0, 0, 0, 123, 122,
200, 255, 0, 0, 0, 0, 191, 167, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 208, 255, 255, 255, 191, 113, 0,
0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 138, 4, 0,
0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 200, 255, 255, 255, 24, 2, 0, 0, 40, 65, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 84, 1, 0, 0, 21, 0, 11, 0, 0, 0,
0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255, 255, 24, 1, 0, 0, 73, 63, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 51, 0, 0, 0, 24, 4, 0, 0, 8, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 24, 5, 0, 0, 240, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 41, 1, 0, 0, 133, 16, 0,
0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0,
0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 37,
1, 12, 0, 127, 0, 0, 0, 121, 98, 16, 0, 0, 0, 0, 0, 121, 97, 8, 0, 0, 0, 0, 0, 93, 18, 3, 0, 0,
0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 68, 255, 255, 255, 121, 98, 16, 0, 0, 0, 0,
0, 121, 97, 0, 0, 0, 0, 0, 0, 15, 33, 0, 0, 0, 0, 0, 0, 115, 113, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0,
1, 0, 0, 0, 123, 38, 16, 0, 0, 0, 0, 0, 5, 0, 66, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 99,
42, 252, 255, 0, 0, 0, 0, 183, 2, 0, 0, 0, 8, 0, 0, 45, 18, 19, 0, 0, 0, 0, 0, 191, 113, 0, 0,
0, 0, 0, 0, 103, 1, 0, 0, 32, 0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 183, 2, 0, 0, 0, 0, 1, 0, 45,
18, 1, 0, 0, 0, 0, 0, 5, 0, 22, 0, 0, 0, 0, 0, 87, 7, 0, 0, 63, 0, 0, 0, 71, 7, 0, 0, 128, 0,
0, 0, 115, 122, 254, 255, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 12, 0, 0, 0, 71,
2, 0, 0, 224, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 119, 1, 0, 0, 6, 0, 0, 0, 87, 1, 0, 0,
63, 0, 0, 0, 71, 1, 0, 0, 128, 0, 0, 0, 115, 26, 253, 255, 0, 0, 0, 0, 183, 7, 0, 0, 3, 0, 0,
0, 5, 0, 26, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 63, 0, 0, 0, 71, 1, 0, 0,
128, 0, 0, 0, 115, 26, 253, 255, 0, 0, 0, 0, 119, 7, 0, 0, 6, 0, 0, 0, 71, 7, 0, 0, 192, 0, 0,
0, 115, 122, 252, 255, 0, 0, 0, 0, 183, 7, 0, 0, 2, 0, 0, 0, 5, 0, 17, 0, 0, 0, 0, 0, 87, 7, 0,
0, 63, 0, 0, 0, 71, 7, 0, 0, 128, 0, 0, 0, 115, 122, 255, 255, 0, 0, 0, 0, 191, 18, 0, 0, 0, 0,
0, 0, 119, 2, 0, 0, 18, 0, 0, 0, 71, 2, 0, 0, 240, 0, 0, 0, 115, 42, 252, 255, 0, 0, 0, 0, 191,
18, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 6, 0, 0, 0, 87, 2, 0, 0, 63, 0, 0, 0, 71, 2, 0, 0, 128, 0,
0, 0, 115, 42, 254, 255, 0, 0, 0, 0, 119, 1, 0, 0, 12, 0, 0, 0, 87, 1, 0, 0, 63, 0, 0, 0, 71,
1, 0, 0, 128, 0, 0, 0, 115, 26, 253, 255, 0, 0, 0, 0, 183, 7, 0, 0, 4, 0, 0, 0, 121, 104, 16,
0, 0, 0, 0, 0, 121, 97, 8, 0, 0, 0, 0, 0, 31, 129, 0, 0, 0, 0, 0, 0, 61, 113, 5, 0, 0, 0, 0, 0,
191, 97, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 191, 115, 0, 0, 0, 0, 0, 0, 133, 16, 0,
0, 216, 254, 255, 255, 121, 104, 16, 0, 0, 0, 0, 0, 121, 97, 0, 0, 0, 0, 0, 0, 15, 129, 0, 0,
0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 252, 255, 255, 255, 191, 115, 0, 0, 0, 0,
0, 0, 133, 16, 0, 0, 37, 4, 0, 0, 15, 120, 0, 0, 0, 0, 0, 0, 123, 134, 16, 0, 0, 0, 0, 0, 149,
0, 0, 0, 0, 0, 0, 0, 191, 54, 0, 0, 0, 0, 0, 0, 191, 40, 0, 0, 0, 0, 0, 0, 121, 23, 0, 0, 0, 0,
0, 0, 121, 121, 16, 0, 0, 0, 0, 0, 121, 113, 8, 0, 0, 0, 0, 0, 31, 145, 0, 0, 0, 0, 0, 0, 61,
97, 5, 0, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 146, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0,
0, 0, 0, 133, 16, 0, 0, 195, 254, 255, 255, 121, 121, 16, 0, 0, 0, 0, 0, 121, 113, 0, 0, 0, 0,
0, 0, 15, 145, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 133,
16, 0, 0, 17, 4, 0, 0, 15, 105, 0, 0, 0, 0, 0, 0, 123, 151, 16, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0,
0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 148, 255, 255,
255, 183, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 123, 26,
200, 255, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 208, 255, 255, 255, 191, 97, 0,
0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 2, 4, 0, 0, 191, 161, 0, 0, 0, 0, 0,
0, 7, 1, 0, 0, 200, 255, 255, 255, 24, 2, 0, 0, 40, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 99,
0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 204, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0,
0, 0, 133, 16, 0, 0, 255, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 149, 0, 0, 0, 0, 0,
0, 0, 24, 0, 0, 0, 114, 113, 109, 195, 0, 0, 0, 0, 189, 57, 113, 200, 149, 0, 0, 0, 0, 0, 0, 0,
191, 24, 0, 0, 0, 0, 0, 0, 121, 38, 32, 0, 0, 0, 0, 0, 121, 39, 40, 0, 0, 0, 0, 0, 121, 116,
24, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 24, 2, 0, 0, 153, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 183, 3, 0, 0, 12, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 85, 0, 93, 0,
0, 0, 0, 0, 121, 129, 16, 0, 0, 0, 0, 0, 21, 1, 26, 0, 0, 0, 0, 0, 123, 26, 152, 255, 0, 0, 0,
0, 24, 1, 0, 0, 40, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 168, 255, 0, 0, 0, 0, 191, 161,
0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 152, 255, 255, 255, 123, 26, 160, 255, 0, 0, 0, 0, 191, 161, 0,
0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0,
0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0,
0, 24, 1, 0, 0, 168, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 183, 9,
0, 0, 1, 0, 0, 0, 123, 154, 248, 255, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 208,
255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 159, 0, 0,
0, 85, 0, 66, 0, 0, 0, 0, 0, 5, 0, 33, 0, 0, 0, 0, 0, 121, 137, 0, 0, 0, 0, 0, 0, 121, 129, 8,
0, 0, 0, 0, 0, 121, 18, 24, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 2, 0, 0,
0, 24, 1, 0, 0, 244, 188, 199, 236, 0, 0, 0, 0, 30, 169, 242, 126, 93, 16, 25, 0, 0, 0, 0, 0,
123, 154, 152, 255, 0, 0, 0, 0, 24, 1, 0, 0, 192, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26,
168, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 152, 255, 255, 255, 123, 26, 160,
255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255,
0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0,
123, 26, 216, 255, 0, 0, 0, 0, 24, 1, 0, 0, 168, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26,
208, 255, 0, 0, 0, 0, 183, 9, 0, 0, 1, 0, 0, 0, 123, 154, 248, 255, 0, 0, 0, 0, 191, 163, 0, 0,
0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0,
0, 133, 16, 0, 0, 125, 0, 0, 0, 85, 0, 32, 0, 0, 0, 0, 0, 121, 129, 24, 0, 0, 0, 0, 0, 191, 18,
0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 20, 0, 0, 0, 123, 42, 192, 255, 0, 0, 0, 0, 24, 2, 0, 0, 160, 53,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 42, 200, 255, 0, 0, 0, 0, 123, 42, 184, 255, 0, 0, 0, 0,
191, 18, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 16, 0, 0, 0, 123, 42, 176, 255, 0, 0, 0, 0, 24, 2, 0, 0,
248, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 42, 168, 255, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0,
0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255, 255, 123, 26, 240, 255, 0, 0, 0,
0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 183, 1, 0, 0, 3, 0, 0, 0, 123, 26,
248, 255, 0, 0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 24, 1, 0, 0, 88, 65, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 123, 26, 208, 255, 0, 0, 0, 0, 191, 163, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 208, 255, 255,
255, 191, 97, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 93, 0, 0, 0, 191, 9,
0, 0, 0, 0, 0, 0, 191, 144, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 24, 4, 0, 0, 152, 63,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 74, 224, 255, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 123, 74,
232, 255, 0, 0, 0, 0, 123, 74, 208, 255, 0, 0, 0, 0, 183, 4, 0, 0, 1, 0, 0, 0, 123, 74, 200,
255, 0, 0, 0, 0, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 240, 255, 255, 255, 123, 74, 192, 255,
0, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0,
0, 0, 7, 1, 0, 0, 192, 255, 255, 255, 191, 50, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 29, 0, 0, 0,
133, 16, 0, 0, 255, 255, 255, 255, 123, 42, 168, 255, 0, 0, 0, 0, 123, 26, 160, 255, 0, 0, 0,
0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 26, 208, 255, 0, 0, 0, 0,
183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2, 0, 0, 0, 123, 26,
216, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 24, 1, 0, 0, 200, 65, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255, 255,
255, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0, 0, 120, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123,
26, 248, 255, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 168, 255, 255, 255, 123, 26, 224, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
176, 255, 255, 255, 191, 50, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 1, 0, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 123, 42, 248, 255, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0, 0, 136,
65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 232, 255, 0, 0, 0, 0, 24, 1, 0, 0, 152, 63, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0,
224, 255, 255, 255, 133, 16, 0, 0, 241, 253, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 123,
42, 152, 255, 0, 0, 0, 0, 123, 26, 144, 255, 0, 0, 0, 0, 123, 74, 168, 255, 0, 0, 0, 0, 123,
58, 160, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 224, 255, 255, 255, 123, 26,
208, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 192, 255, 0, 0, 0, 0, 183, 1, 0, 0, 2,
0, 0, 0, 123, 26, 216, 255, 0, 0, 0, 0, 123, 26, 184, 255, 0, 0, 0, 0, 24, 1, 0, 0, 232, 65, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 26, 176, 255, 0, 0, 0, 0, 24, 1, 0, 0, 144, 59, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 123, 26, 248, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 160, 255,
255, 255, 123, 26, 240, 255, 0, 0, 0, 0, 24, 1, 0, 0, 248, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123, 26, 232, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 144, 255, 255, 255, 123,
26, 224, 255, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 176, 255, 255, 255, 191, 82,
0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 213, 255, 255, 255, 133, 16, 0, 0, 255, 255, 255, 255, 183, 4,
0, 0, 3, 0, 0, 0, 115, 74, 248, 255, 0, 0, 0, 0, 24, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0,
0, 123, 74, 240, 255, 0, 0, 0, 0, 123, 42, 232, 255, 0, 0, 0, 0, 123, 26, 224, 255, 0, 0, 0, 0,
183, 7, 0, 0, 0, 0, 0, 0, 123, 122, 208, 255, 0, 0, 0, 0, 123, 122, 192, 255, 0, 0, 0, 0, 121,
56, 16, 0, 0, 0, 0, 0, 123, 58, 184, 255, 0, 0, 0, 0, 85, 8, 30, 0, 0, 0, 0, 0, 121, 54, 40, 0,
0, 0, 0, 0, 21, 6, 107, 0, 0, 0, 0, 0, 121, 161, 184, 255, 0, 0, 0, 0, 121, 24, 32, 0, 0, 0, 0,
0, 183, 7, 0, 0, 0, 0, 0, 0, 103, 6, 0, 0, 4, 0, 0, 0, 7, 8, 0, 0, 8, 0, 0, 0, 121, 25, 0, 0,
0, 0, 0, 0, 7, 9, 0, 0, 8, 0, 0, 0, 121, 147, 0, 0, 0, 0, 0, 0, 85, 3, 1, 0, 0, 0, 0, 0, 5, 0,
6, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 146, 248,
255, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 110, 0, 0, 0,
0, 0, 121, 129, 248, 255, 0, 0, 0, 0, 121, 131, 0, 0, 0, 0, 0, 0, 191, 162, 0, 0, 0, 0, 0, 0,
7, 2, 0, 0, 192, 255, 255, 255, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 104, 0, 0, 0, 0, 0, 7, 7, 0,
0, 1, 0, 0, 0, 7, 8, 0, 0, 16, 0, 0, 0, 7, 9, 0, 0, 16, 0, 0, 0, 7, 6, 0, 0, 240, 255, 255,
255, 21, 6, 80, 0, 0, 0, 0, 0, 5, 0, 235, 255, 0, 0, 0, 0, 121, 57, 24, 0, 0, 0, 0, 0, 21, 9,
77, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 48, 0, 0, 0, 39, 9, 0, 0, 56, 0, 0, 0,
121, 161, 184, 255, 0, 0, 0, 0, 121, 22, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 8, 0, 0, 0, 121, 99, 0,
0, 0, 0, 0, 0, 85, 3, 14, 0, 0, 0, 0, 0, 121, 161, 184, 255, 0, 0, 0, 0, 121, 18, 32, 0, 0, 0,
0, 0, 97, 129, 248, 255, 0, 0, 0, 0, 99, 26, 244, 255, 0, 0, 0, 0, 113, 129, 0, 0, 0, 0, 0, 0,
115, 26, 248, 255, 0, 0, 0, 0, 97, 129, 252, 255, 0, 0, 0, 0, 99, 26, 240, 255, 0, 0, 0, 0,
121, 129, 240, 255, 0, 0, 0, 0, 121, 132, 232, 255, 0, 0, 0, 0, 21, 4, 10, 0, 0, 0, 0, 0, 183,
3, 0, 0, 0, 0, 0, 0, 21, 4, 10, 0, 1, 0, 0, 0, 5, 0, 19, 0, 0, 0, 0, 0, 121, 161, 232, 255, 0,
0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 121, 98, 248, 255, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0,
0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 68, 0, 0, 0, 0, 0, 5, 0, 235, 255, 0, 0, 0, 0, 183, 3,
0, 0, 1, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 103, 1, 0, 0, 4, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0,
15, 20, 0, 0, 0, 0, 0, 0, 121, 69, 8, 0, 0, 0, 0, 0, 24, 0, 0, 0, 184, 28, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 93, 5, 3, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 121, 65, 0, 0, 0, 0, 0, 0, 121, 17,
0, 0, 0, 0, 0, 0, 123, 26, 200, 255, 0, 0, 0, 0, 123, 58, 192, 255, 0, 0, 0, 0, 121, 129, 224,
255, 0, 0, 0, 0, 121, 132, 216, 255, 0, 0, 0, 0, 21, 4, 3, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0,
0, 0, 21, 4, 3, 0, 1, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 183, 3, 0, 0, 1, 0, 0, 0, 5, 0, 10, 0,
0, 0, 0, 0, 103, 1, 0, 0, 4, 0, 0, 0, 191, 36, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 121,
69, 8, 0, 0, 0, 0, 0, 24, 0, 0, 0, 184, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 5, 3, 0, 0, 0, 0,
0, 183, 3, 0, 0, 1, 0, 0, 0, 121, 65, 0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 123, 26,
216, 255, 0, 0, 0, 0, 123, 58, 208, 255, 0, 0, 0, 0, 121, 129, 208, 255, 0, 0, 0, 0, 103, 1, 0,
0, 4, 0, 0, 0, 15, 18, 0, 0, 0, 0, 0, 0, 121, 33, 0, 0, 0, 0, 0, 0, 121, 35, 8, 0, 0, 0, 0, 0,
191, 162, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 192, 255, 255, 255, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0,
24, 0, 0, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 7, 8, 0, 0, 56, 0, 0, 0, 7, 6, 0, 0, 16, 0, 0, 0, 7,
9, 0, 0, 200, 255, 255, 255, 85, 9, 185, 255, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 103, 2,
0, 0, 4, 0, 0, 0, 121, 163, 184, 255, 0, 0, 0, 0, 121, 49, 0, 0, 0, 0, 0, 0, 15, 33, 0, 0, 0,
0, 0, 0, 121, 50, 8, 0, 0, 0, 0, 0, 45, 114, 1, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 45,
114, 1, 0, 0, 0, 0, 0, 5, 0, 7, 0, 0, 0, 0, 0, 121, 162, 232, 255, 0, 0, 0, 0, 121, 36, 24, 0,
0, 0, 0, 0, 121, 19, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 121, 161, 224, 255, 0, 0, 0,
0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 2, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 5, 0, 1, 0, 0,
0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 80, 8, 240, 0, 0, 0, 0, 21,
2, 9, 0, 0, 0, 0, 0, 191, 56, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 17, 0, 97, 25, 48, 0, 0, 0,
0, 0, 191, 146, 0, 0, 0, 0, 0, 0, 87, 2, 0, 0, 1, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 21, 2, 7,
0, 0, 0, 0, 0, 183, 7, 0, 0, 43, 0, 0, 0, 5, 0, 3, 0, 0, 0, 0, 0, 191, 56, 0, 0, 0, 0, 0, 0,
183, 7, 0, 0, 45, 0, 0, 0, 97, 25, 48, 0, 0, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 1,
0, 0, 0, 123, 10, 232, 255, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191, 146, 0, 0, 0, 0, 0, 0,
87, 2, 0, 0, 4, 0, 0, 0, 21, 2, 1, 0, 0, 0, 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 121, 82, 0, 240, 0,
0, 0, 0, 123, 42, 224, 255, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 21, 2, 31, 0, 1, 0, 0, 0,
191, 22, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 200, 0, 0, 0, 183, 7, 0,
0, 1, 0, 0, 0, 85, 0, 62, 0, 0, 0, 0, 0, 5, 0, 54, 0, 0, 0, 0, 0, 123, 122, 216, 255, 0, 0, 0,
0, 183, 2, 0, 0, 0, 0, 0, 0, 123, 74, 240, 255, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0, 21, 4,
8, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 121, 164, 240, 255, 0, 0, 0, 0, 191, 48, 0, 0, 0,
0, 0, 0, 5, 0, 9, 0, 0, 0, 0, 0, 15, 114, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 7, 4, 0, 0,
255, 255, 255, 255, 85, 4, 5, 0, 0, 0, 0, 0, 15, 98, 0, 0, 0, 0, 0, 0, 191, 38, 0, 0, 0, 0, 0,
0, 121, 164, 240, 255, 0, 0, 0, 0, 121, 167, 216, 255, 0, 0, 0, 0, 5, 0, 228, 255, 0, 0, 0, 0,
113, 8, 0, 0, 0, 0, 0, 0, 103, 8, 0, 0, 56, 0, 0, 0, 199, 8, 0, 0, 56, 0, 0, 0, 183, 7, 0, 0,
1, 0, 0, 0, 101, 8, 242, 255, 191, 255, 255, 255, 183, 7, 0, 0, 0, 0, 0, 0, 5, 0, 240, 255, 0,
0, 0, 0, 121, 24, 8, 0, 0, 0, 0, 0, 61, 134, 22, 0, 0, 0, 0, 0, 87, 9, 0, 0, 8, 0, 0, 0, 123,
26, 208, 255, 0, 0, 0, 0, 21, 9, 1, 0, 0, 0, 0, 0, 5, 0, 33, 0, 0, 0, 0, 0, 123, 58, 192, 255,
0, 0, 0, 0, 123, 74, 240, 255, 0, 0, 0, 0, 113, 18, 56, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0,
0, 21, 2, 1, 0, 3, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 31, 104, 0, 0, 0, 0, 0, 0, 183, 9, 0, 0,
0, 0, 0, 0, 87, 1, 0, 0, 3, 0, 0, 0, 123, 138, 200, 255, 0, 0, 0, 0, 21, 1, 53, 0, 0, 0, 0, 0,
21, 1, 49, 0, 1, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 119, 9, 0, 0, 1, 0, 0, 0, 7, 8, 0, 0, 1,
0, 0, 0, 119, 8, 0, 0, 1, 0, 0, 0, 123, 138, 200, 255, 0, 0, 0, 0, 5, 0, 46, 0, 0, 0, 0, 0,
191, 22, 0, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 145, 0, 0, 0, 183, 7, 0,
0, 1, 0, 0, 0, 85, 0, 7, 0, 0, 0, 0, 0, 121, 97, 32, 0, 0, 0, 0, 0, 121, 98, 40, 0, 0, 0, 0, 0,
121, 36, 24, 0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 121, 163, 232, 255, 0, 0, 0, 0,
141, 0, 0, 0, 4, 0, 0, 0, 191, 7, 0, 0, 0, 0, 0, 0, 87, 7, 0, 0, 1, 0, 0, 0, 191, 112, 0, 0, 0,
0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 97, 18, 52, 0, 0, 0, 0, 0, 123, 42, 216, 255, 0, 0, 0, 0,
183, 2, 0, 0, 48, 0, 0, 0, 99, 33, 52, 0, 0, 0, 0, 0, 113, 18, 56, 0, 0, 0, 0, 0, 123, 42, 200,
255, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 115, 113, 56, 0, 0, 0,
0, 0, 133, 16, 0, 0, 123, 0, 0, 0, 85, 0, 242, 255, 0, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0,
113, 18, 56, 0, 0, 0, 0, 0, 183, 1, 0, 0, 1, 0, 0, 0, 21, 2, 1, 0, 3, 0, 0, 0, 191, 33, 0, 0,
0, 0, 0, 0, 31, 104, 0, 0, 0, 0, 0, 0, 183, 9, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 3, 0, 0, 0, 123,
138, 240, 255, 0, 0, 0, 0, 21, 1, 65, 0, 0, 0, 0, 0, 21, 1, 61, 0, 1, 0, 0, 0, 191, 137, 0, 0,
0, 0, 0, 0, 119, 9, 0, 0, 1, 0, 0, 0, 7, 8, 0, 0, 1, 0, 0, 0, 119, 8, 0, 0, 1, 0, 0, 0, 123,
138, 240, 255, 0, 0, 0, 0, 5, 0, 58, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 200,
255, 0, 0, 0, 0, 191, 137, 0, 0, 0, 0, 0, 0, 123, 122, 216, 255, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0,
0, 0, 121, 161, 208, 255, 0, 0, 0, 0, 97, 18, 52, 0, 0, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0,
121, 24, 40, 0, 0, 0, 0, 0, 121, 22, 32, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0,
255, 255, 255, 255, 21, 9, 6, 0, 0, 0, 0, 0, 121, 131, 32, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0,
0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 85, 0, 207, 255, 0, 0, 0, 0, 5,
0, 248, 255, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0, 21, 1, 203,
255, 0, 0, 17, 0, 121, 161, 208, 255, 0, 0, 0, 0, 121, 162, 216, 255, 0, 0, 0, 0, 121, 163,
192, 255, 0, 0, 0, 0, 121, 164, 240, 255, 0, 0, 0, 0, 133, 16, 0, 0, 78, 0, 0, 0, 85, 0, 197,
255, 0, 0, 0, 0, 121, 162, 208, 255, 0, 0, 0, 0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0,
0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 121, 162, 224, 255, 0, 0, 0, 0, 121, 163, 232, 255, 0, 0,
0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 189, 255, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 121,
161, 208, 255, 0, 0, 0, 0, 121, 24, 40, 0, 0, 0, 0, 0, 121, 22, 32, 0, 0, 0, 0, 0, 121, 169,
200, 255, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 29, 121, 8, 0, 0, 0, 0, 0, 121, 131, 32, 0,
0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0,
0, 7, 7, 0, 0, 1, 0, 0, 0, 21, 0, 248, 255, 0, 0, 0, 0, 7, 7, 0, 0, 255, 255, 255, 255, 191,
113, 0, 0, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 45, 25, 172, 255, 0, 0, 0, 0, 183, 7, 0, 0, 0,
0, 0, 0, 5, 0, 170, 255, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 123, 26, 240, 255, 0, 0, 0, 0,
191, 137, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0, 97, 18, 52,
0, 0, 0, 0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 24, 40, 0, 0, 0, 0, 0, 121, 22, 32, 0, 0, 0,
0, 0, 183, 7, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0, 255, 255, 255, 255, 21, 9, 6, 0, 0, 0, 0, 0, 121,
131, 32, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 141, 0, 0,
0, 3, 0, 0, 0, 85, 0, 153, 255, 0, 0, 0, 0, 5, 0, 248, 255, 0, 0, 0, 0, 183, 7, 0, 0, 1, 0, 0,
0, 121, 161, 248, 255, 0, 0, 0, 0, 21, 1, 149, 255, 0, 0, 17, 0, 121, 162, 208, 255, 0, 0, 0,
0, 121, 33, 32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 121,
162, 224, 255, 0, 0, 0, 0, 121, 163, 232, 255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0,
141, 255, 0, 0, 0, 0, 183, 9, 0, 0, 0, 0, 0, 0, 121, 161, 208, 255, 0, 0, 0, 0, 121, 24, 40, 0,
0, 0, 0, 0, 121, 22, 32, 0, 0, 0, 0, 0, 121, 161, 240, 255, 0, 0, 0, 0, 29, 145, 9, 0, 0, 0, 0,
0, 121, 131, 32, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 121, 162, 248, 255, 0, 0, 0, 0, 141,
0, 0, 0, 3, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 21, 0, 248, 255, 0, 0, 0, 0, 7, 9, 0, 0, 255, 255,
255, 255, 121, 161, 240, 255, 0, 0, 0, 0, 45, 145, 126, 255, 0, 0, 0, 0, 121, 161, 208, 255, 0,
0, 0, 0, 121, 162, 200, 255, 0, 0, 0, 0, 115, 33, 56, 0, 0, 0, 0, 0, 121, 162, 216, 255, 0, 0,
0, 0, 99, 33, 52, 0, 0, 0, 0, 0, 5, 0, 204, 255, 0, 0, 0, 0, 191, 70, 0, 0, 0, 0, 0, 0, 191,
55, 0, 0, 0, 0, 0, 0, 191, 24, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 103, 1, 0, 0, 32,
0, 0, 0, 119, 1, 0, 0, 32, 0, 0, 0, 21, 1, 7, 0, 0, 0, 17, 0, 121, 129, 32, 0, 0, 0, 0, 0, 121,
131, 40, 0, 0, 0, 0, 0, 121, 51, 32, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 191, 1, 0, 0, 0,
0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0, 85, 1, 2, 0, 0, 0, 0, 0, 183, 0, 0, 0, 0, 0, 0, 0, 85, 7, 1,
0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 121, 129, 32, 0, 0, 0, 0, 0, 121, 130, 40, 0, 0, 0, 0,
0, 121, 36, 24, 0, 0, 0, 0, 0, 191, 114, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 141, 0,
0, 0, 4, 0, 0, 0, 5, 0, 248, 255, 0, 0, 0, 0, 121, 20, 16, 0, 0, 0, 0, 0, 121, 21, 0, 0, 0, 0,
0, 0, 21, 5, 2, 0, 1, 0, 0, 0, 21, 4, 3, 0, 1, 0, 0, 0, 5, 0, 101, 0, 0, 0, 0, 0, 21, 4, 1, 0,
1, 0, 0, 0, 5, 0, 72, 0, 0, 0, 0, 0, 123, 90, 248, 255, 0, 0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0,
191, 36, 0, 0, 0, 0, 0, 0, 123, 58, 232, 255, 0, 0, 0, 0, 15, 52, 0, 0, 0, 0, 0, 0, 121, 19,
24, 0, 0, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 191, 40, 0, 0, 0, 0, 0, 0, 21, 3, 40, 0, 0,
0, 0, 0, 183, 5, 0, 0, 0, 0, 0, 0, 121, 168, 240, 255, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0,
191, 137, 0, 0, 0, 0, 0, 0, 29, 73, 53, 0, 0, 0, 0, 0, 191, 152, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0,
1, 0, 0, 0, 113, 144, 0, 0, 0, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 103, 6, 0, 0, 56, 0, 0, 0,
199, 6, 0, 0, 56, 0, 0, 0, 101, 6, 24, 0, 255, 255, 255, 255, 191, 152, 0, 0, 0, 0, 0, 0, 7, 8,
0, 0, 2, 0, 0, 0, 183, 2, 0, 0, 224, 0, 0, 0, 45, 2, 20, 0, 0, 0, 0, 0, 191, 152, 0, 0, 0, 0,
0, 0, 7, 8, 0, 0, 3, 0, 0, 0, 183, 2, 0, 0, 240, 0, 0, 0, 45, 2, 16, 0, 0, 0, 0, 0, 113, 150,
1, 0, 0, 0, 0, 0, 87, 6, 0, 0, 63, 0, 0, 0, 103, 6, 0, 0, 12, 0, 0, 0, 113, 146, 2, 0, 0, 0, 0,
0, 87, 2, 0, 0, 63, 0, 0, 0, 103, 2, 0, 0, 6, 0, 0, 0, 79, 98, 0, 0, 0, 0, 0, 0, 113, 150, 3,
0, 0, 0, 0, 0, 87, 6, 0, 0, 63, 0, 0, 0, 79, 98, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 18, 0, 0, 0,
87, 0, 0, 0, 0, 0, 28, 0, 79, 2, 0, 0, 0, 0, 0, 0, 191, 152, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 4,
0, 0, 0, 21, 2, 22, 0, 0, 0, 17, 0, 7, 7, 0, 0, 1, 0, 0, 0, 31, 149, 0, 0, 0, 0, 0, 0, 15, 133,
0, 0, 0, 0, 0, 0, 45, 115, 219, 255, 0, 0, 0, 0, 29, 72, 17, 0, 0, 0, 0, 0, 113, 132, 0, 0, 0,
0, 0, 0, 183, 2, 0, 0, 240, 0, 0, 0, 45, 66, 66, 0, 0, 0, 0, 0, 113, 130, 1, 0, 0, 0, 0, 0, 87,
2, 0, 0, 63, 0, 0, 0, 103, 2, 0, 0, 12, 0, 0, 0, 113, 131, 2, 0, 0, 0, 0, 0, 87, 3, 0, 0, 63,
0, 0, 0, 103, 3, 0, 0, 6, 0, 0, 0, 79, 35, 0, 0, 0, 0, 0, 0, 113, 130, 3, 0, 0, 0, 0, 0, 87, 2,
0, 0, 63, 0, 0, 0, 79, 35, 0, 0, 0, 0, 0, 0, 103, 4, 0, 0, 18, 0, 0, 0, 87, 4, 0, 0, 0, 0, 28,
0, 79, 67, 0, 0, 0, 0, 0, 0, 85, 3, 52, 0, 0, 0, 17, 0, 121, 163, 232, 255, 0, 0, 0, 0, 121,
162, 240, 255, 0, 0, 0, 0, 121, 164, 248, 255, 0, 0, 0, 0, 21, 4, 1, 0, 1, 0, 0, 0, 5, 0, 27,
0, 0, 0, 0, 0, 183, 8, 0, 0, 0, 0, 0, 0, 121, 25, 8, 0, 0, 0, 0, 0, 21, 3, 8, 0, 0, 0, 0, 0,
183, 8, 0, 0, 0, 0, 0, 0, 191, 52, 0, 0, 0, 0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 5, 0, 13, 0, 0,
0, 0, 0, 15, 8, 0, 0, 0, 0, 0, 0, 7, 5, 0, 0, 1, 0, 0, 0, 7, 4, 0, 0, 255, 255, 255, 255, 85,
4, 9, 0, 0, 0, 0, 0, 61, 152, 15, 0, 0, 0, 0, 0, 123, 42, 240, 255, 0, 0, 0, 0, 123, 58, 232,
255, 0, 0, 0, 0, 113, 21, 56, 0, 0, 0, 0, 0, 183, 7, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0,
0, 21, 5, 18, 0, 3, 0, 0, 0, 191, 84, 0, 0, 0, 0, 0, 0, 5, 0, 16, 0, 0, 0, 0, 0, 113, 86, 0, 0,
0, 0, 0, 0, 103, 6, 0, 0, 56, 0, 0, 0, 199, 6, 0, 0, 56, 0, 0, 0, 183, 0, 0, 0, 1, 0, 0, 0,
101, 6, 238, 255, 191, 255, 255, 255, 183, 0, 0, 0, 0, 0, 0, 0, 5, 0, 236, 255, 0, 0, 0, 0,
121, 21, 32, 0, 0, 0, 0, 0, 121, 17, 40, 0, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0, 0, 0, 191, 81, 0,
0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 87, 6, 0, 0, 1, 0, 0, 0,
191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 31, 137, 0, 0, 0, 0, 0, 0, 87, 4, 0, 0, 3,
0, 0, 0, 123, 154, 224, 255, 0, 0, 0, 0, 21, 4, 19, 0, 0, 0, 0, 0, 21, 4, 15, 0, 1, 0, 0, 0,
191, 151, 0, 0, 0, 0, 0, 0, 119, 7, 0, 0, 1, 0, 0, 0, 7, 9, 0, 0, 1, 0, 0, 0, 119, 9, 0, 0, 1,
0, 0, 0, 123, 154, 224, 255, 0, 0, 0, 0, 5, 0, 12, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0,
121, 166, 232, 255, 0, 0, 0, 0, 121, 167, 240, 255, 0, 0, 0, 0, 21, 5, 59, 0, 0, 0, 0, 0, 45,
86, 49, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 191, 99, 0, 0, 0, 0, 0, 0, 29, 101, 55, 0, 0,
0, 0, 0, 5, 0, 56, 0, 0, 0, 0, 0, 183, 2, 0, 0, 0, 0, 0, 0, 123, 42, 224, 255, 0, 0, 0, 0, 191,
151, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 1, 0, 0, 0, 97, 24, 52, 0, 0, 0, 0, 0, 121, 18, 40, 0, 0, 0,
0, 0, 123, 42, 248, 255, 0, 0, 0, 0, 121, 25, 32, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 7,
7, 0, 0, 255, 255, 255, 255, 21, 7, 7, 0, 0, 0, 0, 0, 121, 161, 248, 255, 0, 0, 0, 0, 121, 19,
32, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191, 130, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0,
0, 0, 85, 0, 216, 255, 0, 0, 0, 0, 5, 0, 247, 255, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 191,
129, 0, 0, 0, 0, 0, 0, 21, 1, 212, 255, 0, 0, 17, 0, 121, 161, 248, 255, 0, 0, 0, 0, 121, 20,
24, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 121, 162, 240, 255, 0, 0, 0, 0, 121, 163, 232,
255, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 85, 0, 205, 255, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0,
0, 121, 167, 224, 255, 0, 0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 29, 103, 9, 0, 0, 0, 0, 0, 121,
161, 248, 255, 0, 0, 0, 0, 121, 19, 32, 0, 0, 0, 0, 0, 191, 145, 0, 0, 0, 0, 0, 0, 191, 130, 0,
0, 0, 0, 0, 0, 141, 0, 0, 0, 3, 0, 0, 0, 7, 6, 0, 0, 1, 0, 0, 0, 21, 0, 247, 255, 0, 0, 0, 0,
7, 6, 0, 0, 255, 255, 255, 255, 191, 97, 0, 0, 0, 0, 0, 0, 183, 6, 0, 0, 1, 0, 0, 0, 45, 23,
190, 255, 0, 0, 0, 0, 183, 6, 0, 0, 0, 0, 0, 0, 5, 0, 188, 255, 0, 0, 0, 0, 191, 114, 0, 0, 0,
0, 0, 0, 15, 82, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 113, 34, 0, 0, 0, 0, 0, 0, 103, 2,
0, 0, 56, 0, 0, 0, 199, 2, 0, 0, 56, 0, 0, 0, 183, 0, 0, 0, 192, 255, 255, 255, 191, 83, 0, 0,
0, 0, 0, 0, 109, 32, 2, 0, 0, 0, 0, 0, 191, 53, 0, 0, 0, 0, 0, 0, 191, 116, 0, 0, 0, 0, 0, 0,
21, 4, 1, 0, 0, 0, 0, 0, 191, 86, 0, 0, 0, 0, 0, 0, 123, 106, 232, 255, 0, 0, 0, 0, 21, 4, 1,
0, 0, 0, 0, 0, 191, 71, 0, 0, 0, 0, 0, 0, 123, 122, 240, 255, 0, 0, 0, 0, 5, 0, 132, 255, 0, 0,
0, 0, 183, 3, 0, 0, 39, 0, 0, 0, 97, 17, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 16, 39, 0, 0, 45, 20,
32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 55, 1, 0, 0, 16, 39, 0,
0, 191, 21, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 16, 39, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 31, 80, 0,
0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0, 255, 255, 0, 0, 55, 5, 0, 0, 100, 0, 0,
0, 191, 86, 0, 0, 0, 0, 0, 0, 39, 6, 0, 0, 100, 0, 0, 0, 31, 96, 0, 0, 0, 0, 0, 0, 191, 166, 0,
0, 0, 0, 0, 0, 7, 6, 0, 0, 217, 255, 255, 255, 15, 54, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 1, 0, 0,
0, 24, 7, 0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 87, 0, 0, 0, 0, 0, 0, 105, 117, 0,
0, 0, 0, 0, 0, 107, 86, 35, 0, 0, 0, 0, 0, 87, 0, 0, 0, 255, 255, 0, 0, 103, 0, 0, 0, 1, 0, 0,
0, 24, 5, 0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0,
0, 0, 0, 0, 107, 86, 37, 0, 0, 0, 0, 0, 7, 3, 0, 0, 252, 255, 255, 255, 37, 4, 226, 255, 255,
224, 245, 5, 7, 3, 0, 0, 39, 0, 0, 0, 37, 1, 10, 0, 99, 0, 0, 0, 183, 4, 0, 0, 10, 0, 0, 0,
109, 20, 1, 0, 0, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0, 0, 7, 3, 0, 0, 255, 255, 255, 255, 191, 164,
0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 217, 255, 255, 255, 15, 52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0,
0, 0, 115, 20, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0, 0, 191, 20, 0, 0, 0, 0, 0, 0, 87, 4, 0,
0, 255, 255, 0, 0, 55, 4, 0, 0, 100, 0, 0, 0, 191, 69, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 100, 0,
0, 0, 31, 81, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 255, 255, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 5,
0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 21, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255,
255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0,
105, 85, 0, 0, 0, 0, 0, 0, 107, 81, 0, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 5, 0, 227,
255, 0, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 4, 0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 20, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255, 255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0,
0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 105, 68, 0, 0, 0, 0, 0, 0, 107, 65, 0, 0, 0,
0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0,
123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0, 39, 0, 0, 0, 31, 49, 0, 0, 0, 0, 0, 0, 123, 26, 8,
240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33, 0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0,
0, 24, 3, 0, 0, 152, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 4, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0,
227, 253, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 39, 0, 0, 0, 121, 17, 0, 0, 0, 0,
0, 0, 183, 4, 0, 0, 16, 39, 0, 0, 45, 20, 32, 0, 0, 0, 0, 0, 183, 3, 0, 0, 0, 0, 0, 0, 191, 20,
0, 0, 0, 0, 0, 0, 55, 1, 0, 0, 16, 39, 0, 0, 191, 21, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 16, 39, 0,
0, 191, 64, 0, 0, 0, 0, 0, 0, 31, 80, 0, 0, 0, 0, 0, 0, 191, 5, 0, 0, 0, 0, 0, 0, 87, 5, 0, 0,
255, 255, 0, 0, 55, 5, 0, 0, 100, 0, 0, 0, 191, 86, 0, 0, 0, 0, 0, 0, 39, 6, 0, 0, 100, 0, 0,
0, 31, 96, 0, 0, 0, 0, 0, 0, 191, 166, 0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 217, 255, 255, 255, 15,
54, 0, 0, 0, 0, 0, 0, 103, 5, 0, 0, 1, 0, 0, 0, 24, 7, 0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 87, 0, 0, 0, 0, 0, 0, 105, 117, 0, 0, 0, 0, 0, 0, 107, 86, 35, 0, 0, 0, 0, 0, 87, 0,
0, 0, 255, 255, 0, 0, 103, 0, 0, 0, 1, 0, 0, 0, 24, 5, 0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 5, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0, 0, 0, 0, 0, 107, 86, 37, 0, 0, 0, 0, 0, 7, 3, 0,
0, 252, 255, 255, 255, 37, 4, 226, 255, 255, 224, 245, 5, 7, 3, 0, 0, 39, 0, 0, 0, 101, 1, 10,
0, 99, 0, 0, 0, 183, 4, 0, 0, 10, 0, 0, 0, 109, 20, 1, 0, 0, 0, 0, 0, 5, 0, 26, 0, 0, 0, 0, 0,
7, 3, 0, 0, 255, 255, 255, 255, 191, 164, 0, 0, 0, 0, 0, 0, 7, 4, 0, 0, 217, 255, 255, 255, 15,
52, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 48, 0, 0, 0, 115, 20, 0, 0, 0, 0, 0, 0, 5, 0, 29, 0, 0, 0, 0,
0, 191, 20, 0, 0, 0, 0, 0, 0, 87, 4, 0, 0, 255, 255, 0, 0, 55, 4, 0, 0, 100, 0, 0, 0, 191, 69,
0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 100, 0, 0, 0, 31, 81, 0, 0, 0, 0, 0, 0, 87, 1, 0, 0, 255, 255,
0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 5, 0, 0, 221, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 21, 0,
0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255, 255, 255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217,
255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 105, 85, 0, 0, 0, 0, 0, 0, 107, 81, 0, 0, 0, 0, 0, 0,
191, 65, 0, 0, 0, 0, 0, 0, 5, 0, 227, 255, 0, 0, 0, 0, 103, 1, 0, 0, 1, 0, 0, 0, 24, 4, 0, 0,
221, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 254, 255, 255,
255, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217, 255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 105,
68, 0, 0, 0, 0, 0, 0, 107, 65, 0, 0, 0, 0, 0, 0, 191, 161, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 217,
255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 123, 26, 0, 240, 0, 0, 0, 0, 183, 1, 0, 0, 39, 0, 0,
0, 31, 49, 0, 0, 0, 0, 0, 0, 123, 26, 8, 240, 0, 0, 0, 0, 191, 165, 0, 0, 0, 0, 0, 0, 191, 33,
0, 0, 0, 0, 0, 0, 183, 2, 0, 0, 1, 0, 0, 0, 24, 3, 0, 0, 152, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
183, 4, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 136, 253, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 121, 33,
32, 0, 0, 0, 0, 0, 121, 34, 40, 0, 0, 0, 0, 0, 121, 36, 24, 0, 0, 0, 0, 0, 24, 2, 0, 0, 165,
64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 5, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 149, 0,
0, 0, 0, 0, 0, 0, 121, 19, 0, 0, 0, 0, 0, 0, 121, 17, 8, 0, 0, 0, 0, 0, 121, 20, 24, 0, 0, 0,
0, 0, 191, 49, 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 4, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 191, 36,
0, 0, 0, 0, 0, 0, 121, 17, 0, 0, 0, 0, 0, 0, 121, 19, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0,
0, 191, 65, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 112, 254, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191,
36, 0, 0, 0, 0, 0, 0, 121, 19, 8, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 191, 65, 0, 0, 0,
0, 0, 0, 133, 16, 0, 0, 106, 254, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 121, 38, 40, 0, 0, 0, 0,
0, 121, 39, 32, 0, 0, 0, 0, 0, 121, 18, 0, 0, 0, 0, 0, 0, 191, 168, 0, 0, 0, 0, 0, 0, 7, 8, 0,
0, 208, 255, 255, 255, 191, 129, 0, 0, 0, 0, 0, 0, 183, 3, 0, 0, 48, 0, 0, 0, 133, 16, 0, 0, 5,
0, 0, 0, 191, 113, 0, 0, 0, 0, 0, 0, 191, 98, 0, 0, 0, 0, 0, 0, 191, 131, 0, 0, 0, 0, 0, 0,
133, 16, 0, 0, 209, 252, 255, 255, 149, 0, 0, 0, 0, 0, 0, 0, 191, 22, 0, 0, 0, 0, 0, 0, 191,
52, 0, 0, 0, 0, 0, 0, 119, 4, 0, 0, 3, 0, 0, 0, 191, 65, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 249,
255, 255, 255, 15, 49, 0, 0, 0, 0, 0, 0, 37, 1, 24, 0, 15, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0,
183, 5, 0, 0, 8, 0, 0, 0, 45, 53, 11, 0, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 0, 0, 183, 5, 0, 0, 0,
0, 0, 0, 191, 96, 0, 0, 0, 0, 0, 0, 15, 16, 0, 0, 0, 0, 0, 0, 191, 39, 0, 0, 0, 0, 0, 0, 15,
23, 0, 0, 0, 0, 0, 0, 121, 119, 0, 0, 0, 0, 0, 0, 123, 112, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 8, 0,
0, 0, 7, 5, 0, 0, 1, 0, 0, 0, 45, 84, 247, 255, 0, 0, 0, 0, 125, 49, 11, 0, 0, 0, 0, 0, 191,
100, 0, 0, 0, 0, 0, 0, 15, 20, 0, 0, 0, 0, 0, 0, 191, 37, 0, 0, 0, 0, 0, 0, 15, 21, 0, 0, 0, 0,
0, 0, 113, 85, 0, 0, 0, 0, 0, 0, 115, 84, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 1, 0, 0, 0, 109, 19,
248, 255, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0, 191, 97, 0, 0, 0, 0, 0, 0, 133, 16, 0, 0, 255,
255, 255, 255, 191, 96, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 47, 67, 0, 0, 0, 0, 0, 0,
47, 37, 0, 0, 0, 0, 0, 0, 15, 53, 0, 0, 0, 0, 0, 0, 191, 32, 0, 0, 0, 0, 0, 0, 119, 0, 0, 0,
32, 0, 0, 0, 191, 67, 0, 0, 0, 0, 0, 0, 119, 3, 0, 0, 32, 0, 0, 0, 191, 54, 0, 0, 0, 0, 0, 0,
47, 6, 0, 0, 0, 0, 0, 0, 15, 101, 0, 0, 0, 0, 0, 0, 103, 4, 0, 0, 32, 0, 0, 0, 119, 4, 0, 0,
32, 0, 0, 0, 191, 70, 0, 0, 0, 0, 0, 0, 47, 6, 0, 0, 0, 0, 0, 0, 103, 2, 0, 0, 32, 0, 0, 0,
119, 2, 0, 0, 32, 0, 0, 0, 47, 36, 0, 0, 0, 0, 0, 0, 191, 64, 0, 0, 0, 0, 0, 0, 119, 0, 0, 0,
32, 0, 0, 0, 15, 96, 0, 0, 0, 0, 0, 0, 191, 6, 0, 0, 0, 0, 0, 0, 119, 6, 0, 0, 32, 0, 0, 0, 15,
101, 0, 0, 0, 0, 0, 0, 47, 35, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 32, 0, 0, 0, 119, 0, 0, 0, 32,
0, 0, 0, 15, 48, 0, 0, 0, 0, 0, 0, 191, 2, 0, 0, 0, 0, 0, 0, 119, 2, 0, 0, 32, 0, 0, 0, 15, 37,
0, 0, 0, 0, 0, 0, 123, 81, 8, 0, 0, 0, 0, 0, 103, 0, 0, 0, 32, 0, 0, 0, 103, 4, 0, 0, 32, 0, 0,
0, 119, 4, 0, 0, 32, 0, 0, 0, 79, 64, 0, 0, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0,
0, 0, 0, 0, 72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33, 115, 114, 99, 47, 101,
110, 116, 114, 121, 112, 111, 105, 110, 116, 46, 114, 115, 69, 114, 114, 111, 114, 58, 32, 109,
101, 109, 111, 114, 121, 32, 97, 108, 108, 111, 99, 97, 116, 105, 111, 110, 32, 102, 97, 105,
108, 101, 100, 44, 32, 111, 117, 116, 32, 111, 102, 32, 109, 101, 109, 111, 114, 121, 108, 105,
98, 114, 97, 114, 121, 47, 97, 108, 108, 111, 99, 47, 115, 114, 99, 47, 114, 97, 119, 95, 118,
101, 99, 46, 114, 115, 99, 97, 112, 97, 99, 105, 116, 121, 32, 111, 118, 101, 114, 102, 108,
111, 119, 97, 32, 102, 111, 114, 109, 97, 116, 116, 105, 110, 103, 32, 116, 114, 97, 105, 116,
32, 105, 109, 112, 108, 101, 109, 101, 110, 116, 97, 116, 105, 111, 110, 32, 114, 101, 116,
117, 114, 110, 101, 100, 32, 97, 110, 32, 101, 114, 114, 111, 114, 108, 105, 98, 114, 97, 114,
121, 47, 97, 108, 108, 111, 99, 47, 115, 114, 99, 47, 102, 109, 116, 46, 114, 115, 0, 0, 0, 0,
58, 112, 97, 110, 105, 99, 107, 101, 100, 32, 97, 116, 32, 39, 39, 44, 32, 105, 110, 100, 101,
120, 32, 111, 117, 116, 32, 111, 102, 32, 98, 111, 117, 110, 100, 115, 58, 32, 116, 104, 101,
32, 108, 101, 110, 32, 105, 115, 32, 32, 98, 117, 116, 32, 116, 104, 101, 32, 105, 110, 100,
101, 120, 32, 105, 115, 32, 58, 32, 48, 48, 48, 49, 48, 50, 48, 51, 48, 52, 48, 53, 48, 54, 48,
55, 48, 56, 48, 57, 49, 48, 49, 49, 49, 50, 49, 51, 49, 52, 49, 53, 49, 54, 49, 55, 49, 56, 49,
57, 50, 48, 50, 49, 50, 50, 50, 51, 50, 52, 50, 53, 50, 54, 50, 55, 50, 56, 50, 57, 51, 48, 51,
49, 51, 50, 51, 51, 51, 52, 51, 53, 51, 54, 51, 55, 51, 56, 51, 57, 52, 48, 52, 49, 52, 50, 52,
51, 52, 52, 52, 53, 52, 54, 52, 55, 52, 56, 52, 57, 53, 48, 53, 49, 53, 50, 53, 51, 53, 52, 53,
53, 53, 54, 53, 55, 53, 56, 53, 57, 54, 48, 54, 49, 54, 50, 54, 51, 54, 52, 54, 53, 54, 54, 54,
55, 54, 56, 54, 57, 55, 48, 55, 49, 55, 50, 55, 51, 55, 52, 55, 53, 55, 54, 55, 55, 55, 56, 55,
57, 56, 48, 56, 49, 56, 50, 56, 51, 56, 52, 56, 53, 56, 54, 56, 55, 56, 56, 56, 57, 57, 48, 57,
49, 57, 50, 57, 51, 57, 52, 57, 53, 57, 54, 57, 55, 57, 56, 57, 57, 69, 114, 114, 111, 114, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 221, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221, 62, 0, 0,
17, 0, 0, 0, 0, 0, 0, 0, 94, 1, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 28, 63, 0, 0, 28, 0, 0, 0, 0, 0,
0, 0, 6, 2, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 124, 63, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 85, 2, 0, 0,
28, 0, 0, 0, 0, 0, 0, 0, 232, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 80, 59, 0, 0, 0, 0, 0, 0, 232, 17, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 128, 27, 0, 0, 0, 0, 0, 0, 40, 28, 0, 0, 0, 0, 0, 0, 72, 28, 0, 0, 0, 0, 0, 0, 152,
63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 63, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 152, 63, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 28, 0, 0, 0, 0, 0, 0, 165, 63, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 166, 63, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 63, 0, 0, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 201, 63, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 63, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 219, 63, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0,
0, 0, 0, 64, 6, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 250, 255,
255, 111, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 184, 66, 0, 0, 0, 0, 0,
0, 11, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 72, 67, 0, 0, 0,
0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 10, 0, 0, 0, 18, 0, 1, 0, 32, 1, 0, 0, 0, 0, 0, 0, 176, 1, 0, 0, 0, 0, 0, 0, 21,
0, 0, 0, 18, 0, 1, 0, 176, 4, 0, 0, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 16, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 108, 95, 108, 111, 103, 95, 0, 101, 110, 116, 114,
121, 112, 111, 105, 110, 116, 0, 99, 117, 115, 116, 111, 109, 95, 112, 97, 110, 105, 99, 0, 97,
98, 111, 114, 116, 0, 115, 111, 108, 95, 109, 101, 109, 99, 112, 121, 95, 0, 0, 0, 0, 0, 88, 1,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 248, 4, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 16,
5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 12, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
96, 17, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 240, 21, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 8, 22, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 24, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 136, 24, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 160, 24, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 0, 0, 0, 0, 176, 24, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 28, 0, 0, 0, 0, 0, 0, 8,
0, 0, 0, 0, 0, 0, 0, 24, 29, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 96, 29, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 29, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 30, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 30, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 31, 0,
0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 31, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232,
31, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 32, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
32, 33, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 33, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 192, 33, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 33, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 112, 34, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 34, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 184, 34, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 144, 37, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 48, 38, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 72, 54, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 128, 54, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 55, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 184, 55, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 56,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 32, 57, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88,
57, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 48, 58, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
144, 58, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 59, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 104, 59, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 176, 64, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 192, 64, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 216, 64, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 240, 64, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 8, 65, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 32, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 40, 65, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 64, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 72, 65, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 80, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 88, 65,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 104, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
120, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 136, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
0, 0, 160, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 168, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 184, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 200, 65, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 216, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 232, 65, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 248, 65, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 112, 1, 0, 0, 0, 0,
0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 136, 5, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 160, 17, 0,
0, 0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 176, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 3, 0, 0, 0,
176, 7, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 232, 7, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0,
0, 0, 200, 9, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 48, 10, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0,
4, 0, 0, 0, 104, 12, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 176, 12, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 4, 0, 0, 0, 184, 12, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 72, 17, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 4, 0, 0, 0, 88, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 136, 17, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 152, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 184,
17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 192, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0,
0, 200, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 208, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0,
4, 0, 0, 0, 224, 17, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 16, 19, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 4, 0, 0, 0, 72, 19, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 112, 20, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 4, 0, 0, 0, 168, 20, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 32, 22, 0, 0,
0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 48, 22, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 64, 22,
0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 80, 22, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0,
96, 22, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 224, 23, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4,
0, 0, 0, 200, 24, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 192, 28, 0, 0, 0, 0, 0, 0, 10, 0,
0, 0, 4, 0, 0, 0, 200, 28, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 200, 32, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 4, 0, 0, 0, 168, 33, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 8, 34, 0, 0, 0,
0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 8, 35, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 144, 61, 0,
0, 0, 0, 0, 0, 10, 0, 0, 0, 5, 0, 0, 0, 0, 46, 116, 101, 120, 116, 0, 46, 100, 121, 110, 115,
116, 114, 0, 46, 100, 97, 116, 97, 46, 114, 101, 108, 46, 114, 111, 0, 46, 114, 101, 108, 46,
100, 121, 110, 0, 46, 100, 121, 110, 115, 121, 109, 0, 46, 100, 121, 110, 97, 109, 105, 99, 0,
46, 115, 104, 115, 116, 114, 116, 97, 98, 0, 46, 114, 111, 100, 97, 116, 97, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 176, 61, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0,
0, 0, 1, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 208, 62, 0, 0, 0, 0, 0, 0, 208, 62, 0, 0, 0, 0, 0,
0, 218, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 176, 64, 0, 0, 0, 0, 0, 0, 176, 64, 0,
0, 0, 0, 0, 0, 88, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 8, 66, 0, 0, 0, 0, 0, 0, 8,
66, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
16, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 11, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 184, 66, 0, 0, 0, 0,
0, 0, 184, 66, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 72, 67, 0,
0, 0, 0, 0, 0, 72, 67, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 128,
67, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 0, 0, 0, 64, 6, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0,
0, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 73, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
];
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/test_programs/mod.rs
|
pub mod hello_world;
pub mod transfer_cpi;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/runtime/bank.rs
|
use std::{
cell::RefCell,
collections::HashMap,
num::NonZeroUsize,
rc::Rc,
sync::{Arc, RwLock},
};
use serde::{Deserialize, Serialize};
use solana_bpf_loader_program::process_instruction as process_bpf_loader_instruction;
use solana_program_runtime::{
compute_budget::ComputeBudget, executor_cache::TransactionExecutorCache,
invoke_context::BuiltinProgram, log_collector::LogCollector, sysvar_cache::SysvarCache,
timings::ExecuteTimings,
};
use solana_sdk::{
account::{to_account, Account, AccountSharedData, ReadableAccount, WritableAccount},
account_utils::StateMut,
bpf_loader,
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
clock::Clock,
feature_set::{self, FeatureSet},
hash::Hash,
instruction::CompiledInstruction,
message::{
v0::{LoadedAddresses, MessageAddressTableLookup},
AddressLoaderError, Message, SanitizedMessage, VersionedMessage,
},
native_loader,
native_token::LAMPORTS_PER_SOL,
pubkey::Pubkey,
rent::Rent,
signature::{Keypair, Signature},
signer::Signer,
slot_history::Slot,
system_instruction, system_program,
sysvar::{self, instructions::construct_instructions_data, Sysvar},
transaction::{
self, AddressLoader, SanitizedTransaction, TransactionError, VersionedTransaction,
},
transaction_context::{
ExecutionRecord, IndexOfAccount, TransactionAccount, TransactionContext,
TransactionReturnData,
},
};
use crate::{
serde::{bank_accounts, bank_keypair},
types::SimulateTransactionResult,
utils::{create_blockhash, get_sanitized_tx_from_versioned_tx},
};
use super::{
message_processor::MessageProcessor,
system_instruction_processor::{
get_system_account_kind, process_system_instruction, SystemAccountKind,
},
transaction_history::{ConfirmedTransactionMeta, TransactionData},
};
#[derive(Serialize, Deserialize)]
pub struct PgBank {
/// Where all the accounts are stored
#[serde(with = "bank_accounts")]
accounts: BankAccounts,
/// Where all the transactions are stored.
///
/// Currently transactions are only
/// getting stored in the memory and not in IndexedDB for both to not use
/// unnecessary space since txs are the biggest contributing factor to the
/// size of the bank and because `VersionedMessage` is not getting properly
/// de-serialized.
#[serde(skip)]
txs: BankTxs,
/// Bank's slot (i.e. block)
slot: Slot,
/// Bank's block height
block_height: u64,
/// Bank's first hash
genesis_hash: Hash,
/// Bank's latest blockhash
latest_blockhash: Hash,
/// The keypair that signs airdrop transactions
#[serde(with = "bank_keypair")]
airdrop_kp: Keypair,
/// Essential programs that don't get deployed with transactions
#[serde(skip)]
builtin_programs: Vec<BuiltinProgram>,
/// Where all the sysvars are stored
#[serde(skip)]
sysvar_cache: RwLock<SysvarCache>,
/// Active/inactive features(not able to change yet)
#[serde(skip)]
feature_set: Rc<FeatureSet>,
}
impl Default for PgBank {
fn default() -> Self {
let genesis_hash = create_blockhash(b"playnet");
Self {
accounts: HashMap::new(),
txs: HashMap::new(),
slot: 0,
block_height: 0,
genesis_hash,
latest_blockhash: genesis_hash,
airdrop_kp: Keypair::new(),
builtin_programs: vec![],
sysvar_cache: RwLock::new(SysvarCache::default()),
feature_set: Rc::new(FeatureSet::default()),
}
}
}
impl PgBank {
const LAMPORTS_PER_SIGNATURE: u64 = 0;
pub fn new(maybe_bank_string: Option<String>) -> Self {
let mut bank = match maybe_bank_string {
Some(bank_string) => serde_json::from_str::<Self>(&bank_string).unwrap_or_default(),
None => Self::default(),
};
// Add native accounts
let mut add_native_programs = |program_id: Pubkey| {
let mut account = Account::new(1, 0, &native_loader::id());
account.set_executable(true);
bank.accounts.insert(program_id, account);
};
add_native_programs(bpf_loader::id());
add_native_programs(bpf_loader_upgradeable::id());
add_native_programs(system_program::id());
// Add sysvar accounts
fn add_sysvar_account<S: Sysvar>(bank: &mut PgBank) -> S {
let default = S::default();
let mut account = Account::new(
1,
bincode::serialized_size(&default).unwrap() as usize,
&sysvar::id(),
);
to_account(&default, &mut account).unwrap();
bank.accounts.insert(S::id(), account);
default
}
let clock = add_sysvar_account::<Clock>(&mut bank);
let rent = add_sysvar_account::<Rent>(&mut bank);
let mut sysvar_cache = bank.sysvar_cache.write().unwrap();
sysvar_cache.set_clock(clock);
sysvar_cache.set_rent(rent);
drop(sysvar_cache);
// Add airdrop account
bank.accounts.insert(
bank.airdrop_kp.pubkey(),
Account::new(
1_000_000u64.wrapping_mul(LAMPORTS_PER_SOL),
0,
&system_program::id(),
),
);
// Add builtin programs
bank.builtin_programs = vec![
BuiltinProgram {
program_id: bpf_loader::id(),
process_instruction: process_bpf_loader_instruction,
},
BuiltinProgram {
program_id: bpf_loader_upgradeable::id(),
process_instruction: process_bpf_loader_instruction,
},
BuiltinProgram {
program_id: system_program::id(),
process_instruction: process_system_instruction,
},
];
// Feature set
bank.feature_set = Rc::new(FeatureSet::default());
bank
}
pub fn get_slot(&self) -> Slot {
self.slot
}
pub fn get_block_height(&self) -> u64 {
self.block_height
}
pub fn get_genesis_hash(&self) -> Hash {
self.latest_blockhash
}
pub fn get_latest_blockhash(&self) -> Hash {
self.latest_blockhash
}
pub fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> u64 {
Rent::default().minimum_balance(data_len).max(1)
}
pub fn feature_set(&self) -> &FeatureSet {
&*self.feature_set
}
/// Returns `None` for accounts with 0 lamports
pub fn get_account(&self, pubkey: &Pubkey) -> Option<&Account> {
self.accounts.get(pubkey)
}
/// Returns `Account::default` for 0 lamports account
pub fn get_account_default(&self, pubkey: &Pubkey) -> Account {
match self.accounts.get(pubkey) {
Some(account) => account.to_owned(),
None => Account::default(),
}
}
/// Inserts the account if it doesn't exist or updates the existing account.
/// Previous value or `None` is returned for initial insertion.
pub fn set_account(&mut self, pubkey: Pubkey, account: Account) -> Option<Account> {
self.accounts.insert(pubkey, account)
}
pub fn get_fee_for_message(&self, msg: &SanitizedMessage) -> Option<u64> {
(msg.header().num_required_signatures.max(1) as u64)
.checked_mul(PgBank::LAMPORTS_PER_SIGNATURE)
}
pub fn simulate_tx(&self, tx: &SanitizedTransaction) -> SimulateTransactionResult {
let mut loaded_tx = match self.load_tx(tx) {
Ok(loaded_tx) => loaded_tx,
Err(err) => return SimulateTransactionResult::new_error(err),
};
let account_count = tx.message().account_keys().len();
let pre_accounts = loaded_tx
.accounts
.clone()
.into_iter()
.take(account_count)
.collect::<Vec<TransactionAccount>>();
match self.execute_loaded_tx(&tx, &mut loaded_tx) {
TransactionExecutionResult::Executed {
details,
tx_executor_cache: _,
} => SimulateTransactionResult::new(
details.status,
pre_accounts,
loaded_tx.accounts.into_iter().take(account_count).collect(),
details.log_messages.unwrap_or_default(),
details.executed_units,
details.return_data,
),
TransactionExecutionResult::NotExecuted(err) => {
SimulateTransactionResult::new_error(err)
}
}
}
pub fn process_tx(&mut self, tx: SanitizedTransaction) -> transaction::Result<Signature> {
let simulation_result = self.simulate_tx(&tx);
match simulation_result.result {
Ok(_) => {
// TODO: Substract the fee from the `fee_payer`
let fee = self.get_fee_for_message(tx.message()).unwrap();
for (pubkey, account) in &simulation_result.post_accounts {
self.set_account(pubkey.clone(), account.clone().into());
}
let tx_hash = self.save_tx(tx, simulation_result, fee)?;
Ok(tx_hash)
}
Err(err) => Err(err),
}
}
pub fn get_tx(&self, signature: &Signature) -> Option<&TransactionData> {
self.txs.get(signature)
}
pub fn airdrop(&mut self, to_pubkey: &Pubkey, lamports: u64) -> transaction::Result<Signature> {
let payer = &self.airdrop_kp;
let tx = VersionedTransaction::try_new(
VersionedMessage::Legacy(Message::new_with_blockhash(
&[system_instruction::transfer(
&payer.pubkey(),
to_pubkey,
lamports,
)],
Some(&payer.pubkey()),
&self.latest_blockhash,
)),
&[payer],
)
.unwrap();
get_sanitized_tx_from_versioned_tx(tx)
.and_then(|sanitized_tx| self.process_tx(sanitized_tx))
}
fn new_slot(&mut self) {
self.latest_blockhash = create_blockhash(&self.latest_blockhash.to_bytes());
self.slot += 1;
self.block_height += 1;
}
fn save_tx(
&mut self,
tx: SanitizedTransaction,
result: SimulateTransactionResult,
fee: u64,
) -> transaction::Result<Signature> {
let signature = tx.signature();
// Don't save BPF Upgradeable Loader Write ix as its mostly wasted space
let bpf_upgradeable_write_ix_exists = tx
.message()
.instructions()
.iter()
.find(|ix| {
let program_id = tx
.message()
.account_keys()
.get(ix.program_id_index as usize)
.unwrap();
*program_id == bpf_loader_upgradeable::id() && ix.data.starts_with(&[1])
})
.is_some();
if bpf_upgradeable_write_ix_exists {
return Ok(signature.to_owned());
}
// Get whether the tx signature already exists
match self.txs.get(signature) {
Some(_) => Err(TransactionError::AlreadyProcessed),
None => {
let signature = signature.to_owned();
self.txs.insert(
signature,
TransactionData::new(
self.get_slot(),
tx.to_versioned_transaction(),
Some(ConfirmedTransactionMeta {
fee,
// TODO:
inner_instructions: None,
pre_balances: result
.pre_accounts
.iter()
.map(|(_, data)| data.lamports())
.collect(),
post_balances: result
.post_accounts
.iter()
.map(|(_, data)| data.lamports())
.collect(),
log_messages: Some(result.logs),
// TODO:
pre_token_balances: None,
// TODO:
post_token_balances: None,
err: result.result.err(),
loaded_addresses: None,
compute_units_consumed: Some(result.units_consumed),
}),
Some(
self.sysvar_cache
.read()
.unwrap()
.get_clock()
.unwrap()
.unix_timestamp,
),
),
);
self.new_slot();
Ok(signature)
}
}
}
fn load_tx(&self, tx: &SanitizedTransaction) -> transaction::Result<LoadedTransaction> {
let fee = 0;
let mut error_counters = TransactionErrorMetrics::default();
let feature_set = FeatureSet::default();
self.load_tx_accounts(&tx, fee, &mut error_counters, &feature_set)
}
fn execute_loaded_tx(
&self,
tx: &SanitizedTransaction,
loaded_tx: &mut LoadedTransaction,
) -> TransactionExecutionResult {
let compute_budget = ComputeBudget::default();
let mut transaction_context = TransactionContext::new(
loaded_tx.accounts.clone(),
None,
compute_budget.max_invoke_stack_height,
compute_budget.max_instruction_trace_length,
);
let log_collector = Rc::new(RefCell::new(LogCollector::default()));
let tx_executor_cache = Rc::new(RefCell::new(TransactionExecutorCache::default()));
let feature_set = Arc::new(FeatureSet::default());
let mut timings = ExecuteTimings::default();
let blockhash = tx.message().recent_blockhash();
let current_accounts_data_len = u64::MAX;
let mut accumulated_consume_units = 0;
// Get sysvars
let sysvar_cache = self.sysvar_cache.read().unwrap();
let process_result = MessageProcessor::process_message(
&self.builtin_programs,
tx.message(),
&loaded_tx.program_indices,
&mut transaction_context,
*sysvar_cache.get_rent().unwrap(),
Some(Rc::clone(&log_collector)),
Rc::clone(&tx_executor_cache),
feature_set,
compute_budget,
&mut timings,
&sysvar_cache,
*blockhash,
PgBank::LAMPORTS_PER_SIGNATURE,
current_accounts_data_len,
&mut accumulated_consume_units,
);
let ExecutionRecord {
accounts,
mut return_data,
touched_account_count: _,
accounts_resize_delta: _,
} = transaction_context.into();
loaded_tx.accounts = accounts;
match process_result {
Ok(info) => TransactionExecutionResult::Executed {
details: TransactionExecutionDetails {
status: Ok(()),
log_messages: Some(log_collector.borrow().get_recorded_content().to_vec()),
inner_instructions: None,
durable_nonce_fee: None,
return_data: match return_data.data.iter().rposition(|&x| x != 0) {
Some(end_index) => {
let end_index = end_index.saturating_add(1);
return_data.data.truncate(end_index);
Some(return_data)
}
None => None,
},
executed_units: accumulated_consume_units,
accounts_data_len_delta: info.accounts_data_len_delta,
},
tx_executor_cache,
},
Err(err) => TransactionExecutionResult::NotExecuted(err),
}
}
fn load_tx_accounts(
&self,
tx: &SanitizedTransaction,
fee: u64,
error_counters: &mut TransactionErrorMetrics,
feature_set: &FeatureSet,
) -> transaction::Result<LoadedTransaction> {
// NOTE: this check will never fail because `tx` is sanitized
if tx.signatures().is_empty() && fee != 0 {
return Err(TransactionError::MissingSignatureForFee);
}
// There is no way to predict what program will execute without an error
// If a fee can pay for execution then the program will be scheduled
let mut validated_fee_payer = false;
let message = tx.message();
let account_keys = message.account_keys();
let mut account_deps = Vec::with_capacity(account_keys.len());
let requested_loaded_accounts_data_size_limit = None;
let mut accumulated_accounts_data_size: usize = 0;
let mut accounts = account_keys
.iter()
.enumerate()
.map(|(i, pubkey)| {
let (account, loaded_programdata_account_size) = if !message.is_non_loader_key(i) {
// TODO:
// Fill in an empty account for the program slots.
// (AccountSharedData::default(), 0)
let account = self.get_account_default(pubkey);
let program_len = account.data.len();
(AccountSharedData::from(account), program_len)
} else {
if solana_sdk::sysvar::instructions::check_id(pubkey) {
(
Self::construct_instructions_account(
message,
feature_set.is_active(
&feature_set::instructions_sysvar_owned_by_sysvar::id(),
),
),
0,
)
} else {
let mut account = AccountSharedData::from(self.get_account_default(pubkey));
if !validated_fee_payer {
Self::validate_fee_payer(
pubkey,
&mut account,
i as IndexOfAccount,
error_counters,
feature_set,
fee,
)?;
validated_fee_payer = true;
}
let mut loaded_programdata_account_size: usize = 0;
if bpf_loader_upgradeable::check_id(account.owner()) {
if message.is_writable(i) && !message.is_upgradeable_loader_present() {
error_counters.invalid_writable_account += 1;
return Err(TransactionError::InvalidWritableAccount);
}
if account.executable() {
// The upgradeable loader requires the derived ProgramData account
if let Ok(UpgradeableLoaderState::Program {
programdata_address,
}) = account.state()
{
if let Some(programdata_account) =
self.get_account(&programdata_address)
{
loaded_programdata_account_size =
programdata_account.data().len();
account_deps.push((
programdata_address,
AccountSharedData::from(programdata_account.to_owned()),
));
} else {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);
}
} else {
error_counters.invalid_program_for_execution += 1;
return Err(TransactionError::InvalidProgramForExecution);
}
}
} else if account.executable() && message.is_writable(i) {
error_counters.invalid_writable_account += 1;
return Err(TransactionError::InvalidWritableAccount);
}
(account, loaded_programdata_account_size)
}
};
Self::accumulate_and_check_loaded_account_data_size(
&mut accumulated_accounts_data_size,
account
.data()
.len()
.saturating_add(loaded_programdata_account_size),
requested_loaded_accounts_data_size_limit,
error_counters,
)?;
Ok((*pubkey, account))
})
.collect::<transaction::Result<Vec<_>>>()?;
// Appends the account_deps at the end of the accounts,
// this way they can be accessed in a uniform way.
// At places where only the accounts are needed,
// the account_deps are truncated using e.g:
// accounts.iter().take(message.account_keys.len())
accounts.append(&mut account_deps);
if validated_fee_payer {
let program_indices = message
.instructions()
.iter()
.map(|instruction| {
self.load_executable_accounts(
&mut accounts,
instruction.program_id_index as IndexOfAccount,
error_counters,
&mut accumulated_accounts_data_size,
requested_loaded_accounts_data_size_limit,
)
})
.collect::<transaction::Result<Vec<Vec<IndexOfAccount>>>>()?;
Ok(LoadedTransaction {
accounts,
program_indices,
})
} else {
error_counters.account_not_found += 1;
Err(TransactionError::AccountNotFound)
}
}
fn load_executable_accounts(
&self,
accounts: &mut Vec<TransactionAccount>,
mut program_account_index: IndexOfAccount,
error_counters: &mut TransactionErrorMetrics,
accumulated_accounts_data_size: &mut usize,
requested_loaded_accounts_data_size_limit: Option<NonZeroUsize>,
) -> transaction::Result<Vec<IndexOfAccount>> {
let mut account_indices = Vec::new();
let (mut program_id, already_loaded_as_non_loader) =
match accounts.get(program_account_index as usize) {
Some(program_account) => (
program_account.0,
// program account is already loaded if it's not empty in `accounts`
program_account.1 != AccountSharedData::default(),
),
None => {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);
}
};
let mut depth = 0;
while !native_loader::check_id(&program_id) {
if depth >= 5 {
error_counters.call_chain_too_deep += 1;
return Err(TransactionError::CallChainTooDeep);
}
depth += 1;
let mut loaded_account_total_size: usize = 0;
program_account_index = match self.get_account(&program_id) {
Some(program_account) => {
let account_index = accounts.len() as IndexOfAccount;
// do not double count account size for program account on top of call chain
// that has already been loaded during load_tx as non-loader account.
// Other accounts data size in the call chain are counted.
if !(depth == 1 && already_loaded_as_non_loader) {
loaded_account_total_size =
loaded_account_total_size.saturating_add(program_account.data().len());
}
accounts.push((
program_id,
AccountSharedData::from(program_account.to_owned()),
));
account_index
}
None => {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);
}
};
let program = &accounts[program_account_index as usize].1;
if !program.executable() {
error_counters.invalid_program_for_execution += 1;
return Err(TransactionError::InvalidProgramForExecution);
}
// Add loader to chain
let program_owner = *program.owner();
account_indices.insert(0, program_account_index);
if bpf_loader_upgradeable::check_id(&program_owner) {
// The upgradeable loader requires the derived ProgramData account
if let Ok(UpgradeableLoaderState::Program {
programdata_address,
}) = program.state()
{
let programdata_account_index = match self.get_account(&programdata_address) {
Some(programdata_account) => {
let account_index = accounts.len() as IndexOfAccount;
if !(depth == 1 && already_loaded_as_non_loader) {
loaded_account_total_size = loaded_account_total_size
.saturating_add(programdata_account.data().len());
}
accounts.push((
programdata_address,
AccountSharedData::from(programdata_account.to_owned()),
));
account_index
}
None => {
error_counters.account_not_found += 1;
return Err(TransactionError::ProgramAccountNotFound);
}
};
account_indices.insert(0, programdata_account_index);
} else {
error_counters.invalid_program_for_execution += 1;
return Err(TransactionError::InvalidProgramForExecution);
}
}
Self::accumulate_and_check_loaded_account_data_size(
accumulated_accounts_data_size,
loaded_account_total_size,
requested_loaded_accounts_data_size_limit,
error_counters,
)?;
program_id = program_owner;
}
Ok(account_indices)
}
fn construct_instructions_account(
message: &SanitizedMessage,
is_owned_by_sysvar: bool,
) -> AccountSharedData {
let data = construct_instructions_data(&message.decompile_instructions());
let owner = if is_owned_by_sysvar {
sysvar::id()
} else {
system_program::id()
};
AccountSharedData::from(Account {
data,
owner,
..Account::default()
})
}
fn validate_fee_payer(
_payer_address: &Pubkey,
payer_account: &mut AccountSharedData,
_payer_index: IndexOfAccount,
error_counters: &mut TransactionErrorMetrics,
_feature_set: &FeatureSet,
fee: u64,
) -> transaction::Result<()> {
if payer_account.lamports() == 0 {
error_counters.account_not_found += 1;
return Err(TransactionError::AccountNotFound);
}
let min_balance = match get_system_account_kind(payer_account).ok_or_else(|| {
error_counters.invalid_account_for_fee += 1;
TransactionError::InvalidAccountForFee
})? {
SystemAccountKind::System => 0,
SystemAccountKind::Nonce => todo!(),
};
if payer_account.lamports() < fee + min_balance {
error_counters.insufficient_funds += 1;
return Err(TransactionError::InsufficientFundsForFee);
}
Ok(())
}
fn accumulate_and_check_loaded_account_data_size(
accumulated_loaded_accounts_data_size: &mut usize,
account_data_size: usize,
requested_loaded_accounts_data_size_limit: Option<NonZeroUsize>,
error_counters: &mut TransactionErrorMetrics,
) -> transaction::Result<()> {
if let Some(requested_loaded_accounts_data_size) = requested_loaded_accounts_data_size_limit
{
*accumulated_loaded_accounts_data_size =
accumulated_loaded_accounts_data_size.saturating_add(account_data_size);
if *accumulated_loaded_accounts_data_size > requested_loaded_accounts_data_size.get() {
error_counters.max_loaded_accounts_data_size_exceeded += 1;
Err(TransactionError::MaxLoadedAccountsDataSizeExceeded)
} else {
Ok(())
}
} else {
Ok(())
}
}
}
/// Mapping between Pubkeys and Accounts
pub type BankAccounts = HashMap<Pubkey, Account>;
/// Mapping between Signatures and TransactionData
pub type BankTxs = HashMap<Signature, TransactionData>;
/// Filler struct, address loader is not yet implemented
#[derive(Clone, Default)]
pub struct PgAddressLoader {}
impl AddressLoader for PgAddressLoader {
fn load_addresses(
self,
_lookups: &[MessageAddressTableLookup],
) -> Result<LoadedAddresses, AddressLoaderError> {
Err(AddressLoaderError::Disabled)
}
}
type TransactionProgramIndices = Vec<Vec<IndexOfAccount>>;
#[derive(PartialEq, Eq, Debug, Clone)]
struct LoadedTransaction {
pub accounts: Vec<TransactionAccount>,
pub program_indices: TransactionProgramIndices,
}
/// Type safe representation of a transaction execution attempt which
/// differentiates between a transaction that was executed (will be
/// committed to the ledger) and a transaction which wasn't executed
/// and will be dropped.
///
/// Note: `Result<TransactionExecutionDetails, TransactionError>` is not
/// used because it's easy to forget that the inner `details.status` field
/// is what should be checked to detect a successful transaction. This
/// enum provides a convenience method `Self::was_executed_successfully` to
/// make such checks hard to do incorrectly.
#[derive(Clone)]
pub enum TransactionExecutionResult {
Executed {
details: TransactionExecutionDetails,
tx_executor_cache: Rc<RefCell<TransactionExecutorCache>>,
},
NotExecuted(TransactionError),
}
#[derive(Clone)]
pub struct TransactionExecutionDetails {
pub status: transaction::Result<()>,
pub log_messages: Option<Vec<String>>,
pub inner_instructions: Option<InnerInstructionsList>,
pub durable_nonce_fee: Option<DurableNonceFee>,
pub return_data: Option<TransactionReturnData>,
pub executed_units: u64,
/// The change in accounts data len for this transaction.
/// NOTE: This value is valid if `status` is `Ok`.
pub accounts_data_len_delta: i64,
}
#[allow(dead_code)]
#[derive(Clone)]
pub enum DurableNonceFee {
Valid(u64),
Invalid,
}
/// A list of compiled instructions that were invoked during each instruction of
/// a transaction
pub type InnerInstructionsList = Vec<InnerInstructions>;
/// An ordered list of compiled instructions that were invoked during a
/// transaction instruction
pub type InnerInstructions = Vec<InnerInstruction>;
#[derive(Clone, PartialEq, Eq)]
pub struct InnerInstruction {
pub instruction: CompiledInstruction,
/// Invocation stack height of this instruction. Instruction stack height
/// starts at 1 for transaction instructions.
pub stack_height: u8,
}
#[derive(Default)]
pub struct TransactionErrorMetrics {
pub total: usize,
pub account_in_use: usize,
pub too_many_account_locks: usize,
pub account_loaded_twice: usize,
pub account_not_found: usize,
pub blockhash_not_found: usize,
pub blockhash_too_old: usize,
pub call_chain_too_deep: usize,
pub already_processed: usize,
pub instruction_error: usize,
pub insufficient_funds: usize,
pub invalid_account_for_fee: usize,
pub invalid_account_index: usize,
pub invalid_program_for_execution: usize,
pub not_allowed_during_cluster_maintenance: usize,
pub invalid_writable_account: usize,
pub invalid_rent_paying_account: usize,
pub would_exceed_max_block_cost_limit: usize,
pub would_exceed_max_account_cost_limit: usize,
pub would_exceed_max_vote_cost_limit: usize,
pub would_exceed_account_data_block_limit: usize,
pub max_loaded_accounts_data_size_exceeded: usize,
pub invalid_loaded_accounts_data_size_limit: usize,
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/runtime/nonce_keyed_account.rs
|
use std::collections::HashSet;
use {
solana_program_runtime::{ic_msg, invoke_context::InvokeContext},
solana_sdk::{
feature_set,
instruction::{checked_add, InstructionError},
nonce::{
self,
state::{AuthorizeNonceError, DurableNonce, Versions},
State,
},
pubkey::Pubkey,
system_instruction::{nonce_to_instruction_error, NonceError},
sysvar::rent::Rent,
transaction_context::{
BorrowedAccount, IndexOfAccount, InstructionContext, TransactionContext,
},
},
};
pub fn advance_nonce_account(
account: &mut BorrowedAccount,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
) -> Result<(), InstructionError> {
let merge_nonce_error_into_system_error = invoke_context
.feature_set
.is_active(&feature_set::merge_nonce_error_into_system_error::id());
if !account.is_writable() {
ic_msg!(
invoke_context,
"Advance nonce account: Account {} must be writeable",
account.get_key()
);
return Err(InstructionError::InvalidArgument);
}
let state: Versions = account.get_state()?;
match state.state() {
State::Initialized(data) => {
if !signers.contains(&data.authority) {
ic_msg!(
invoke_context,
"Advance nonce account: Account {} must be a signer",
data.authority
);
return Err(InstructionError::MissingRequiredSignature);
}
let next_durable_nonce = DurableNonce::from_blockhash(&invoke_context.blockhash);
if data.durable_nonce == next_durable_nonce {
ic_msg!(
invoke_context,
"Advance nonce account: nonce can only advance once per slot"
);
return Err(nonce_to_instruction_error(
NonceError::NotExpired,
merge_nonce_error_into_system_error,
));
}
let new_data = nonce::state::Data::new(
data.authority,
next_durable_nonce,
invoke_context.lamports_per_signature,
);
account.set_state(&Versions::new(State::Initialized(new_data)))
}
State::Uninitialized => {
ic_msg!(
invoke_context,
"Advance nonce account: Account {} state is invalid",
account.get_key()
);
Err(nonce_to_instruction_error(
NonceError::BadAccountState,
merge_nonce_error_into_system_error,
))
}
}
}
pub fn withdraw_nonce_account(
from_account_index: IndexOfAccount,
lamports: u64,
to_account_index: IndexOfAccount,
rent: &Rent,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
transaction_context: &TransactionContext,
instruction_context: &InstructionContext,
) -> Result<(), InstructionError> {
let mut from = instruction_context
.try_borrow_instruction_account(transaction_context, from_account_index)?;
let merge_nonce_error_into_system_error = invoke_context
.feature_set
.is_active(&feature_set::merge_nonce_error_into_system_error::id());
if !from.is_writable() {
ic_msg!(
invoke_context,
"Withdraw nonce account: Account {} must be writeable",
from.get_key()
);
return Err(InstructionError::InvalidArgument);
}
let state: Versions = from.get_state()?;
let signer = match state.state() {
State::Uninitialized => {
if lamports > from.get_lamports() {
ic_msg!(
invoke_context,
"Withdraw nonce account: insufficient lamports {}, need {}",
from.get_lamports(),
lamports,
);
return Err(InstructionError::InsufficientFunds);
}
*from.get_key()
}
State::Initialized(ref data) => {
if lamports == from.get_lamports() {
let durable_nonce = DurableNonce::from_blockhash(&invoke_context.blockhash);
if data.durable_nonce == durable_nonce {
ic_msg!(
invoke_context,
"Withdraw nonce account: nonce can only advance once per slot"
);
return Err(nonce_to_instruction_error(
NonceError::NotExpired,
merge_nonce_error_into_system_error,
));
}
from.set_state(&Versions::new(State::Uninitialized))?;
} else {
let min_balance = rent.minimum_balance(from.get_data().len());
let amount = checked_add(lamports, min_balance)?;
if amount > from.get_lamports() {
ic_msg!(
invoke_context,
"Withdraw nonce account: insufficient lamports {}, need {}",
from.get_lamports(),
amount,
);
return Err(InstructionError::InsufficientFunds);
}
}
data.authority
}
};
if !signers.contains(&signer) {
ic_msg!(
invoke_context,
"Withdraw nonce account: Account {} must sign",
signer
);
return Err(InstructionError::MissingRequiredSignature);
}
from.checked_sub_lamports(lamports)?;
drop(from);
let mut to = instruction_context
.try_borrow_instruction_account(transaction_context, to_account_index)?;
to.checked_add_lamports(lamports)?;
Ok(())
}
pub fn initialize_nonce_account(
account: &mut BorrowedAccount,
nonce_authority: &Pubkey,
rent: &Rent,
invoke_context: &InvokeContext,
) -> Result<(), InstructionError> {
let merge_nonce_error_into_system_error = invoke_context
.feature_set
.is_active(&feature_set::merge_nonce_error_into_system_error::id());
if !account.is_writable() {
ic_msg!(
invoke_context,
"Initialize nonce account: Account {} must be writeable",
account.get_key()
);
return Err(InstructionError::InvalidArgument);
}
match account.get_state::<Versions>()?.state() {
State::Uninitialized => {
let min_balance = rent.minimum_balance(account.get_data().len());
if account.get_lamports() < min_balance {
ic_msg!(
invoke_context,
"Initialize nonce account: insufficient lamports {}, need {}",
account.get_lamports(),
min_balance
);
return Err(InstructionError::InsufficientFunds);
}
let durable_nonce = DurableNonce::from_blockhash(&invoke_context.blockhash);
let data = nonce::state::Data::new(
*nonce_authority,
durable_nonce,
invoke_context.lamports_per_signature,
);
let state = State::Initialized(data);
account.set_state(&Versions::new(state))
}
State::Initialized(_) => {
ic_msg!(
invoke_context,
"Initialize nonce account: Account {} state is invalid",
account.get_key()
);
Err(nonce_to_instruction_error(
NonceError::BadAccountState,
merge_nonce_error_into_system_error,
))
}
}
}
pub fn authorize_nonce_account(
account: &mut BorrowedAccount,
nonce_authority: &Pubkey,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
) -> Result<(), InstructionError> {
let merge_nonce_error_into_system_error = invoke_context
.feature_set
.is_active(&feature_set::merge_nonce_error_into_system_error::id());
if !account.is_writable() {
ic_msg!(
invoke_context,
"Authorize nonce account: Account {} must be writeable",
account.get_key()
);
return Err(InstructionError::InvalidArgument);
}
match account
.get_state::<Versions>()?
.authorize(signers, *nonce_authority)
{
Ok(versions) => account.set_state(&versions),
Err(AuthorizeNonceError::Uninitialized) => {
ic_msg!(
invoke_context,
"Authorize nonce account: Account {} state is invalid",
account.get_key()
);
Err(nonce_to_instruction_error(
NonceError::BadAccountState,
merge_nonce_error_into_system_error,
))
}
Err(AuthorizeNonceError::MissingRequiredSignature(account_authority)) => {
ic_msg!(
invoke_context,
"Authorize nonce account: Account {} must sign",
account_authority
);
Err(InstructionError::MissingRequiredSignature)
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/runtime/system_instruction_processor.rs
|
use std::collections::HashSet;
use {
solana_program_runtime::{
ic_msg, invoke_context::InvokeContext, sysvar_cache::get_sysvar_with_account_check,
},
solana_sdk::{
account::AccountSharedData,
account_utils::StateMut,
feature_set,
instruction::InstructionError,
nonce,
program_utils::limited_deserialize,
pubkey::Pubkey,
system_instruction::{
NonceError, SystemError, SystemInstruction, MAX_PERMITTED_DATA_LENGTH,
},
system_program,
transaction_context::{
BorrowedAccount, IndexOfAccount, InstructionContext, TransactionContext,
},
},
};
use super::nonce_keyed_account::{
advance_nonce_account, authorize_nonce_account, initialize_nonce_account,
withdraw_nonce_account,
};
pub fn process_system_instruction(
_first_instruction_account: IndexOfAccount,
invoke_context: &mut InvokeContext,
) -> Result<(), InstructionError> {
let transaction_context = &invoke_context.transaction_context;
let instruction_context = transaction_context.get_current_instruction_context()?;
let instruction_data = instruction_context.get_instruction_data();
let instruction = limited_deserialize(instruction_data)?;
let signers = instruction_context.get_signers(transaction_context)?;
match instruction {
SystemInstruction::CreateAccount {
lamports,
space,
owner,
} => {
instruction_context.check_number_of_instruction_accounts(2)?;
let to_address = Address::create(
transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(1)?,
)?,
None,
invoke_context,
)?;
create_account(
0,
1,
&to_address,
lamports,
space,
&owner,
&signers,
invoke_context,
transaction_context,
instruction_context,
)
}
SystemInstruction::CreateAccountWithSeed {
base,
seed,
lamports,
space,
owner,
} => {
instruction_context.check_number_of_instruction_accounts(2)?;
let to_address = Address::create(
transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(1)?,
)?,
Some((&base, &seed, &owner)),
invoke_context,
)?;
create_account(
0,
1,
&to_address,
lamports,
space,
&owner,
&signers,
invoke_context,
transaction_context,
instruction_context,
)
}
SystemInstruction::Assign { owner } => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
let address = Address::create(
transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(0)?,
)?,
None,
invoke_context,
)?;
assign(&mut account, &address, &owner, &signers, invoke_context)
}
SystemInstruction::Transfer { lamports } => {
instruction_context.check_number_of_instruction_accounts(2)?;
transfer(
0,
1,
lamports,
invoke_context,
transaction_context,
instruction_context,
)
}
SystemInstruction::TransferWithSeed {
lamports,
from_seed,
from_owner,
} => {
instruction_context.check_number_of_instruction_accounts(3)?;
transfer_with_seed(
0,
1,
&from_seed,
&from_owner,
2,
lamports,
invoke_context,
transaction_context,
instruction_context,
)
}
SystemInstruction::AdvanceNonceAccount => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut me =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
#[allow(deprecated)]
let recent_blockhashes = get_sysvar_with_account_check::recent_blockhashes(
invoke_context,
instruction_context,
1,
)?;
if recent_blockhashes.is_empty() {
ic_msg!(
invoke_context,
"Advance nonce account: recent blockhash list is empty",
);
return Err(NonceError::NoRecentBlockhashes.into());
}
advance_nonce_account(&mut me, &signers, invoke_context)
}
SystemInstruction::WithdrawNonceAccount(lamports) => {
instruction_context.check_number_of_instruction_accounts(2)?;
#[allow(deprecated)]
let _recent_blockhashes = get_sysvar_with_account_check::recent_blockhashes(
invoke_context,
instruction_context,
2,
)?;
let rent = get_sysvar_with_account_check::rent(invoke_context, instruction_context, 3)?;
withdraw_nonce_account(
0,
lamports,
1,
&rent,
&signers,
invoke_context,
transaction_context,
instruction_context,
)
}
SystemInstruction::InitializeNonceAccount(authorized) => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut me =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
#[allow(deprecated)]
let recent_blockhashes = get_sysvar_with_account_check::recent_blockhashes(
invoke_context,
instruction_context,
1,
)?;
if recent_blockhashes.is_empty() {
ic_msg!(
invoke_context,
"Initialize nonce account: recent blockhash list is empty",
);
return Err(NonceError::NoRecentBlockhashes.into());
}
let rent = get_sysvar_with_account_check::rent(invoke_context, instruction_context, 2)?;
initialize_nonce_account(&mut me, &authorized, &rent, invoke_context)
}
SystemInstruction::AuthorizeNonceAccount(nonce_authority) => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut me =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
authorize_nonce_account(&mut me, &nonce_authority, &signers, invoke_context)
}
SystemInstruction::UpgradeNonceAccount => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut nonce_account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
if !system_program::check_id(nonce_account.get_owner()) {
return Err(InstructionError::InvalidAccountOwner);
}
if !nonce_account.is_writable() {
return Err(InstructionError::InvalidArgument);
}
let nonce_versions: nonce::state::Versions = nonce_account.get_state()?;
match nonce_versions.upgrade() {
None => Err(InstructionError::InvalidArgument),
Some(nonce_versions) => nonce_account.set_state(&nonce_versions),
}
}
SystemInstruction::Allocate { space } => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
let address = Address::create(
transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(0)?,
)?,
None,
invoke_context,
)?;
allocate(&mut account, &address, space, &signers, invoke_context)
}
SystemInstruction::AllocateWithSeed {
base,
seed,
space,
owner,
} => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
let address = Address::create(
transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(0)?,
)?,
Some((&base, &seed, &owner)),
invoke_context,
)?;
allocate_and_assign(
&mut account,
&address,
space,
&owner,
&signers,
invoke_context,
)
}
SystemInstruction::AssignWithSeed { base, seed, owner } => {
instruction_context.check_number_of_instruction_accounts(1)?;
let mut account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
let address = Address::create(
transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(0)?,
)?,
Some((&base, &seed, &owner)),
invoke_context,
)?;
assign(&mut account, &address, &owner, &signers, invoke_context)
}
}
}
// represents an address that may or may not have been generated
// from a seed
#[derive(PartialEq, Eq, Default, Debug)]
struct Address {
address: Pubkey,
base: Option<Pubkey>,
}
impl Address {
fn is_signer(&self, signers: &HashSet<Pubkey>) -> bool {
if let Some(base) = self.base {
signers.contains(&base)
} else {
signers.contains(&self.address)
}
}
fn create(
address: &Pubkey,
with_seed: Option<(&Pubkey, &str, &Pubkey)>,
invoke_context: &InvokeContext,
) -> Result<Self, InstructionError> {
let base = if let Some((base, seed, owner)) = with_seed {
let address_with_seed = Pubkey::create_with_seed(base, seed, owner)?;
// re-derive the address, must match the supplied address
if *address != address_with_seed {
ic_msg!(
invoke_context,
"Create: address {} does not match derived address {}",
address,
address_with_seed
);
return Err(SystemError::AddressWithSeedMismatch.into());
}
Some(*base)
} else {
None
};
Ok(Self {
address: *address,
base,
})
}
}
fn allocate(
account: &mut BorrowedAccount,
address: &Address,
space: u64,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
) -> Result<(), InstructionError> {
if !address.is_signer(signers) {
ic_msg!(
invoke_context,
"Allocate: 'to' account {:?} must sign",
address
);
return Err(InstructionError::MissingRequiredSignature);
}
// if it looks like the `to` account is already in use, bail
// (note that the id check is also enforced by message_processor)
if !account.get_data().is_empty() || !system_program::check_id(account.get_owner()) {
ic_msg!(
invoke_context,
"Allocate: account {:?} already in use",
address
);
return Err(SystemError::AccountAlreadyInUse.into());
}
if space > MAX_PERMITTED_DATA_LENGTH {
ic_msg!(
invoke_context,
"Allocate: requested {}, max allowed {}",
space,
MAX_PERMITTED_DATA_LENGTH
);
return Err(SystemError::InvalidAccountDataLength.into());
}
account.set_data_length(space as usize)?;
Ok(())
}
fn assign(
account: &mut BorrowedAccount,
address: &Address,
owner: &Pubkey,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
) -> Result<(), InstructionError> {
// no work to do, just return
if account.get_owner() == owner {
return Ok(());
}
if !address.is_signer(signers) {
ic_msg!(invoke_context, "Assign: account {:?} must sign", address);
return Err(InstructionError::MissingRequiredSignature);
}
account.set_owner(&owner.to_bytes())
}
fn allocate_and_assign(
to: &mut BorrowedAccount,
to_address: &Address,
space: u64,
owner: &Pubkey,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
) -> Result<(), InstructionError> {
allocate(to, to_address, space, signers, invoke_context)?;
assign(to, to_address, owner, signers, invoke_context)
}
#[allow(clippy::too_many_arguments)]
fn create_account(
from_account_index: IndexOfAccount,
to_account_index: IndexOfAccount,
to_address: &Address,
lamports: u64,
space: u64,
owner: &Pubkey,
signers: &HashSet<Pubkey>,
invoke_context: &InvokeContext,
transaction_context: &TransactionContext,
instruction_context: &InstructionContext,
) -> Result<(), InstructionError> {
// if it looks like the `to` account is already in use, bail
{
let mut to = instruction_context
.try_borrow_instruction_account(transaction_context, to_account_index)?;
if to.get_lamports() > 0 {
ic_msg!(
invoke_context,
"Create Account: account {:?} already in use",
to_address
);
return Err(SystemError::AccountAlreadyInUse.into());
}
allocate_and_assign(&mut to, to_address, space, owner, signers, invoke_context)?;
}
transfer(
from_account_index,
to_account_index,
lamports,
invoke_context,
transaction_context,
instruction_context,
)
}
fn transfer_verified(
from_account_index: IndexOfAccount,
to_account_index: IndexOfAccount,
lamports: u64,
invoke_context: &InvokeContext,
transaction_context: &TransactionContext,
instruction_context: &InstructionContext,
) -> Result<(), InstructionError> {
let mut from = instruction_context
.try_borrow_instruction_account(transaction_context, from_account_index)?;
if !from.get_data().is_empty() {
ic_msg!(invoke_context, "Transfer: `from` must not carry data");
return Err(InstructionError::InvalidArgument);
}
if lamports > from.get_lamports() {
ic_msg!(
invoke_context,
"Transfer: insufficient lamports {}, need {}",
from.get_lamports(),
lamports
);
return Err(SystemError::ResultWithNegativeLamports.into());
}
from.checked_sub_lamports(lamports)?;
drop(from);
let mut to = instruction_context
.try_borrow_instruction_account(transaction_context, to_account_index)?;
to.checked_add_lamports(lamports)?;
Ok(())
}
fn transfer(
from_account_index: IndexOfAccount,
to_account_index: IndexOfAccount,
lamports: u64,
invoke_context: &InvokeContext,
transaction_context: &TransactionContext,
instruction_context: &InstructionContext,
) -> Result<(), InstructionError> {
if !invoke_context
.feature_set
.is_active(&feature_set::system_transfer_zero_check::id())
&& lamports == 0
{
return Ok(());
}
if !instruction_context.is_instruction_account_signer(from_account_index)? {
ic_msg!(
invoke_context,
"Transfer: `from` account {} must sign",
transaction_context.get_key_of_account_at_index(
instruction_context
.get_index_of_instruction_account_in_transaction(from_account_index)?,
)?,
);
return Err(InstructionError::MissingRequiredSignature);
}
transfer_verified(
from_account_index,
to_account_index,
lamports,
invoke_context,
transaction_context,
instruction_context,
)
}
fn transfer_with_seed(
from_account_index: IndexOfAccount,
from_base_account_index: IndexOfAccount,
from_seed: &str,
from_owner: &Pubkey,
to_account_index: IndexOfAccount,
lamports: u64,
invoke_context: &InvokeContext,
transaction_context: &TransactionContext,
instruction_context: &InstructionContext,
) -> Result<(), InstructionError> {
if !invoke_context
.feature_set
.is_active(&feature_set::system_transfer_zero_check::id())
&& lamports == 0
{
return Ok(());
}
if !instruction_context.is_instruction_account_signer(from_base_account_index)? {
ic_msg!(
invoke_context,
"Transfer: 'from' account {:?} must sign",
transaction_context.get_key_of_account_at_index(
instruction_context
.get_index_of_instruction_account_in_transaction(from_base_account_index)?,
)?,
);
return Err(InstructionError::MissingRequiredSignature);
}
let address_from_seed = Pubkey::create_with_seed(
transaction_context.get_key_of_account_at_index(
instruction_context
.get_index_of_instruction_account_in_transaction(from_base_account_index)?,
)?,
from_seed,
from_owner,
)?;
let from_key = transaction_context.get_key_of_account_at_index(
instruction_context.get_index_of_instruction_account_in_transaction(from_account_index)?,
)?;
if *from_key != address_from_seed {
ic_msg!(
invoke_context,
"Transfer: 'from' address {} does not match derived address {}",
from_key,
address_from_seed
);
return Err(SystemError::AddressWithSeedMismatch.into());
}
transfer_verified(
from_account_index,
to_account_index,
lamports,
invoke_context,
transaction_context,
instruction_context,
)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum SystemAccountKind {
System,
Nonce,
}
pub fn get_system_account_kind(account: &AccountSharedData) -> Option<SystemAccountKind> {
use solana_sdk::account::ReadableAccount;
if system_program::check_id(account.owner()) {
if account.data().is_empty() {
Some(SystemAccountKind::System)
} else if account.data().len() == nonce::State::size() {
let nonce_versions: nonce::state::Versions = account.state().ok()?;
match nonce_versions.state() {
nonce::State::Uninitialized => None,
nonce::State::Initialized(_) => Some(SystemAccountKind::Nonce),
}
} else {
None
}
} else {
None
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/runtime/mod.rs
|
pub mod bank;
pub mod message_processor;
pub mod nonce_keyed_account;
pub mod system_instruction_processor;
pub mod transaction_history;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/runtime/transaction_history.rs
|
use serde::{Deserialize, Serialize};
use solana_sdk::{
clock::UnixTimestamp,
instruction::CompiledInstruction,
message::v0::LoadedAddresses,
pubkey::Pubkey,
slot_history::Slot,
transaction::{TransactionError, VersionedTransaction},
};
use wasm_bindgen::prelude::*;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TransactionData {
/// The slot during which the transaction was processed
slot: Slot,
/// The transaction
tx: VersionedTransaction,
/// Metadata produced from the transaction
meta: Option<ConfirmedTransactionMeta>,
/// The unix timestamp of when the transaction was processed
block_time: Option<UnixTimestamp>,
}
impl TransactionData {
pub fn new(
slot: Slot,
tx: VersionedTransaction,
meta: Option<ConfirmedTransactionMeta>,
block_time: Option<UnixTimestamp>,
) -> Self {
Self {
tx,
slot,
meta,
block_time,
}
}
pub fn get_slot(&self) -> Slot {
self.slot
}
pub fn get_tx(&self) -> &VersionedTransaction {
&self.tx
}
pub fn get_meta(&self) -> &Option<ConfirmedTransactionMeta> {
&self.meta
}
pub fn get_block_time(&self) -> Option<UnixTimestamp> {
self.block_time
}
}
/// Metadata for a confirmed transaction on the ledger
#[wasm_bindgen]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ConfirmedTransactionMeta {
/// The fee charged for processing the transaction
pub(crate) fee: u64,
/// An array of cross program invoked instructions
pub(crate) inner_instructions: Option<Vec<CompiledInnerInstruction>>,
/// The balances of the transaction accounts before processing
pub(crate) pre_balances: Vec<u64>,
/// The balances of the transaction accounts after processing
pub(crate) post_balances: Vec<u64>,
/// An array of program log messages emitted during a transaction
pub(crate) log_messages: Option<Vec<String>>,
/// The token balances of the transaction accounts before processing
pub(crate) pre_token_balances: Option<Vec<TokenBalance>>,
/// The token balances of the transaction accounts after processing
pub(crate) post_token_balances: Option<Vec<TokenBalance>>,
/// The error result of transaction processing
pub(crate) err: Option<TransactionError>,
/// The collection of addresses loaded using address lookup tables
pub(crate) loaded_addresses: Option<LoadedAddresses>,
/// The compute units consumed after processing the transaction
pub(crate) compute_units_consumed: Option<u64>,
}
#[wasm_bindgen]
impl ConfirmedTransactionMeta {
pub fn fee(&self) -> u64 {
self.fee
}
/// TODO:
#[wasm_bindgen(js_name = innerInstructions)]
pub fn inner_instructions(&self) -> Option<u8> {
None
}
#[wasm_bindgen(js_name = preBalances)]
pub fn pre_balances(&self) -> Vec<u64> {
self.pre_balances.to_owned()
}
#[wasm_bindgen(js_name = postBalances)]
pub fn post_balances(&self) -> Vec<u64> {
self.post_balances.to_owned()
}
#[wasm_bindgen(js_name = logs)]
pub fn log_messages(&self) -> Option<Vec<JsValue>> {
self.log_messages
.as_ref()
.map(|logs| logs.iter().map(|log| JsValue::from_str(&log)).collect())
}
/// TODO:
#[wasm_bindgen(js_name = preTokenBalances)]
pub fn pre_token_balances(&self) -> Option<u8> {
None
}
/// TODO:
#[wasm_bindgen(js_name = postTokenBalances)]
pub fn post_token_balances(&self) -> Option<u8> {
None
}
pub fn err(&self) -> Option<String> {
self.err.as_ref().map(|err| err.to_string())
}
/// TODO:
#[wasm_bindgen(js_name = loadedAddresses)]
pub fn loaded_addresses(&self) -> Option<u8> {
None
}
#[wasm_bindgen(js_name = computeUnitsConsumed)]
pub fn compute_units_consumed(&self) -> Option<u64> {
self.compute_units_consumed
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct CompiledInnerInstruction {
pub index: u8,
pub instructions: Vec<CompiledInstruction>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TokenBalance {
pub account_index: u8,
pub mint: Pubkey,
pub owner: Option<Pubkey>,
pub ui_token_amount: TokenAmount,
}
/// Token amount object which returns a token amount in different formats
/// for various client use cases.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TokenAmount {
/// Raw amount of tokens as string ignoring decimals
pub amount: String,
/// Number of decimals configured for token's mint
pub decimals: u8,
/// Token amount as float, accounts for decimals
pub ui_amount: Option<u64>,
/// Token amount as string, accounts for decimals
pub ui_amount_string: Option<String>,
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src
|
solana_public_repos/solana-playground/solana-playground/wasm/playnet/src/runtime/message_processor.rs
|
use {
serde::{Deserialize, Serialize},
solana_program_runtime::{
compute_budget::ComputeBudget,
executor_cache::TransactionExecutorCache,
invoke_context::{BuiltinProgram, InvokeContext},
log_collector::LogCollector,
sysvar_cache::SysvarCache,
timings::{ExecuteDetailsTimings, ExecuteTimings},
},
solana_sdk::{
account::WritableAccount,
feature_set::FeatureSet,
hash::Hash,
message::SanitizedMessage,
precompiles::is_precompile,
rent::Rent,
sysvar::instructions,
transaction::TransactionError,
transaction_context::{IndexOfAccount, InstructionAccount, TransactionContext},
},
std::{borrow::Cow, cell::RefCell, rc::Rc, sync::Arc},
};
/// Resultant information gathered from calling process_message()
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct ProcessedMessageInfo {
/// The change in accounts data len
pub accounts_data_len_delta: i64,
}
#[derive(Debug, Default, Clone, Deserialize, Serialize)]
pub struct MessageProcessor {}
impl MessageProcessor {
/// Process a message.
/// This method calls each instruction in the message over the set of loaded accounts.
/// For each instruction it calls the program entrypoint method and verifies that the result of
/// the call does not violate the bank's accounting rules.
/// The accounts are committed back to the bank only if every instruction succeeds.
#[allow(clippy::too_many_arguments)]
pub fn process_message(
builtin_programs: &[BuiltinProgram],
message: &SanitizedMessage,
program_indices: &[Vec<IndexOfAccount>],
transaction_context: &mut TransactionContext,
rent: Rent,
log_collector: Option<Rc<RefCell<LogCollector>>>,
tx_executor_cache: Rc<RefCell<TransactionExecutorCache>>,
feature_set: Arc<FeatureSet>,
compute_budget: ComputeBudget,
timings: &mut ExecuteTimings,
sysvar_cache: &SysvarCache,
blockhash: Hash,
lamports_per_signature: u64,
current_accounts_data_len: u64,
accumulated_consumed_units: &mut u64,
) -> Result<ProcessedMessageInfo, TransactionError> {
let mut invoke_context = InvokeContext::new(
transaction_context,
rent,
builtin_programs,
Cow::Borrowed(sysvar_cache),
log_collector,
compute_budget,
tx_executor_cache,
feature_set,
blockhash,
lamports_per_signature,
current_accounts_data_len,
);
debug_assert_eq!(program_indices.len(), message.instructions().len());
for (instruction_index, ((program_id, instruction), program_indices)) in message
.program_instructions_iter()
.zip(program_indices.iter())
.enumerate()
{
let is_precompile =
is_precompile(program_id, |id| invoke_context.feature_set.is_active(id));
// Fixup the special instructions key if present
// before the account pre-values are taken care of
if let Some(account_index) = invoke_context
.transaction_context
.find_index_of_account(&instructions::id())
{
let mut mut_account_ref = invoke_context
.transaction_context
.get_account_at_index(account_index)
.map_err(|_| TransactionError::InvalidAccountIndex)?
.borrow_mut();
instructions::store_current_index(
mut_account_ref.data_as_mut_slice(),
instruction_index as u16,
);
}
let mut instruction_accounts = Vec::with_capacity(instruction.accounts.len());
for (instruction_account_index, index_in_transaction) in
instruction.accounts.iter().enumerate()
{
let index_in_callee = instruction
.accounts
.get(0..instruction_account_index)
.ok_or(TransactionError::InvalidAccountIndex)?
.iter()
.position(|account_index| account_index == index_in_transaction)
.unwrap_or(instruction_account_index)
as IndexOfAccount;
let index_in_transaction = *index_in_transaction as usize;
instruction_accounts.push(InstructionAccount {
index_in_transaction: index_in_transaction as IndexOfAccount,
index_in_caller: index_in_transaction as IndexOfAccount,
index_in_callee,
is_signer: message.is_signer(index_in_transaction),
is_writable: message.is_writable(index_in_transaction),
});
}
let result = if is_precompile {
invoke_context
.transaction_context
.get_next_instruction_context()
.map(|instruction_context| {
instruction_context.configure(
program_indices,
&instruction_accounts,
&instruction.data,
);
})
.and_then(|_| {
invoke_context.transaction_context.push()?;
invoke_context.transaction_context.pop()
})
} else {
let mut compute_units_consumed = 0;
let result = invoke_context.process_instruction(
&instruction.data,
&instruction_accounts,
program_indices,
&mut compute_units_consumed,
timings,
);
*accumulated_consumed_units =
accumulated_consumed_units.saturating_add(compute_units_consumed);
timings.details.accumulate_program(
program_id,
0,
compute_units_consumed,
result.is_err(),
);
invoke_context.timings = {
timings.details.accumulate(&invoke_context.timings);
ExecuteDetailsTimings::default()
};
result
};
result
.map_err(|err| TransactionError::InstructionError(instruction_index as u8, err))?;
}
Ok(ProcessedMessageInfo {
accounts_data_len_delta: invoke_context.get_accounts_data_meter().delta(),
})
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/Cargo.toml
|
[package]
name = "rust-analyzer-wasm"
version = "0.0.100" # mirror RA version
description = "Rust Analyzer WASM"
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "GPL-3.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["rust", "analyzer", "wasm"]
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
# Rust Analyzer crates
cfg = { package = "ra_ap_cfg", version = "0.0.100" }
ide = { package = "ra_ap_ide", version = "0.0.100" }
ide_db = { package = "ra_ap_ide_db", version = "0.0.100" }
hir = { package = "ra_ap_hir", version = "0.0.100" }
tt = { package = "ra_ap_tt", version = "0.0.100" }
cargo_toml = "0.14.1"
console_error_panic_hook = "0.1.7"
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
serde = { version = "1.0.180", features = ["derive"] }
serde_json = "1.0.104"
serde_repr = "0.1.6"
serde-wasm-bindgen = "0.1.3"
wasm-bindgen = "0.2.87"
wasm-bindgen-rayon = "1.0.3"
# Rust Analyzer has transitive dependency for `parking_lot` which pulls `parking_lot_core` without
# its `nightly` feature which has a default implementation of `panic!` on `wasm32`.
parking_lot_core_8 = { package = "parking_lot_core", version = "0.8.5", features = ["nightly"] }
parking_lot_core_9 = { package = "parking_lot_core", version = "0.9.8", features = ["nightly"] }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/Cargo.lock
|
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "always-assert"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11"
dependencies = [
"log",
]
[[package]]
name = "anymap"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33954243bd79057c2de7338850b85983a44588021f8a5fee574a8888c6de4344"
[[package]]
name = "arrayvec"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
[[package]]
name = "cargo_toml"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bfbc36312494041e2cdd5f06697b7e89d4b76f42773a0b5556ac290ff22acc2"
dependencies = [
"serde",
"toml",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chalk-derive"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58c24b8052ea1e3adbb6f9ab7ba5fcc18b9d12591c042de4c833f709ce81e0e0"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.81",
"synstructure",
]
[[package]]
name = "chalk-ir"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cad5c3f1edd4b4a2c9bda24ae558ceb4f88336f88f944c2e35d0bfeb13c818"
dependencies = [
"bitflags",
"chalk-derive",
"lazy_static",
]
[[package]]
name = "chalk-recursive"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e68ba0c7219f34738b66c0c992438c644ca33f4d8a29da3d41604299c7eaf419"
dependencies = [
"chalk-derive",
"chalk-ir",
"chalk-solve",
"rustc-hash",
"tracing",
]
[[package]]
name = "chalk-solve"
version = "0.76.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94533188d3452bc72cbd5618d166f45fc7646b674ad3fe9667d557bc25236dee"
dependencies = [
"chalk-derive",
"chalk-ir",
"ena",
"indexmap",
"itertools",
"petgraph",
"rustc-hash",
"tracing",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "countme"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03746e0c6dd9b5d2d9132ffe0bede35fb5f815604fd371bb42599fd37bc8e483"
dependencies = [
"dashmap 4.0.2",
"once_cell",
"rustc-hash",
]
[[package]]
name = "cov-mark"
version = "2.0.0-pre.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d48d8f76bd9331f19fe2aaf3821a9f9fb32c3963e1e3d6ce82a8c09cef7444a"
[[package]]
name = "crossbeam-channel"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
dependencies = [
"cfg-if",
"crossbeam-utils",
"lazy_static",
"memoffset 0.6.4",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
dependencies = [
"cfg-if",
"lazy_static",
]
[[package]]
name = "dashmap"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
dependencies = [
"cfg-if",
"num_cpus",
]
[[package]]
name = "dashmap"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0834a35a3fce649144119e18da2a4d8ed12ef3862f47183fd46f625d072d96c"
dependencies = [
"cfg-if",
"num_cpus",
"parking_lot 0.12.1",
]
[[package]]
name = "dissimilar"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31ad93652f40969dead8d4bf897a41e9462095152eb21c56e5830537e41179dd"
[[package]]
name = "dot"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a74b6c4d4a1cff5f454164363c16b72fa12463ca6b31f4b5f2035a65fa3d5906"
[[package]]
name = "drop_bomb"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bda8e21c04aca2ae33ffc2fd8c23134f3cac46db123ba97bd9d3f3b8a4a85e1"
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "ena"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3"
dependencies = [
"log",
]
[[package]]
name = "fixedbitset"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "form_urlencoded"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
"matches",
"percent-encoding",
]
[[package]]
name = "fst"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a"
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "hermit-abi"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "indexmap"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
dependencies = [
"autocfg",
"hashbrown 0.11.2",
]
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "itertools"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "js-sys"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
[[package]]
name = "lock_api"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
[[package]]
name = "memoffset"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
dependencies = [
"autocfg",
]
[[package]]
name = "miow"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7377f7792b3afb6a3cba68daa54ca23c032137010460d667fda53a8d66be00e"
dependencies = [
"windows-sys",
]
[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "once_cell"
version = "1.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
[[package]]
name = "oorandom"
version = "11.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.8",
]
[[package]]
name = "parking_lot_core"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall 0.2.10",
"smallvec",
"winapi",
]
[[package]]
name = "parking_lot_core"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.3.5",
"smallvec",
"windows-targets",
]
[[package]]
name = "percent-encoding"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "perf-event"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5396562cd2eaa828445d6d34258ae21ee1eb9d40fe626ca7f51c8dccb4af9d66"
dependencies = [
"libc",
"perf-event-open-sys",
]
[[package]]
name = "perf-event-open-sys"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a"
dependencies = [
"libc",
]
[[package]]
name = "petgraph"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]]
name = "pin-project-lite"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
[[package]]
name = "proc-macro2"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "pulldown-cmark"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
dependencies = [
"bitflags",
"memchr",
"unicase",
]
[[package]]
name = "pulldown-cmark-to-cmark"
version = "10.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0194e6e1966c23cc5fd988714f85b18d548d773e81965413555d96569931833d"
dependencies = [
"pulldown-cmark",
]
[[package]]
name = "quote"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
dependencies = [
"proc-macro2",
]
[[package]]
name = "ra_ap_base_db"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53e25acedca89d0d01d32904bab09ad047307190a937933312c37f7470c6666"
dependencies = [
"ra_ap_cfg",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_test_utils",
"ra_ap_tt",
"ra_ap_vfs",
"rustc-hash",
"salsa",
]
[[package]]
name = "ra_ap_cfg"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ab7fc0c437ce9a1eca380bd07dce9e434d231deaa7056f475d500ae31f3a943"
dependencies = [
"ra_ap_tt",
"rustc-hash",
]
[[package]]
name = "ra_ap_hir"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31c750cf164ef6b638eab66d9c170c22774a9d923e31a23d8762bbbf0bf723b4"
dependencies = [
"arrayvec",
"either",
"itertools",
"once_cell",
"ra_ap_base_db",
"ra_ap_cfg",
"ra_ap_hir_def",
"ra_ap_hir_expand",
"ra_ap_hir_ty",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_tt",
"rustc-hash",
"smallvec",
]
[[package]]
name = "ra_ap_hir_def"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248657589cea0fe6b685155a7c965316f2b72f10098bcf89c3fa80f2e6fe827b"
dependencies = [
"anymap",
"arrayvec",
"cov-mark",
"dashmap 5.1.0",
"drop_bomb",
"either",
"fst",
"indexmap",
"itertools",
"lock_api",
"once_cell",
"parking_lot 0.12.1",
"ra_ap_base_db",
"ra_ap_cfg",
"ra_ap_hir_expand",
"ra_ap_la-arena",
"ra_ap_limit",
"ra_ap_mbe",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_tt",
"rustc-hash",
"smallvec",
"tracing",
]
[[package]]
name = "ra_ap_hir_expand"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f835d778b13728f44d086b563c9dd30e17e3276227d5ff9ec68a87eff67c4d"
dependencies = [
"cov-mark",
"either",
"hashbrown 0.12.3",
"itertools",
"ra_ap_base_db",
"ra_ap_cfg",
"ra_ap_la-arena",
"ra_ap_limit",
"ra_ap_mbe",
"ra_ap_profile",
"ra_ap_syntax",
"ra_ap_tt",
"rustc-hash",
"tracing",
]
[[package]]
name = "ra_ap_hir_ty"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "661f21ca49d595a92f86bf5956cc933d831d5ebb386c6902f9393920f277d2e2"
dependencies = [
"arrayvec",
"chalk-ir",
"chalk-recursive",
"chalk-solve",
"cov-mark",
"ena",
"itertools",
"once_cell",
"ra_ap_base_db",
"ra_ap_hir_def",
"ra_ap_hir_expand",
"ra_ap_la-arena",
"ra_ap_limit",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"rustc-hash",
"scoped-tls",
"smallvec",
"tracing",
"typed-arena",
]
[[package]]
name = "ra_ap_ide"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9dbe701cc19cfd3138a3bc620049f2fa9d04e466847af35aae54e98fa9b41a"
dependencies = [
"cov-mark",
"crossbeam-channel",
"dot",
"either",
"itertools",
"oorandom",
"pulldown-cmark",
"pulldown-cmark-to-cmark",
"ra_ap_cfg",
"ra_ap_hir",
"ra_ap_ide_assists",
"ra_ap_ide_completion",
"ra_ap_ide_db",
"ra_ap_ide_diagnostics",
"ra_ap_ide_ssr",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_text_edit",
"rustc-hash",
"tracing",
"url",
]
[[package]]
name = "ra_ap_ide_assists"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61ea84a48d23239f6161d26c2960cb68c5b92dbcdf19323003ec531d8693f43d"
dependencies = [
"cov-mark",
"either",
"itertools",
"ra_ap_hir",
"ra_ap_ide_db",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_text_edit",
"rustc-hash",
]
[[package]]
name = "ra_ap_ide_completion"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd8aebf3ad357625618e7c5d52109b48b6780b0b182450e2e88c5eb6605a4d3"
dependencies = [
"cov-mark",
"either",
"itertools",
"once_cell",
"ra_ap_base_db",
"ra_ap_hir",
"ra_ap_ide_db",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_text_edit",
"rustc-hash",
"smallvec",
]
[[package]]
name = "ra_ap_ide_db"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d397109567be225ba717bb77fe2404386aaf053ef503ee64dedf67a1edad86a"
dependencies = [
"arrayvec",
"cov-mark",
"either",
"fst",
"indexmap",
"itertools",
"once_cell",
"ra_ap_base_db",
"ra_ap_hir",
"ra_ap_limit",
"ra_ap_parser",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_text_edit",
"rayon",
"rustc-hash",
"tracing",
]
[[package]]
name = "ra_ap_ide_diagnostics"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34d7626426f51829b8cfdc3fc39b21e9236346f485ce2dad69a5336bea5aab07"
dependencies = [
"cov-mark",
"either",
"itertools",
"ra_ap_cfg",
"ra_ap_hir",
"ra_ap_ide_db",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_text_edit",
"rustc-hash",
]
[[package]]
name = "ra_ap_ide_ssr"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a4607b80411a3a903919de49f322026e4bec9f5c84447fa1f1122c021f5c9bb"
dependencies = [
"cov-mark",
"itertools",
"ra_ap_hir",
"ra_ap_ide_db",
"ra_ap_parser",
"ra_ap_syntax",
"ra_ap_text_edit",
"rustc-hash",
]
[[package]]
name = "ra_ap_la-arena"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec4a74fa438412b590793784cd528bfd53fc3b8a21911c885108b6661373ca03"
[[package]]
name = "ra_ap_limit"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5446833f7b74d9c66af6ea652f45b721adfddc5f81f2f70869a568ce21aedee3"
[[package]]
name = "ra_ap_mbe"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc176441cc7f466f6da9bc64359ccee7031d897b06119d684bb9c21e91f7671"
dependencies = [
"cov-mark",
"ra_ap_parser",
"ra_ap_stdx",
"ra_ap_syntax",
"ra_ap_tt",
"rustc-hash",
"smallvec",
"tracing",
]
[[package]]
name = "ra_ap_parser"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9924badc34c14b5f6e0ed34d004a5b8f38c82aafb0c93ffd52c5531019f777ae"
dependencies = [
"drop_bomb",
"ra_ap_limit",
"rustc-ap-rustc_lexer",
]
[[package]]
name = "ra_ap_paths"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee88daf3ab9b7c022a47c75f07c94137fcaa9b77314760fea90ea5997a88120"
[[package]]
name = "ra_ap_profile"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8048ad93faed1c20f6f4fbc8948b91a05f5d9448198e0a231dcc152d8c7f0f00"
dependencies = [
"cfg-if",
"countme",
"libc",
"once_cell",
"perf-event",
"ra_ap_la-arena",
"winapi",
]
[[package]]
name = "ra_ap_stdx"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00e7f79a1f3f14466f83b39058a845da761a37a581af30e1c096a1b272f20325"
dependencies = [
"always-assert",
"libc",
"miow",
"winapi",
]
[[package]]
name = "ra_ap_syntax"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "618e9c2ac2c9108abcf5725980b5ba5e9fdf47e424ce9838bf9f0db37726033f"
dependencies = [
"cov-mark",
"indexmap",
"itertools",
"once_cell",
"ra_ap_parser",
"ra_ap_profile",
"ra_ap_stdx",
"ra_ap_text_edit",
"rowan",
"rustc-ap-rustc_lexer",
"rustc-hash",
"smol_str",
]
[[package]]
name = "ra_ap_test_utils"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "421aa7b5ec0fd80b4fdac820f9b4c7baf1a2df25bbee4b2fe138ef1d5a9d0c31"
dependencies = [
"dissimilar",
"ra_ap_profile",
"ra_ap_stdx",
"rustc-hash",
"text-size",
]
[[package]]
name = "ra_ap_text_edit"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8cbda156a665bb99e7a038d8438ca3028993acc75d51317e298e3d18975a12"
dependencies = [
"itertools",
"text-size",
]
[[package]]
name = "ra_ap_tt"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38cc38dc1cf90daaa99745499608caf55b6b2da396f9f0a22b0797bc27da5edb"
dependencies = [
"ra_ap_stdx",
"smol_str",
]
[[package]]
name = "ra_ap_vfs"
version = "0.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b836a09668d5b7d3de94d51201de38ddfff1d60e9c333db353f9f90e1fcb417"
dependencies = [
"fst",
"indexmap",
"ra_ap_paths",
"rustc-hash",
]
[[package]]
name = "rayon"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
dependencies = [
"autocfg",
"crossbeam-deque",
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"lazy_static",
"num_cpus",
]
[[package]]
name = "redox_syscall"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags",
]
[[package]]
name = "rowan"
version = "0.15.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64449cfef9483a475ed56ae30e2da5ee96448789fb2aa240a04beb6a055078bf"
dependencies = [
"countme",
"hashbrown 0.12.3",
"memoffset 0.8.0",
"rustc-hash",
"text-size",
]
[[package]]
name = "rust-analyzer-wasm"
version = "0.0.100"
dependencies = [
"cargo_toml",
"console_error_panic_hook",
"instant",
"parking_lot_core 0.8.5",
"parking_lot_core 0.9.8",
"ra_ap_cfg",
"ra_ap_hir",
"ra_ap_ide",
"ra_ap_ide_db",
"ra_ap_tt",
"serde",
"serde-wasm-bindgen",
"serde_json",
"serde_repr",
"wasm-bindgen",
"wasm-bindgen-rayon",
]
[[package]]
name = "rustc-ap-rustc_lexer"
version = "725.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f950742ef8a203aa7661aad3ab880438ddeb7f95d4b837c30d65db1a2c5df68e"
dependencies = [
"unicode-xid",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "salsa"
version = "0.17.0-pre.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b223dccb46c32753144d0b51290da7230bb4aedcd8379d6b4c9a474c18bf17a"
dependencies = [
"crossbeam-utils",
"indexmap",
"lock_api",
"log",
"oorandom",
"parking_lot 0.11.2",
"rustc-hash",
"salsa-macros",
"smallvec",
]
[[package]]
name = "salsa-macros"
version = "0.17.0-pre.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac6c2e352df550bf019da7b16164ed2f7fa107c39653d1311d1bba42d1582ff7"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 1.0.81",
]
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
version = "1.0.180"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde-wasm-bindgen"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee6f12f7ed0e7ad2e55200da37dbabc2cadeb942355c5b629aa3771f5ac5636"
dependencies = [
"fnv",
"js-sys",
"serde",
"wasm-bindgen",
]
[[package]]
name = "serde_derive"
version = "1.0.180"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.28",
]
[[package]]
name = "serde_json"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "serde_repr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.81",
]
[[package]]
name = "smallvec"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
[[package]]
name = "smol_str"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61d15c83e300cce35b7c8cd39ff567c1ef42dde6d4a1a38dbdbf9a59902261bd"
dependencies = [
"serde",
]
[[package]]
name = "spmc"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5"
[[package]]
name = "syn"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "syn"
version = "2.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.81",
"unicode-xid",
]
[[package]]
name = "text-size"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a"
[[package]]
name = "tinyvec"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]]
name = "tracing"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
dependencies = [
"cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.81",
]
[[package]]
name = "tracing-core"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4"
dependencies = [
"lazy_static",
]
[[package]]
name = "typed-arena"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
[[package]]
name = "unicode-bidi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
[[package]]
name = "unicode-ident"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "unicode-normalization"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
"form_urlencoded",
"idna",
"matches",
"percent-encoding",
]
[[package]]
name = "version_check"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "wasm-bindgen"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.28",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.28",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-rayon"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df87c67450805c305d3ae44a3ac537b0253d029153c25afc3ecd2edc36ccafb1"
dependencies = [
"js-sys",
"rayon",
"spmc",
"wasm-bindgen",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "web-sys"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6"
dependencies = [
"windows_aarch64_msvc 0.28.0",
"windows_i686_gnu 0.28.0",
"windows_i686_msvc 0.28.0",
"windows_x86_64_gnu 0.28.0",
"windows_x86_64_msvc 0.28.0",
]
[[package]]
name = "windows-targets"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.48.0",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_i686_gnu"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_x86_64_gnu"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/rust-toolchain.toml
|
[toolchain]
channel = "nightly-2022-12-12"
targets = ["wasm32-unknown-unknown"]
components = ["rust-src"]
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/.cargo/config
|
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"]
[unstable]
build-std = ["panic_abort", "std"]
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/snippet.rs
|
use ide::{Snippet, SnippetScope};
use serde::Deserialize;
/// Get snippets from JSON string.
pub fn get_snippets_from_str(snippets: &str) -> Vec<Snippet> {
serde_json::from_str::<serde_json::Value>(snippets)
.unwrap()
.as_object()
.unwrap()
.iter()
.map(|(name, snippet)| {
(
name,
serde_json::from_value::<SnippetDef>(snippet.to_owned()).unwrap(),
)
})
.filter_map(|(name, snippet)| {
Snippet::new(
&snippet.prefix,
&snippet.postfix,
&snippet.body,
snippet.description.as_ref().unwrap_or(name),
&snippet.requires,
match snippet.scope {
SnippetScopeDef::Expr => SnippetScope::Expr,
SnippetScopeDef::Type => SnippetScope::Type,
SnippetScopeDef::Item => SnippetScope::Item,
},
)
})
.collect::<Vec<_>>()
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct SnippetDef {
#[serde(deserialize_with = "single_or_array")]
prefix: Vec<String>,
#[serde(deserialize_with = "single_or_array")]
postfix: Vec<String>,
description: Option<String>,
#[serde(deserialize_with = "single_or_array")]
body: Vec<String>,
#[serde(deserialize_with = "single_or_array")]
requires: Vec<String>,
scope: SnippetScopeDef,
}
#[derive(Deserialize)]
#[serde(rename_all = "snake_case")]
enum SnippetScopeDef {
Expr,
Item,
Type,
}
impl Default for SnippetScopeDef {
fn default() -> Self {
SnippetScopeDef::Expr
}
}
fn single_or_array<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
where
D: serde::Deserializer<'de>,
{
struct SingleOrVec;
impl<'de> serde::de::Visitor<'de> for SingleOrVec {
type Value = Vec<String>;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter.write_str("string or array of strings")
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
Ok(vec![value.to_owned()])
}
fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error>
where
A: serde::de::SeqAccess<'de>,
{
Deserialize::deserialize(serde::de::value::SeqAccessDeserializer::new(seq))
}
}
deserializer.deserialize_any(SingleOrVec)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/proc_macro.rs
|
use cargo_toml::Manifest;
use ide_db::base_db::ProcMacro;
/// Get whether the crate is a proc macro crate from manifest.
pub fn get_is_proc_macro(manifest: &Manifest) -> bool {
manifest
.lib
.as_ref()
.map(|lib| lib.proc_macro)
.unwrap_or_default()
}
/// Get proc macros from the given lib.
///
/// Full macro expansion depends on `rustc`, which is not available in browsers. In order to get
/// at least some of the type benefits, we manually expand the most used proc macros.
///
/// For example, without manual expansion of `#[account]` macro of the `anchor-lang` crate, there
/// are no completion hints for the accounts e.g. `ctx.accounts.<NAME>.<FIELD>`.
pub fn get_proc_macros(lib: &str) -> Vec<ProcMacro> {
/// Get implementations of the proc macros.
#[macro_export]
macro_rules! match_proc_macros {
($( $macro_name:literal => $struct_name:ident ),+) => {{
let mut proc_macros = vec![];
$(
let search_text = if $macro_name.starts_with("#[derive(") {
format!(
"# [proc_macro_derive ({} ",
$macro_name
.trim_start_matches("#[derive(")
.trim_end_matches(")]")
)
} else if $macro_name.starts_with("#[") {
format!(
"# [proc_macro_attribute] pub fn {} ",
$macro_name
.trim_start_matches("#[")
.trim_end_matches("]")
)
} else if $macro_name.ends_with('!') {
format!(
"# [proc_macro] pub fn {} ",
$macro_name.trim_end_matches('!')
)
} else {
unreachable!()
};
if lib.contains(&search_text) {
proc_macros.push($struct_name::to_proc_macro());
}
)+
proc_macros
}};
}
use manual_expansions::*;
match_proc_macros!(
"#[account]" => Account,
"#[program]" => Program,
"#[derive(BorshSerialize)]" => BorshSerialize,
"#[derive(BorshDeserialize)]" => BorshDeserialize,
"#[derive(Accounts)]" => Accounts,
"#[derive(InitSpace)]" => InitSpace,
"declare_id!" => DeclareId,
"program_declare_id!" => ProgramDeclareId
)
}
/// Manual proc macro expansions for completion hints.
mod manual_expansions {
use std::sync::Arc;
use ide_db::base_db::{
Env, ProcMacro, ProcMacroExpander, ProcMacroExpansionError, ProcMacroKind,
};
use tt::{Delimiter, DelimiterKind, Ident, Leaf, Punct, Spacing, Subtree, TokenId, TokenTree};
/// Implement dummy `ProcMacroExpander` for types.
#[macro_export]
macro_rules! expand {
// Derive
($struct_name:ident) => {
#[derive(Debug)]
pub(super) struct $struct_name;
impl ToProcMacro for $struct_name {
fn to_proc_macro() -> ProcMacro {
ProcMacro {
name: stringify!($struct_name).into(),
kind: ProcMacroKind::CustomDerive,
expander: Arc::new($struct_name),
}
}
}
impl ProcMacroExpander for $struct_name {
fn expand(
&self,
subtree: &Subtree,
_: Option<&Subtree>,
_: &Env,
) -> Result<Subtree, ProcMacroExpansionError> {
let name = get_name_from_subtree(subtree);
let expansion = format!("impl {} for {} {{ }}", stringify!($struct_name), name);
Ok(create_subtree(expansion))
}
}
};
// Derive with different trait names
($struct_name:ident, [$( $trait:literal ),+]) => {
#[derive(Debug)]
pub(super) struct $struct_name;
impl ToProcMacro for $struct_name {
fn to_proc_macro() -> ProcMacro {
ProcMacro {
name: stringify!($struct_name).into(),
kind: ProcMacroKind::CustomDerive,
expander: Arc::new($struct_name),
}
}
}
impl ProcMacroExpander for $struct_name {
fn expand(
&self,
subtree: &Subtree,
_: Option<&Subtree>,
_: &Env,
) -> Result<Subtree, ProcMacroExpansionError> {
let name = get_name_from_subtree(subtree);
let mut traits = vec![];
$(
let expansion = format!("impl {} for {} {{ }}", $trait, name);
traits.push(expansion);
)*
Ok(create_subtree(traits.join(" ")))
}
}
};
// Function like(!)
($struct_name:ident, $name:literal, $expansion:literal) => {
#[derive(Debug)]
pub(super) struct $struct_name;
impl ToProcMacro for $struct_name {
fn to_proc_macro() -> ProcMacro {
ProcMacro {
name: $name.into(),
kind: ProcMacroKind::FuncLike,
expander: Arc::new($struct_name),
}
}
}
impl ProcMacroExpander for $struct_name {
fn expand(
&self,
_: &Subtree,
_: Option<&Subtree>,
_: &Env,
) -> Result<Subtree, ProcMacroExpansionError> {
Ok(create_subtree($expansion))
}
}
};
// Attribute
($struct_name:ident, $name:literal, [$( $trait:literal ),*]) => {
#[derive(Debug)]
pub(super) struct $struct_name;
impl ToProcMacro for $struct_name {
fn to_proc_macro() -> ProcMacro {
ProcMacro {
name: $name.into(),
kind: ProcMacroKind::Attr,
expander: Arc::new($struct_name),
}
}
}
impl ProcMacroExpander for $struct_name {
fn expand(
&self,
subtree: &Subtree,
_: Option<&Subtree>,
_: &Env,
) -> Result<Subtree, ProcMacroExpansionError> {
#[allow(unused_variables)]
let name = get_name_from_subtree(subtree);
#[allow(unused_mut)]
let mut traits: Vec<String> = vec![];
$(
let expansion = format!("impl {} for {} {{ }}", $trait, name);
traits.push(expansion);
)*
let mut subtree = subtree.clone();
subtree
.token_trees
.extend(create_subtree(traits.join(" ")).token_trees);
Ok(subtree)
}
}
};
}
// Attribute
expand!(
Account,
"account",
[
"AccountDeserialize",
"AccountSerialize",
"AnchorDeserialize",
"AnchorSerialize",
"Clone",
"Discriminator",
"Owner"
]
);
expand!(Program, "program", []);
// Derive
expand!(BorshDeserialize);
expand!(BorshSerialize);
expand!(
Accounts,
[
"Accounts",
"ToAccountInfos",
"ToAccountMetas",
"AccountsExit"
]
);
expand!(InitSpace, ["Space"]);
// Function like
expand!(DeclareId, "declare_id", "pub static ID : Pubkey ;");
expand!(
ProgramDeclareId,
"program_declare_id",
"pub static ID : Pubkey ;"
);
/// Create a [`ProcMacro`], supertrait of [`ProcMacroExpander`]
pub(super) trait ToProcMacro: ProcMacroExpander {
/// Create a proc macro.
fn to_proc_macro() -> ProcMacro;
}
/// Create a subtree from the given string.
///
/// NOTE: This doesn't represent full parsing of a subtree.
fn create_subtree<S: AsRef<str>>(s: S) -> Subtree {
let s = s.as_ref().trim();
let (tokens, delimiter) = s
.chars()
.next()
.and_then(|char| get_matching_close_char(char).map(|close_char| (char, close_char)))
.map(|(open_char, close_char)| {
let tokens = s.trim_start_matches(open_char).trim_end_matches(close_char);
let delimiter = Delimiter {
id: TokenId::unspecified(),
kind: match open_char {
'{' => DelimiterKind::Brace,
'(' => DelimiterKind::Parenthesis,
'[' => DelimiterKind::Bracket,
_ => unreachable!(),
},
};
(tokens, Some(delimiter))
})
.unwrap_or((s, None));
let mut remaining_tokens = tokens.to_owned();
let mut matching_count = 0usize;
Subtree {
delimiter,
token_trees: tokens
.split_whitespace()
.filter_map(|token| {
let char = match token.chars().next() {
Some(c) => c,
_ => return None,
};
if ['}', ')', ']'].contains(&char) {
matching_count -= 1;
return None;
}
if matching_count != 0 {
None
} else if ['{', '(', '['].contains(&char) {
matching_count += 1;
let (inside, remaining) =
get_wrapping_subtree(&remaining_tokens, char).unwrap_or_default();
let subtree = create_subtree(inside);
remaining_tokens = remaining.to_owned();
Some(TokenTree::Subtree(subtree))
} else if [':', ';', ','].contains(&char) {
Some(TokenTree::Leaf(Leaf::Punct(Punct {
char,
id: TokenId::unspecified(),
spacing: Spacing::Alone,
})))
} else {
Some(TokenTree::Leaf(Leaf::Ident(Ident {
text: token.into(),
id: TokenId::unspecified(),
})))
}
})
.collect(),
}
}
/// Get inside of the subtree.
///
/// # Example
///
/// ```ignore
/// get_wrapping_subtree("pub struct MyAccount { field : u64 }", '{'); // Some(("{ field : u64 }", ""))
/// ```
///
/// Returns a tuple of (inside, remaining).
fn get_wrapping_subtree(content: &str, open_char: char) -> Option<(&str, &str)> {
let open_indices = content
.match_indices(open_char)
.map(|(i, _)| i)
.enumerate()
.collect::<Vec<(usize, usize)>>();
let close_char = match get_matching_close_char(open_char) {
Some(c) => c,
None => return None,
};
let close_indices = content
.match_indices(close_char)
.map(|(i, _)| i)
.collect::<Vec<usize>>();
for (i, open_index) in &open_indices {
let close_index = close_indices[*i];
let is_ok = open_indices
.iter()
.any(|(_, open_index)| *open_index < close_index);
if is_ok {
let inside = content.get(*open_index..close_index + 1).unwrap();
let remaining = content.get(close_index + 1..).unwrap();
return Some((inside, remaining));
}
}
None
}
/// Get the matching closing char.
const fn get_matching_close_char(open_char: char) -> Option<char> {
const INVALID: char = '_';
let close_char = match open_char {
'(' => ')',
'{' => '}',
'[' => ']',
_ => INVALID,
};
match close_char {
INVALID => None,
_ => Some(close_char),
}
}
/// Get item name from the given subtree.
fn get_name_from_subtree(subtree: &Subtree) -> String {
subtree
.token_trees
.iter()
.enumerate()
.find_map(|(i, tree)| {
if ["struct", "enum", "mod"].contains(&tree.to_string().as_str()) {
subtree
.token_trees
.get(i + 1)
.map(|token| token.to_string())
} else {
None
}
})
.unwrap_or_default()
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/lib.rs
|
//! This crate is a fork of https://github.com/rust-analyzer/rust-analyzer-wasm
mod proc_macro;
mod return_types;
mod snippet;
mod to_proto;
mod utils;
mod world_state;
use wasm_bindgen::prelude::*;
// Export rayon thread pool
pub use wasm_bindgen_rayon::init_thread_pool;
/// Show better error messages.
#[wasm_bindgen(start)]
pub fn start() {
console_error_panic_hook::set_once();
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/return_types.rs
|
use serde::{Deserialize, Serialize};
use serde_repr::Serialize_repr;
#[derive(Serialize)]
pub struct Hover {
pub range: Range,
pub contents: Vec<MarkdownString>,
}
#[derive(Serialize, Deserialize, Clone, Copy)]
#[serde(rename_all = "camelCase")]
pub struct Range {
pub start_line_number: u32,
pub start_column: u32,
pub end_line_number: u32,
pub end_column: u32,
}
#[derive(Serialize)]
pub struct MarkdownString {
pub value: String,
}
#[derive(Serialize, Deserialize)]
pub struct CodeLensSymbol {
pub range: Range,
pub command: Option<Command>,
}
#[derive(Serialize, Deserialize)]
pub struct Command {
pub id: String,
pub title: String,
pub positions: Vec<Range>,
}
#[derive(Serialize)]
pub struct Highlight {
pub tag: Option<String>,
pub range: Range,
}
#[derive(Serialize_repr)]
#[repr(u8)]
pub enum InlayHintType {
Type = 1,
Parameter = 2,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InlayHint {
pub label: Option<String>,
pub hint_type: InlayHintType,
pub range: Range,
}
#[derive(Serialize)]
pub struct TextEdit {
pub range: Range,
pub text: String,
}
#[derive(Serialize, Default)]
pub struct UpdateResult {
pub diagnostics: Vec<Diagnostic>,
pub highlights: Vec<Highlight>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Diagnostic {
pub message: String,
pub start_line_number: u32,
pub start_column: u32,
pub end_line_number: u32,
pub end_column: u32,
pub severity: MarkerSeverity,
}
#[allow(dead_code)]
#[derive(Serialize_repr)]
#[repr(u8)]
pub enum MarkerSeverity {
Hint = 1,
Info = 2,
Warning = 4,
Error = 8,
}
#[derive(Serialize)]
pub struct RenameLocation {
pub range: Range,
pub text: String,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CompletionItem {
pub label: String,
pub range: Range,
pub kind: CompletionItemKind,
pub detail: Option<String>,
pub insert_text: String,
pub insert_text_rules: CompletionItemInsertTextRule,
pub documentation: Option<MarkdownString>,
pub filter_text: String,
pub additional_text_edits: Vec<TextEdit>,
}
#[allow(dead_code)]
#[derive(Serialize_repr)]
#[repr(u8)]
pub enum CompletionItemKind {
Method = 0,
Function = 1,
Constructor = 2,
Field = 3,
Variable = 4,
Class = 5,
Struct = 6,
Interface = 7,
Module = 8,
Property = 9,
Event = 10,
Operator = 11,
Unit = 12,
Value = 13,
Constant = 14,
Enum = 15,
EnumMember = 16,
Keyword = 17,
Text = 18,
Color = 19,
File = 20,
Reference = 21,
Customcolor = 22,
Folder = 23,
TypeParameter = 24,
User = 25,
Issue = 26,
Snippet = 27,
}
#[allow(dead_code)]
#[derive(Serialize_repr)]
#[repr(u8)]
pub enum CompletionItemInsertTextRule {
None = 0,
/**
* Adjust whitespace/indentation of multiline insert texts to
* match the current line indentation.
*/
KeepWhitespace = 1,
/**
* `insert_text` is a snippet.
*/
InsertAsSnippet = 4,
}
#[derive(Serialize)]
pub struct ParameterInformation {
pub label: String,
}
#[derive(Serialize)]
pub struct SignatureInformation {
pub label: String,
pub documentation: Option<MarkdownString>,
pub parameters: Vec<ParameterInformation>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SignatureHelp {
pub signatures: [SignatureInformation; 1],
pub active_signature: u32,
pub active_parameter: Option<usize>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LocationLink {
pub origin_selection_range: Range,
pub range: Range,
pub target_selection_range: Range,
}
#[allow(dead_code)]
#[derive(Serialize_repr)]
#[repr(u8)]
pub enum SymbolTag {
None = 0,
Deprecated = 1,
}
#[allow(dead_code)]
#[derive(Serialize_repr)]
#[repr(u8)]
pub enum SymbolKind {
File = 0,
Module = 1,
Namespace = 2,
Package = 3,
Class = 4,
Method = 5,
Property = 6,
Field = 7,
Constructor = 8,
Enum = 9,
Interface = 10,
Function = 11,
Variable = 12,
Constant = 13,
String = 14,
Number = 15,
Boolean = 16,
Array = 17,
Object = 18,
Key = 19,
Null = 20,
EnumMember = 21,
Struct = 22,
Event = 23,
Operator = 24,
TypeParameter = 25,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DocumentSymbol {
pub name: String,
pub detail: String,
pub kind: SymbolKind,
pub tags: [SymbolTag; 1],
pub container_name: Option<String>,
pub range: Range,
pub selection_range: Range,
pub children: Option<Vec<DocumentSymbol>>,
}
#[allow(dead_code)]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub enum FoldingRangeKind {
Comment,
Imports,
Region,
}
#[derive(Serialize)]
pub struct FoldingRange {
pub start: u32,
pub end: u32,
pub kind: Option<FoldingRangeKind>,
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/to_proto.rs
|
//! Conversion of `rust-analyzer` specific types to `return_types` equivalents.
use ide_db::rust_doc::is_rust_fence;
use crate::return_types;
/// Convert text range.
pub(crate) fn text_range(
range: ide::TextRange,
line_index: &ide::LineIndex,
) -> return_types::Range {
let start = line_index.line_col(range.start());
let end = line_index.line_col(range.end());
return_types::Range {
start_line_number: start.line + 1,
start_column: start.col + 1,
end_line_number: end.line + 1,
end_column: end.col + 1,
}
}
/// Convert completion item kind.
pub(crate) fn completion_item_kind(
kind: ide::CompletionItemKind,
) -> return_types::CompletionItemKind {
use return_types::CompletionItemKind::*;
match kind {
ide::CompletionItemKind::Binding => Variable,
ide::CompletionItemKind::BuiltinType => Struct,
ide::CompletionItemKind::Keyword => Keyword,
ide::CompletionItemKind::Snippet => Snippet,
ide::CompletionItemKind::Method => Method,
ide::CompletionItemKind::UnresolvedReference => User,
ide::CompletionItemKind::SymbolKind(it) => match it {
ide::SymbolKind::Attribute => Function,
ide::SymbolKind::BuiltinAttr => Function,
ide::SymbolKind::Const => Constant,
ide::SymbolKind::ConstParam => Constant,
ide::SymbolKind::Derive => Function,
ide::SymbolKind::Enum => Enum,
ide::SymbolKind::Field => Field,
ide::SymbolKind::Function => Function,
ide::SymbolKind::Impl => Interface,
ide::SymbolKind::Label => Constant,
ide::SymbolKind::LifetimeParam => TypeParameter,
ide::SymbolKind::Local => Variable,
ide::SymbolKind::Macro => Function,
ide::SymbolKind::Module => Module,
ide::SymbolKind::SelfParam => Value,
ide::SymbolKind::SelfType => TypeParameter,
ide::SymbolKind::Static => Value,
ide::SymbolKind::Struct => Struct,
ide::SymbolKind::Trait => Interface,
ide::SymbolKind::TypeAlias => Value,
ide::SymbolKind::TypeParam => TypeParameter,
ide::SymbolKind::ToolModule => Module,
ide::SymbolKind::Union => Struct,
ide::SymbolKind::ValueParam => TypeParameter,
ide::SymbolKind::Variant => User,
},
}
}
/// Convert severity.
pub(crate) fn severity(s: ide::Severity) -> return_types::MarkerSeverity {
match s {
ide::Severity::Error => return_types::MarkerSeverity::Error,
ide::Severity::WeakWarning => return_types::MarkerSeverity::Hint,
}
}
/// Convert text edit.
pub(crate) fn text_edit(indel: &ide::Indel, line_index: &ide::LineIndex) -> return_types::TextEdit {
let text = indel.insert.clone();
return_types::TextEdit {
range: text_range(indel.delete, line_index),
text,
}
}
/// Convert text edits.
pub(crate) fn text_edits(edit: ide::TextEdit, ctx: &ide::LineIndex) -> Vec<return_types::TextEdit> {
edit.iter().map(|atom| text_edit(atom, ctx)).collect()
}
/// Convert completion item.
pub(crate) fn completion_item(
item: ide::CompletionItem,
line_index: &ide::LineIndex,
) -> return_types::CompletionItem {
let mut additional_text_edits = Vec::new();
let mut edit = None;
// LSP does not allow arbitrary edits in completion, so we have to do a
// non-trivial mapping here.
for atom_edit in item.text_edit().iter() {
if item.source_range().contains_range(atom_edit.delete) {
edit = Some(if atom_edit.delete == item.source_range() {
text_edit(atom_edit, line_index)
} else {
assert!(item.source_range().end() == atom_edit.delete.end());
let range1 =
ide::TextRange::new(atom_edit.delete.start(), item.source_range().start());
let range2 = item.source_range();
let edit1 = ide::Indel::replace(range1, String::new());
let edit2 = ide::Indel::replace(range2, atom_edit.insert.clone());
additional_text_edits.push(text_edit(&edit1, line_index));
text_edit(&edit2, line_index)
})
} else {
edit = Some(text_edit(atom_edit, line_index));
}
}
let return_types::TextEdit { range, text } = edit.unwrap();
return_types::CompletionItem {
kind: completion_item_kind(item.kind()),
label: item.label().to_string(),
range,
detail: item.detail().map(|it| it.to_string()),
insert_text: text,
insert_text_rules: if item.is_snippet() {
return_types::CompletionItemInsertTextRule::InsertAsSnippet
} else {
return_types::CompletionItemInsertTextRule::None
},
documentation: item
.documentation()
.map(|doc| markdown_string(doc.as_str())),
filter_text: item.lookup().to_string(),
additional_text_edits,
}
}
/// Convert signature information.
pub(crate) fn signature_information(
call_info: ide::CallInfo,
) -> return_types::SignatureInformation {
use return_types::{ParameterInformation, SignatureInformation};
let label = call_info.signature.clone();
let documentation = call_info.doc.as_ref().map(|doc| markdown_string(doc));
let parameters = call_info
.parameter_labels()
.into_iter()
.map(|param| ParameterInformation {
label: param.to_string(),
})
.collect();
SignatureInformation {
label,
documentation,
parameters,
}
}
/// Convert location links.
pub(crate) fn location_links(
nav_info: ide::RangeInfo<Vec<ide::NavigationTarget>>,
line_index: &ide::LineIndex,
) -> Vec<return_types::LocationLink> {
let selection = text_range(nav_info.range, line_index);
nav_info
.info
.into_iter()
.map(|nav| {
let range = text_range(nav.full_range, line_index);
let target_selection_range = nav
.focus_range
.map(|it| text_range(it, line_index))
.unwrap_or(range);
return_types::LocationLink {
origin_selection_range: selection,
range,
target_selection_range,
}
})
.collect()
}
/// Convert symbol kind.
pub(crate) fn symbol_kind(kind: ide::StructureNodeKind) -> return_types::SymbolKind {
use return_types::SymbolKind;
let kind = match kind {
ide::StructureNodeKind::SymbolKind(it) => it,
ide::StructureNodeKind::Region => return SymbolKind::Property,
};
match kind {
ide::SymbolKind::Attribute => SymbolKind::Function,
ide::SymbolKind::BuiltinAttr => SymbolKind::Function,
ide::SymbolKind::Const => SymbolKind::Constant,
ide::SymbolKind::ConstParam => SymbolKind::Constant,
ide::SymbolKind::Derive => SymbolKind::Function,
ide::SymbolKind::Enum => SymbolKind::Enum,
ide::SymbolKind::Field => SymbolKind::Field,
ide::SymbolKind::Function => SymbolKind::Function,
ide::SymbolKind::Impl => SymbolKind::Interface,
ide::SymbolKind::Label => SymbolKind::Variable,
ide::SymbolKind::LifetimeParam => SymbolKind::TypeParameter,
ide::SymbolKind::Local => SymbolKind::Variable,
ide::SymbolKind::Macro => SymbolKind::Function,
ide::SymbolKind::Module => SymbolKind::Module,
ide::SymbolKind::SelfParam => SymbolKind::Variable,
ide::SymbolKind::Static => SymbolKind::Constant,
ide::SymbolKind::Struct => SymbolKind::Struct,
ide::SymbolKind::ToolModule => SymbolKind::Module,
ide::SymbolKind::Trait => SymbolKind::Interface,
ide::SymbolKind::TypeAlias | ide::SymbolKind::TypeParam | ide::SymbolKind::SelfType => {
SymbolKind::TypeParameter
}
ide::SymbolKind::Union => SymbolKind::Struct,
ide::SymbolKind::ValueParam => SymbolKind::Variable,
ide::SymbolKind::Variant => SymbolKind::EnumMember,
}
}
/// Convert folding range.
pub(crate) fn folding_range(fold: ide::Fold, ctx: &ide::LineIndex) -> return_types::FoldingRange {
let range = text_range(fold.range, ctx);
return_types::FoldingRange {
start: range.start_line_number,
end: range.end_line_number,
kind: match fold.kind {
ide::FoldKind::Comment => Some(return_types::FoldingRangeKind::Comment),
ide::FoldKind::Imports => Some(return_types::FoldingRangeKind::Imports),
ide::FoldKind::Region => Some(return_types::FoldingRangeKind::Region),
_ => None,
},
}
}
/// Convert markdown string.
pub(crate) fn markdown_string(src: &str) -> return_types::MarkdownString {
let mut processed_lines = Vec::new();
let mut in_code_block = false;
let mut is_rust = false;
for mut line in src.lines() {
if in_code_block && is_rust && code_line_ignored_by_rustdoc(line) {
continue;
}
if let Some(header) = line.strip_prefix("```") {
in_code_block ^= true;
if in_code_block {
is_rust = is_rust_fence(header);
if is_rust {
line = "```rust";
}
}
}
if in_code_block {
let trimmed = line.trim_start();
if trimmed.starts_with("##") {
line = &trimmed[1..];
}
}
processed_lines.push(line);
}
return_types::MarkdownString {
value: processed_lines.join("\n"),
}
}
/// Ignore the lines that start with `#`.
fn code_line_ignored_by_rustdoc(line: &str) -> bool {
let trimmed = line.trim();
trimmed == "#" || trimmed.starts_with("# ") || trimmed.starts_with("#\t")
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/world_state.rs
|
use std::{collections::BTreeMap, fmt::Display, sync::Arc};
use cargo_toml::Manifest;
use cfg::CfgOptions;
use hir::db::DefDatabase;
use ide::{
Analysis, AnalysisHost, Change, CompletionConfig, CrateGraph, CrateId, DiagnosticsConfig,
Edition, FileId, FilePosition, HoverConfig, HoverDocFormat, Indel, InlayHintsConfig, InlayKind,
LineIndex, SourceRoot, TextSize,
};
use ide_db::{
base_db::{
CrateData, CrateDisplayName, CrateName, CrateOrigin, Dependency, Env, FileLoader, FileSet,
VfsPath,
},
imports::insert_use::{ImportGranularity, InsertUseConfig, PrefixKind},
search::SearchScope,
SnippetCap,
};
use wasm_bindgen::prelude::*;
use crate::{
proc_macro, return_types, snippet, to_proto,
utils::{create_source_root, get_crate_id, get_file_id, get_file_position},
};
#[wasm_bindgen]
pub struct WorldState {
/// Current state of the world
host: AnalysisHost,
/// Current crate graph
crate_graph: CrateGraph,
/// All source roots
source_roots: Vec<SourceRoot>,
/// Mapping of crate names to their needed dependencies. Keeping track of the dependencies is
/// is necessary for lazy loading crates.
needed_deps: BTreeMap<String, Vec<String>>,
/// Current file id
file_id: FileId,
/// Completion config
completion_config: CompletionConfig,
}
#[wasm_bindgen]
impl WorldState {
/// Create a default world state.
#[wasm_bindgen(constructor)]
pub fn new() -> Self {
let mut host = AnalysisHost::default();
// Debugged why attribute macros don't expand for an eternity only to find out they are
// disabled by default when other proc macros are not :(
// https://github.com/rust-lang/rust-analyzer/blob/5e8515870674983cce5b945946045bc1e9b80200/crates/ide_db/src/lib.rs#L137
// https://github.com/rust-lang/rust-analyzer/blob/5e8515870674983cce5b945946045bc1e9b80200/crates/hir_def/src/nameres/collector.rs#L1220-L1222
//
// `hir::db::DefDatabase` must be in scope in order to have the option to enable proc
// attribute macros.
host.raw_database_mut().set_enable_proc_attr_macros(true);
Self {
host,
crate_graph: CrateGraph::default(),
source_roots: vec![],
needed_deps: BTreeMap::new(),
file_id: Self::LOCAL_FILE_ID,
completion_config: CompletionConfig {
enable_postfix_completions: true,
enable_imports_on_the_fly: true,
enable_self_on_the_fly: true,
enable_private_editable: false,
insert_use: InsertUseConfig {
granularity: ImportGranularity::Module,
enforce_granularity: false,
prefix_kind: PrefixKind::Plain,
group: true,
skip_glob_imports: false,
},
snippets: vec![],
snippet_cap: SnippetCap::new(true),
add_call_argument_snippets: true,
add_call_parenthesis: true,
},
}
}
/// Set custom snippets from the given JSON string.
///
/// Example input:
///
/// ```json
/// {
/// "declare_id!": {
/// "prefix": "di",
/// "body": "declare_id!(\"${receiver}\");",
/// "requires": "solana_program",
/// "description": "Declare program id",
/// "scope": "item"
/// }
/// }
/// ```
#[wasm_bindgen(js_name = setSnippets)]
pub fn set_snippets(&mut self, snippets: String) {
self.completion_config.snippets = snippet::get_snippets_from_str(&snippets);
}
/// Set the current local crate's display name.
#[wasm_bindgen(js_name = setLocalCrateName)]
pub fn set_local_crate_name(&mut self, name: String) {
let crate_data = self.get_mut_crate_data(Self::LOCAL_CRATE_ID);
crate_data.display_name = Some(CrateDisplayName::from_canonical_name(name));
let mut change = Change::new();
change.set_crate_graph(self.crate_graph.clone());
self.host.apply_change(change);
}
/// Load `std`, `core` and `alloc` libraries and initialize a default local crate.
#[wasm_bindgen(js_name = loadDefaultCrates)]
pub fn load_default_crates(&mut self, core_lib: String, alloc_lib: String, std_lib: String) {
const DEFAULT_NAME: &str = "solpg";
const CORE_FILE_ID: FileId = FileId(1);
const ALLOC_FILE_ID: FileId = FileId(2);
const STD_FILE_ID: FileId = FileId(3);
let mut change = Change::new();
// Add source roots
let local_source_root = {
let mut file_set = FileSet::default();
file_set.insert(
Self::LOCAL_FILE_ID,
VfsPath::new_virtual_path(format!("/{DEFAULT_NAME}/src/lib.rs")),
);
SourceRoot::new_local(file_set)
};
self.source_roots = vec![
local_source_root,
create_source_root(Self::CORE_NAME, CORE_FILE_ID),
create_source_root(Self::ALLOC_NAME, ALLOC_FILE_ID),
create_source_root(Self::STD_NAME, STD_FILE_ID),
];
change.set_roots(self.source_roots.clone());
// Add crate roots to the crate graph
let my_crate_id = self.add_crate_from_name(DEFAULT_NAME, Self::LOCAL_FILE_ID);
let core_crate_id = self.add_crate_from_name(Self::CORE_NAME, CORE_FILE_ID);
let alloc_crate_id = self.add_crate_from_name(Self::ALLOC_NAME, ALLOC_FILE_ID);
let std_crate_id = self.add_crate_from_name(Self::STD_NAME, STD_FILE_ID);
// Add dependencies
let core_dep = Dependency::new(CrateName::new(Self::CORE_NAME).unwrap(), core_crate_id);
let alloc_dep = Dependency::new(CrateName::new(Self::ALLOC_NAME).unwrap(), alloc_crate_id);
let std_dep = Dependency::new(CrateName::new(Self::STD_NAME).unwrap(), std_crate_id);
self.crate_graph
.add_dep(alloc_crate_id, core_dep.clone())
.unwrap();
self.crate_graph
.add_dep(std_crate_id, core_dep.clone())
.unwrap();
self.crate_graph
.add_dep(std_crate_id, alloc_dep.clone())
.unwrap();
self.crate_graph.add_dep(my_crate_id, core_dep).unwrap();
self.crate_graph.add_dep(my_crate_id, alloc_dep).unwrap();
self.crate_graph.add_dep(my_crate_id, std_dep).unwrap();
change.set_crate_graph(self.crate_graph.clone());
// Set file contents
change.change_file(Self::LOCAL_FILE_ID, Some(Arc::new("".into())));
change.change_file(CORE_FILE_ID, Some(Arc::new(core_lib)));
change.change_file(ALLOC_FILE_ID, Some(Arc::new(alloc_lib)));
change.change_file(STD_FILE_ID, Some(Arc::new(std_lib)));
self.host.apply_change(change);
}
/// Load the given files to the local crate.
///
/// File format is `Vec<[path, content]>`.
#[wasm_bindgen(js_name = loadLocalFiles)]
pub fn load_local_files(&mut self, files: JsValue) {
let files = serde_wasm_bindgen::from_value::<Vec<[String; 2]>>(files).unwrap();
let mut change = Change::new();
let mut file_set = FileSet::default();
for [path, content] in files {
let path = VfsPath::new_virtual_path(path);
let file_id = match path.name_and_extension() {
Some((name, _)) if name == "lib" => Self::LOCAL_FILE_ID,
_ => self.file_id_from_path(&path).unwrap_or(self.next_file_id()),
};
file_set.insert(file_id, path);
change.change_file(file_id, Some(Arc::new(content)));
}
self.source_roots[0] = SourceRoot::new_local(file_set);
change.set_roots(self.source_roots.clone());
self.host.apply_change(change);
}
/// Load the given dependency and its transitive dependencies.
///
/// Returns an array of needed dependencies if a crate doesn't exist in state.
#[wasm_bindgen(js_name = loadDependency)]
pub fn load_dependency(
&mut self,
name: String,
code: Option<String>,
manifest: Option<String>,
transitive: bool,
) -> JsValue {
let mut change = Change::new();
let manifest = Manifest::from_str(&manifest.unwrap_or(format!(
r#"
[package]
name = "{name}"
version = "0.0.0""#
)))
.unwrap();
let (file_id, crate_id) = match get_file_id(&name, &self.source_roots) {
Some(file_id) => (
*file_id,
get_crate_id(&name, &self.source_roots, &self.crate_graph).unwrap(),
),
None => {
let file_id = self.next_file_id();
// Add source root
self.source_roots.push(create_source_root(&name, file_id));
change.set_roots(self.source_roots.clone());
// Add crate root
let crate_id = self.add_crate(file_id, &manifest);
if !transitive {
self.crate_graph
.add_dep(
Self::LOCAL_CRATE_ID,
Dependency::new(CrateName::new(&name).unwrap(), crate_id),
)
.unwrap();
}
(file_id, crate_id)
}
};
// Load full crate
if code.is_some() {
// Add default dependencies
for crate_name in [Self::CORE_NAME, Self::ALLOC_NAME, Self::STD_NAME] {
let dep = Dependency::new(
CrateName::new(crate_name).unwrap(),
get_crate_id(crate_name, &self.source_roots, &self.crate_graph).unwrap(),
);
self.crate_graph.add_dep(crate_id, dep).unwrap();
}
// Set proc macros
if proc_macro::get_is_proc_macro(&manifest) {
let crate_data = self.get_mut_crate_data(crate_id);
crate_data.is_proc_macro = true;
crate_data.proc_macro = proc_macro::get_proc_macros(code.as_ref().unwrap());
}
}
// Change file
change.change_file(file_id, Some(Arc::new(code.unwrap_or_default())));
// Handle transitive dependencies
let mut needed_deps = vec![];
for (dep_name, _) in manifest.dependencies {
// Only snake_case crate names are allowed
let dep_name = dep_name.replace('-', "_");
// Get whether the dependency already exists
match get_file_id(&dep_name, &self.source_roots) {
Some(file_id) if !self.host.raw_database().file_text(*file_id).is_empty() => {
self.crate_graph
.add_dep(
crate_id,
Dependency::new(
CrateName::new(&dep_name).unwrap(),
get_crate_id(&dep_name, &self.source_roots, &self.crate_graph)
.unwrap(),
),
)
.unwrap();
}
_ => needed_deps.push(dep_name),
}
}
let return_needed_deps = serde_wasm_bindgen::to_value(&needed_deps).unwrap();
// Check whether the current dependency needs to be added to a previous dependency
for (dep_name, deps) in &mut self.needed_deps {
if let Some(index) = deps.iter().position(|dep_name| dep_name == &name) {
self.crate_graph
.add_dep(
get_crate_id(dep_name, &self.source_roots, &self.crate_graph).unwrap(),
Dependency::new(CrateName::new(&name).unwrap(), crate_id),
)
.unwrap();
deps.remove(index);
}
}
// Store the needed deps to add dependency the next time this method is called
self.needed_deps.insert(name, needed_deps);
change.set_crate_graph(self.crate_graph.clone());
self.host.apply_change(change);
return_needed_deps
}
/// Update the current file.
pub fn update(&mut self, path: String, content: String) -> JsValue {
let file_id = match self.file_id_from_path(&VfsPath::new_virtual_path(path)) {
Some(file_id) => file_id,
None => {
return serde_wasm_bindgen::to_value(&return_types::UpdateResult::default())
.unwrap()
}
};
// Set the current file id
self.file_id = file_id;
// Set the file content
{
let mut change: Change = Change::new();
// Append a new line to the content in order to fix cursor index out of bound panic when
// importing when on the last character of the file.
change.change_file(file_id, Some(Arc::new(format!("{content}\n"))));
self.host.apply_change(change);
}
let line_index = self.analysis().file_line_index(file_id).unwrap();
let highlights = self
.analysis()
.highlight(file_id)
.unwrap()
.into_iter()
.map(|hl| return_types::Highlight {
tag: Some(hl.highlight.tag.to_string()),
range: to_proto::text_range(hl.range, &line_index),
})
.collect();
let diagnostics = self
.analysis()
.diagnostics(
&DiagnosticsConfig::default(),
ide::AssistResolveStrategy::All,
file_id,
)
.unwrap()
.into_iter()
.map(|d| {
let return_types::Range {
start_line_number,
start_column,
end_line_number,
end_column,
} = to_proto::text_range(d.range, &line_index);
return_types::Diagnostic {
message: d.message,
severity: to_proto::severity(d.severity),
start_line_number,
start_column,
end_line_number,
end_column,
}
})
.collect();
serde_wasm_bindgen::to_value(&return_types::UpdateResult {
diagnostics,
highlights,
})
.unwrap()
}
/// Get inlay hints.
#[wasm_bindgen(js_name = inlayHints)]
pub fn inlay_hints(&self) -> JsValue {
let line_index = self.line_index();
let results = self
.analysis()
.inlay_hints(
&InlayHintsConfig {
type_hints: true,
parameter_hints: true,
chaining_hints: true,
hide_named_constructor_hints: true,
render_colons: true,
max_length: Some(25),
},
self.file_id,
None,
)
.unwrap()
.into_iter()
.map(|ih| return_types::InlayHint {
label: Some(ih.label.to_string()),
hint_type: match ih.kind {
InlayKind::TypeHint | InlayKind::ChainingHint => {
return_types::InlayHintType::Type
}
InlayKind::ParameterHint => return_types::InlayHintType::Parameter,
},
range: to_proto::text_range(ih.range, &line_index),
})
.collect::<Vec<_>>();
serde_wasm_bindgen::to_value(&results).unwrap()
}
/// Get completions.
pub fn completions(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let res = match self
.analysis()
.completions(&self.completion_config, pos)
.unwrap()
{
Some(items) => items,
None => return JsValue::NULL,
};
let items = res
.into_iter()
.map(|item| to_proto::completion_item(item, &line_index))
.collect::<Vec<_>>();
serde_wasm_bindgen::to_value(&items).unwrap()
}
/// Get hover info.
pub fn hover(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let hover = line_index
.offset(ide::LineCol {
line: line_number - 1,
col: column - 1,
})
.map(|offset| ide::TextRange::new(offset, offset))
.and_then(|range| {
self.analysis()
.hover(
&HoverConfig {
links_in_hover: true,
documentation: Some(HoverDocFormat::Markdown),
},
ide::FileRange {
file_id: self.file_id,
range,
},
)
.unwrap()
})
.map(|hover_result| return_types::Hover {
contents: vec![to_proto::markdown_string(hover_result.info.markup.as_str())],
range: to_proto::text_range(hover_result.range, &line_index),
});
serde_wasm_bindgen::to_value(&hover).unwrap()
}
/// Get code lenses.
#[wasm_bindgen(js_name = codeLenses)]
pub fn code_lenses(&self) -> JsValue {
let line_index = self.line_index();
let results = self
.analysis()
.file_structure(self.file_id)
.unwrap()
.into_iter()
.filter(|it| match it.kind {
ide::StructureNodeKind::SymbolKind(kind) => matches!(
kind,
ide_db::SymbolKind::Trait
| ide_db::SymbolKind::Struct
| ide_db::SymbolKind::Enum
),
ide::StructureNodeKind::Region => true,
})
.filter_map(|it| {
let position = FilePosition {
file_id: self.file_id,
offset: it.node_range.start(),
};
let nav_info = self.analysis().goto_implementation(position).unwrap()?;
let title = if nav_info.info.len() == 1 {
"1 implementation".into()
} else {
format!("{} implementations", nav_info.info.len())
};
let positions = nav_info
.info
.iter()
.map(|target| target.focus_range.unwrap_or(target.full_range))
.map(|range| to_proto::text_range(range, &line_index))
.collect();
Some(return_types::CodeLensSymbol {
range: to_proto::text_range(it.node_range, &line_index),
command: Some(return_types::Command {
id: "editor.action.showReferences".into(),
title,
positions,
}),
})
})
.collect::<Vec<_>>();
serde_wasm_bindgen::to_value(&results).unwrap()
}
/// Get references.
pub fn references(&self, line_number: u32, column: u32, include_declaration: bool) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let search_scope = Some(SearchScope::single_file(self.file_id));
let ref_results = match self.analysis().find_all_refs(pos, search_scope) {
Ok(Some(info)) => info,
_ => return JsValue::NULL,
};
let mut res = vec![];
for ref_result in ref_results {
if include_declaration {
if let Some(r) = ref_result.declaration {
let r = r.nav.focus_range.unwrap_or(r.nav.full_range);
res.push(return_types::Highlight {
tag: None,
range: to_proto::text_range(r, &line_index),
});
}
}
ref_result.references.iter().for_each(|(_id, ranges)| {
for (r, _) in ranges {
res.push(return_types::Highlight {
tag: None,
range: to_proto::text_range(*r, &line_index),
});
}
});
}
serde_wasm_bindgen::to_value(&res).unwrap()
}
/// Get prepare rename info.
#[wasm_bindgen(js_name = prepareRename)]
pub fn prepare_rename(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let range_info = match self.analysis().prepare_rename(pos).unwrap() {
Ok(refs) => refs,
_ => return JsValue::NULL,
};
let range = to_proto::text_range(range_info.range, &line_index);
let file_text = self.analysis().file_text(self.file_id).unwrap();
let text = file_text[range_info.range].to_owned();
serde_wasm_bindgen::to_value(&return_types::RenameLocation { range, text }).unwrap()
}
/// Get rename info.
pub fn rename(&self, line_number: u32, column: u32, new_name: &str) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let change = match self.analysis().rename(pos, new_name).unwrap() {
Ok(change) => change,
Err(_) => return JsValue::NULL,
};
let result = change
.source_file_edits
.iter()
.flat_map(|(_, edit)| edit.iter())
.map(|atom: &Indel| to_proto::text_edit(atom, &line_index))
.collect::<Vec<_>>();
serde_wasm_bindgen::to_value(&result).unwrap()
}
/// Get signature help.
#[wasm_bindgen(js_name = signatureHelp)]
pub fn signature_help(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let call_info = match self.analysis().call_info(pos) {
Ok(Some(call_info)) => call_info,
_ => return JsValue::NULL,
};
let active_parameter = call_info.active_parameter;
let sig_info = to_proto::signature_information(call_info);
let result = return_types::SignatureHelp {
signatures: [sig_info],
active_signature: 0,
active_parameter,
};
serde_wasm_bindgen::to_value(&result).unwrap()
}
/// Get definition.
pub fn definition(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let nav_info = match self.analysis().goto_definition(pos) {
Ok(Some(nav_info)) => nav_info,
_ => return JsValue::NULL,
};
let res = to_proto::location_links(nav_info, &line_index);
serde_wasm_bindgen::to_value(&res).unwrap()
}
/// Get type definition.
#[wasm_bindgen(js_name = typeDefinition)]
pub fn type_definition(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let nav_info = match self.analysis().goto_type_definition(pos) {
Ok(Some(nav_info)) => nav_info,
_ => return JsValue::NULL,
};
let res = to_proto::location_links(nav_info, &line_index);
serde_wasm_bindgen::to_value(&res).unwrap()
}
/// Get document symbols.
#[wasm_bindgen(js_name = documentSymbols)]
pub fn document_symbols(&self) -> JsValue {
let line_index = self.line_index();
let struct_nodes = match self.analysis().file_structure(self.file_id) {
Ok(struct_nodes) => struct_nodes,
_ => return JsValue::NULL,
};
let mut parents = Vec::new();
for symbol in struct_nodes {
let doc_symbol = return_types::DocumentSymbol {
name: symbol.label.clone(),
detail: symbol.detail.unwrap_or(symbol.label),
kind: to_proto::symbol_kind(symbol.kind),
range: to_proto::text_range(symbol.node_range, &line_index),
children: None,
tags: [if symbol.deprecated {
return_types::SymbolTag::Deprecated
} else {
return_types::SymbolTag::None
}],
container_name: None,
selection_range: to_proto::text_range(symbol.navigation_range, &line_index),
};
parents.push((doc_symbol, symbol.parent));
}
let mut res = Vec::new();
while let Some((node, parent)) = parents.pop() {
match parent {
None => res.push(node),
Some(i) => {
let children = &mut parents[i].0.children;
if children.is_none() {
*children = Some(Vec::new());
}
children.as_mut().unwrap().push(node);
}
}
}
serde_wasm_bindgen::to_value(&res).unwrap()
}
/// Get type formatting.
#[wasm_bindgen(js_name = typeFormatting)]
pub fn type_formatting(&self, line_number: u32, column: u32, ch: char) -> JsValue {
let line_index = self.line_index();
let mut pos = get_file_position(line_number, column, &line_index, self.file_id);
pos.offset -= TextSize::of('.');
let edit = self.analysis().on_char_typed(pos, ch);
let (_file, edit) = match edit {
Ok(Some(it)) => it.source_file_edits.into_iter().next().unwrap(),
_ => return JsValue::NULL,
};
let change = to_proto::text_edits(edit, &line_index);
serde_wasm_bindgen::to_value(&change).unwrap()
}
/// Get folding ranges.
#[wasm_bindgen(js_name = foldingRanges)]
pub fn folding_ranges(&self) -> JsValue {
let line_index = self.line_index();
if let Ok(folds) = self.analysis().folding_ranges(self.file_id) {
let res = folds
.into_iter()
.map(|fold| to_proto::folding_range(fold, &line_index))
.collect::<Vec<_>>();
serde_wasm_bindgen::to_value(&res).unwrap()
} else {
JsValue::NULL
}
}
/// Get go to implementation info.
#[wasm_bindgen(js_name = goToImplementation)]
pub fn go_to_implementation(&self, line_number: u32, column: u32) -> JsValue {
let line_index = self.line_index();
let pos = get_file_position(line_number, column, &line_index, self.file_id);
let nav_info = match self.analysis().goto_implementation(pos) {
Ok(Some(it)) => it,
_ => return JsValue::NULL,
};
let res = to_proto::location_links(nav_info, &line_index);
serde_wasm_bindgen::to_value(&res).unwrap()
}
}
impl WorldState {
/// `core` library name
const CORE_NAME: &str = "core";
/// `alloc` library name
const ALLOC_NAME: &str = "alloc";
/// `std` library name
const STD_NAME: &str = "std";
/// Default local file id.
const LOCAL_FILE_ID: FileId = FileId(0);
/// Default local crate id.
const LOCAL_CRATE_ID: CrateId = CrateId(0);
/// Get the current analysis.
fn analysis(&self) -> Analysis {
self.host.analysis()
}
/// Get the current line index.
fn line_index(&self) -> Arc<LineIndex> {
self.analysis().file_line_index(self.file_id).unwrap()
}
/// Get the last file id from source roots.
fn last_file_id(&self) -> FileId {
FileId(
self.source_roots
.iter()
.flat_map(|root| root.iter().map(|file_id| file_id.0))
.max()
.unwrap_or_default(),
)
}
/// Get the next file id.
fn next_file_id(&self) -> FileId {
FileId(self.last_file_id().0 + 1)
}
/// Get the file id from the given path.
fn file_id_from_path(&self, path: &VfsPath) -> Option<FileId> {
if self.source_roots.len() == 0 {
return Some(Self::LOCAL_FILE_ID);
}
self.source_roots
.iter()
.find_map(|root| root.file_for_path(path))
.map(|file_id| *file_id)
}
/// Add crate root based on the manifest file.
fn add_crate(&mut self, file_id: FileId, manifest: &Manifest) -> CrateId {
self.crate_graph.add_crate_root(
file_id,
match manifest.package().edition.get() {
Ok(edition) => match edition {
cargo_toml::Edition::E2015 => Edition::Edition2015,
cargo_toml::Edition::E2018 => Edition::Edition2021,
cargo_toml::Edition::E2021 => Edition::Edition2021,
},
Err(_) => Edition::Edition2021,
},
Some(CrateDisplayName::from_canonical_name(
manifest.package().name.to_owned(),
)),
manifest
.package()
.version
.get()
.map(|version| version.to_owned())
.ok(),
{
let mut cfg = CfgOptions::default();
cfg.insert_atom("unix".into());
cfg.insert_key_value("target_arch".into(), "x86_64".into());
cfg.insert_key_value("target_pointer_width".into(), "64".into());
cfg
},
Default::default(),
Env::default(),
vec![],
proc_macro::get_is_proc_macro(&manifest),
CrateOrigin::default(),
)
}
/// Add crate root from its name.
fn add_crate_from_name<D: Display>(&mut self, name: D, file_id: FileId) -> CrateId {
self.add_crate(
file_id,
Manifest::from_str(&format!(
r#"
[package]
name = "{name}"
version = "0.0.0"
"#
))
.as_ref()
.unwrap(),
)
}
/// Get mutable reference to the crate data.
fn get_mut_crate_data(&self, crate_id: CrateId) -> &mut CrateData {
let ptr = &self.crate_graph[crate_id] as *const CrateData as *mut CrateData;
// SAFETY: Undefined Behavior.
//
// From https://doc.rust-lang.org/nomicon/transmutes.html
// Transmuting an `&` to `&mut` is Undefined Behavior. While certain usages may appear
// safe, note that the Rust optimizer is free to assume that a shared reference won't
// change through its lifetime and thus such transmutation will run afoul of those
// assumptions. So:
// - Transmuting an `&` to `&mut` is *always* Undefined Behavior.
// - No you can't do it.
// - No you're not special.
//
// Problem is that there is no way to get a mutable reference to the underlying `CrateData`
// and creating a new crate graph each time a small change in the `CrateData` happens is
// not a viable option in browsers because of how long it takes to initialize after such
// changes.
//
// For example, playground currently allows one local crate at a time, and all local crates
// have the same settings/dependencies. Instead of adding a new local crate for each
// workspace change, and thus creating a new crate graph each time, we change the display
// name of the current crate. This has been tested to work without any noticable problems
// and because nothing else depends on this code, this is going to be the solution until
// if/when we decide to support multiple local crates(workspace) in playground.
unsafe { &mut *ptr }
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer
|
solana_public_repos/solana-playground/solana-playground/wasm/rust-analyzer/src/utils.rs
|
use ide_db::base_db::{CrateGraph, CrateId, FileId, FileSet, SourceRoot, VfsPath};
/// Search the given source roots to find the crate with a matching name.
pub fn get_file_id<'a, 'b>(name: &'a str, source_roots: &'b Vec<SourceRoot>) -> Option<&'b FileId> {
source_roots
.iter()
.find_map(|root| root.file_for_path(&get_crate_path(name)))
}
/// Get the file id from [get_file_id] and find the crate id from the given crate graph.
pub fn get_crate_id(
name: &str,
source_roots: &Vec<SourceRoot>,
crate_graph: &CrateGraph,
) -> Option<CrateId> {
get_file_id(name, source_roots)
.and_then(|file_id| crate_graph.crate_id_for_crate_root(*file_id))
}
/// Create a source root for a library with one file.
pub fn create_source_root(name: &str, file_id: FileId) -> SourceRoot {
let mut file_set = FileSet::default();
file_set.insert(file_id, get_crate_path(name));
SourceRoot::new_library(file_set)
}
/// Get the file position.
pub fn get_file_position(
line_number: u32,
column: u32,
line_index: &ide::LineIndex,
file_id: ide::FileId,
) -> ide::FilePosition {
ide::FilePosition {
file_id,
offset: line_index
.offset(ide::LineCol {
line: line_number - 1,
col: column - 1,
})
.unwrap(),
}
}
/// Get the crate root path for the given crate name.
fn get_crate_path(name: &str) -> VfsPath {
VfsPath::new_virtual_path(format!("/{name}/src/lib.rs"))
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/Cargo.toml
|
[package]
name = "solana-cli-wasm"
version = "1.11.0"
description = "Solana CLI for Solana Playground with WASM."
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "GPL-3.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["solana", "cli", "wasm", "playground"]
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
bs58 = "0.4.0"
clap = "3.1.18"
console = "0.15.0"
console_error_panic_hook = "0.1.7"
const_format = "0.2.23"
num-traits = "0.2"
semver = "1.0.9"
serde = "*"
serde_derive = "*"
serde_json = "*"
solana-clap-v3-utils-wasm = { path = "../utils/solana-clap-v3-utils" }
solana-cli-config-wasm = { path = "../utils/solana-cli-config" }
solana-cli-output-wasm = { path = "../utils/solana-cli-output" }
solana-client-wasm = { path = "../solana-client" }
solana-extra-wasm = { path = "../utils/solana-extra" }
solana-playground-utils-wasm = { path = "../utils/solana-playground-utils" }
solana-remote-wallet = { version = "~1.18", default-features = false }
solana-sdk = "*"
solana-version = "~1.18"
thiserror = "1.0.31"
wasm-bindgen = "*"
wasm-bindgen-futures = "*"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/lib.rs
|
#![allow(clippy::arithmetic_side_effects)]
#![allow(dead_code)]
macro_rules! ACCOUNT_STRING {
() => {
r#", one of:
* a base58-encoded public key"#
};
}
macro_rules! pubkey {
($arg:expr, $help:expr) => {
$arg.takes_value(true)
.validator(solana_clap_v3_utils_wasm::input_validators::is_valid_pubkey)
.help(concat!($help, ACCOUNT_STRING!()))
};
}
#[macro_use]
extern crate const_format;
mod clap;
mod cli;
mod commands;
mod utils;
mod wasm;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/clap.rs
|
use clap::{Arg, Command};
use solana_clap_v3_utils_wasm::{
input_validators::{is_url, is_url_or_moniker},
keypair::SKIP_SEED_PHRASE_VALIDATION_ARG,
};
use crate::{
cli::{DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS, DEFAULT_RPC_TIMEOUT_SECONDS},
commands::{
cluster_query::ClusterQuerySubCommands, config::ConfigSubCommands,
feature::FeatureSubCommands, inflation::InflationSubCommands, nonce::NonceSubCommands,
program::ProgramSubCommands, stake::StakeSubCommands, vote::VoteSubCommands,
wallet::WalletSubCommands,
},
};
pub fn get_clap<'a>(name: &str, about: &'a str, version: &'a str) -> Command<'a> {
Command::new(name)
.about(about)
.version(version)
.subcommand_required(true)
.arg_required_else_help(true)
// // Args
// .arg({
// let arg = Arg::new("config_file")
// .short('C')
// .long("config")
// .value_name("FILEPATH")
// .takes_value(true)
// .global(true)
// .help("Configuration file to use");
// // if let Some(ref config_file) = *CONFIG_FILE {
// // arg.default_value(config_file)
// // } else {
// // arg
// // }
// arg
// })
.arg(
Arg::new("json_rpc_url")
.short('u')
.long("url")
.value_name("URL_OR_MONIKER")
.takes_value(true)
.global(true)
.validator(is_url_or_moniker)
.help(
"URL for Solana's JSON RPC or moniker (or their first letter): \
[mainnet-beta, testnet, devnet, localhost]",
),
)
.arg(
Arg::new("websocket_url")
.long("ws")
.value_name("URL")
.takes_value(true)
.global(true)
.validator(is_url)
.help("WebSocket URL for the solana cluster"),
)
// .arg(
// Arg::new("keypair")
// .short('k')
// .long("keypair")
// .value_name("KEYPAIR")
// .global(true)
// .takes_value(true)
// .help("Filepath or URL to a keypair"),
// )
.arg(
Arg::new("commitment")
.long("commitment")
.takes_value(true)
.possible_values([
"processed",
"confirmed",
"finalized",
])
.value_name("COMMITMENT_LEVEL")
.hide_possible_values(true)
.global(true)
.help("Return information at the selected commitment level [possible values: processed, confirmed, finalized]"),
)
.arg(
Arg::new("verbose")
.long("verbose")
.short('v')
.global(true)
.help("Show additional information"),
)
.arg(
Arg::new("no_address_labels")
.long("no-address-labels")
.global(true)
.help("Do not use address labels in the output"),
)
.arg(
Arg::new("output_format")
.long("output")
.value_name("FORMAT")
.global(true)
.takes_value(true)
.possible_values(["json", "json-compact"])
.help("Return information in specified output format"),
)
.arg(
Arg::new(SKIP_SEED_PHRASE_VALIDATION_ARG.name)
.long(SKIP_SEED_PHRASE_VALIDATION_ARG.long)
.global(true)
.help(SKIP_SEED_PHRASE_VALIDATION_ARG.help),
)
.arg(
Arg::new("rpc_timeout")
.long("rpc-timeout")
.value_name("SECONDS")
.takes_value(true)
.default_value(DEFAULT_RPC_TIMEOUT_SECONDS)
.global(true)
.hide(true)
.help("Timeout value for RPC requests"),
)
.arg(
Arg::new("confirm_transaction_initial_timeout")
.long("confirm-timeout")
.value_name("SECONDS")
.takes_value(true)
.default_value(DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS)
.global(true)
.hide(true)
.help("Timeout value for initial transaction status"),
)
// Subcommands
.cluster_query_subcommands()
.config_subcommands()
.feature_subcommands()
.inflation_subcommands()
.nonce_subcommands()
.program_subcommands()
.stake_subcommands()
// TODO:
// .validator_info_subcommands()
.vote_subcommands()
.wallet_subcommands()
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/wasm.rs
|
use std::{collections::HashMap, panic, rc::Rc, time::Duration};
use clap::ArgMatches;
use solana_clap_v3_utils_wasm::{
input_validators::normalize_to_url_if_moniker, keypair::CliSigners,
};
use solana_cli_config_wasm::{Config, ConfigInput};
use solana_cli_output_wasm::cli_output::{get_name_value_or, OutputFormat};
use solana_client_wasm::utils::rpc_config::RpcSendTransactionConfig;
use solana_extra_wasm::transaction_status::UiTransactionEncoding;
use solana_playground_utils_wasm::js::{PgSettings, PgTerminal, PgWallet};
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::signature::Keypair;
use wasm_bindgen::prelude::*;
use crate::{
clap::get_clap,
cli::{parse_command, process_command, CliCommandInfo, CliConfig},
};
#[wasm_bindgen(js_name = "runSolana")]
pub async fn run_solana(cmd: String) {
panic::set_hook(Box::new(console_error_panic_hook::hook));
let args = cmd.split_ascii_whitespace().collect::<Vec<&str>>();
let match_result = get_clap("solana-cli-wasm", "Blockchain, Rebuilt for Scale", "1.11.0")
.try_get_matches_from(args);
match match_result {
Ok(matches) => {
let connection_settings = PgSettings::connection();
let endpoint = connection_settings.endpoint();
let commitment = connection_settings.commitment();
let keypair_bytes = PgWallet::keypair_bytes();
if !parse_settings(&matches, &endpoint, &commitment) {
// Config command
return;
}
let mut wallet_manager = None;
let parse_result = parse_args(
&matches,
&mut wallet_manager,
&endpoint,
&commitment,
&keypair_bytes,
);
let output = match parse_result {
Ok((mut config, signers)) => {
config.signers = signers.iter().map(|s| s.as_ref()).collect();
process_command(&config)
.await
.unwrap_or_else(|e| format!("Process error: {}", e))
}
Err(e) => format!("Parse error: {e}"),
};
// Log output
PgTerminal::log_wasm(&output);
}
Err(e) => {
// Help or error
PgTerminal::log_wasm(&e.to_string());
}
};
}
fn parse_settings(matches: &ArgMatches, endpoint: &str, commitment: &str) -> bool {
match matches.subcommand() {
Some(("config", matches)) => {
let mut config = Config::new(endpoint, commitment);
match matches.subcommand() {
Some(("get", subcommand_matches)) => {
let (url_setting_type, json_rpc_url) =
ConfigInput::compute_json_rpc_url_setting("", &config.json_rpc_url);
let (ws_setting_type, websocket_url) =
ConfigInput::compute_websocket_url_setting(
"",
&config.websocket_url,
"",
&config.json_rpc_url,
);
// let (keypair_setting_type, keypair_path) =
// ConfigInput::compute_keypair_path_setting("", &config.keypair_path);
let (commitment_setting_type, commitment) =
ConfigInput::compute_commitment_config("", &config.commitment);
if let Some(field) = subcommand_matches.value_of("specific_setting") {
let (field_name, value, setting_type) = match field {
"json_rpc_url" => ("RPC URL", json_rpc_url, url_setting_type),
"websocket_url" => ("WebSocket URL", websocket_url, ws_setting_type),
// "keypair" => ("Key Path", keypair_path, keypair_setting_type),
"commitment" => (
"Commitment",
commitment.commitment.to_string(),
commitment_setting_type,
),
_ => unreachable!(),
};
PgTerminal::log_wasm(
&get_name_value_or(&format!("{}:", field_name), &value, setting_type)
.to_string(),
);
} else {
// Appending log messages because of terminal issue with unnecessary
// prompt messages in browser
let mut msg = String::new();
// PgTerminal::log_wasm("{}", get_name_value("Config File:", config_file));
let rpc_msg = format!(
"{}\n",
get_name_value_or("RPC URL:", &json_rpc_url, url_setting_type),
);
let ws_msg = format!(
"{}\n",
get_name_value_or("WebSocket URL:", &websocket_url, ws_setting_type),
);
// PgTerminal::log_wasm(
// "{}",
// get_name_value_or("Keypair Path:", &keypair_path, keypair_setting_type)
// );
let commitment_msg = get_name_value_or(
"Commitment:",
&commitment.commitment.to_string(),
commitment_setting_type,
)
.to_string();
msg.push_str(&rpc_msg);
msg.push_str(&ws_msg);
msg.push_str(&commitment_msg);
PgTerminal::log_wasm(&msg);
}
}
Some(("set", subcommand_matches)) => {
if let Some(url) = subcommand_matches.value_of("json_rpc_url") {
config.json_rpc_url = normalize_to_url_if_moniker(url);
// Revert to a computed `websocket_url` value when `json_rpc_url` is
// changed
config.websocket_url = "".to_string();
// Update the setting
PgSettings::connection().set_endpoint(&config.json_rpc_url);
}
if let Some(url) = subcommand_matches.value_of("websocket_url") {
config.websocket_url = url.to_string();
}
if let Some(keypair) = subcommand_matches.value_of("keypair") {
config.keypair_path = keypair.to_string();
}
if let Some(commitment) = subcommand_matches.value_of("commitment") {
config.commitment = commitment.to_string();
// Update the setting
PgSettings::connection().set_commitment(&config.commitment);
}
let (url_setting_type, json_rpc_url) =
ConfigInput::compute_json_rpc_url_setting("", &config.json_rpc_url);
let (ws_setting_type, websocket_url) =
ConfigInput::compute_websocket_url_setting(
"",
&config.websocket_url,
"",
&config.json_rpc_url,
);
// let (keypair_setting_type, keypair_path) =
// ConfigInput::compute_keypair_path_setting("", &config.keypair_path);
let (commitment_setting_type, commitment) =
ConfigInput::compute_commitment_config("", &config.commitment);
let mut msg = String::new();
// PgTerminal::log_wasm(get_name_value("Config File:", config_file));
let rpc_msg = format!(
"{}\n",
get_name_value_or("RPC URL:", &json_rpc_url, url_setting_type),
);
let ws_msg = format!(
"{}\n",
get_name_value_or("WebSocket URL:", &websocket_url, ws_setting_type),
);
// PgTerminal::log_wasm(
// "{}",
// get_name_value_or("Keypair Path:", &keypair_path, keypair_setting_type)
// );
let commitment_msg = get_name_value_or(
"Commitment:",
&commitment.commitment.to_string(),
commitment_setting_type,
)
.to_string();
msg.push_str(&rpc_msg);
msg.push_str(&ws_msg);
msg.push_str(&commitment_msg);
PgTerminal::log_wasm(&msg);
}
// Some(("import-address-labels", subcommand_matches)) => {
// let filename = value_t_or_exit!(subcommand_matches, "filename", PathBuf);
// config.import_address_labels(&filename)?;
// config.save(config_file)?;
// PgTerminal::log_wasm("Address labels imported from {:?}", filename);
// }
// Some(("export-address-labels", subcommand_matches)) => {
// let filename = value_t_or_exit!(subcommand_matches, "filename", PathBuf);
// config.export_address_labels(&filename)?;
// PgTerminal::log_wasm("Address labels exported to {:?}", filename);
// }
_ => unreachable!(),
}
false
}
Some(_) => true,
None => true,
}
}
fn parse_args<'a>(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
endpoint: &str,
commitment: &str,
keypair_bytes: &[u8],
) -> Result<(CliConfig<'a>, CliSigners), Box<dyn std::error::Error>> {
let config = Config::new(endpoint, commitment);
let (_, json_rpc_url) = ConfigInput::compute_json_rpc_url_setting(
matches.value_of("json_rpc_url").unwrap_or(""),
&config.json_rpc_url,
);
let rpc_timeout = matches.value_of_t_or_exit("rpc_timeout");
let rpc_timeout = Duration::from_secs(rpc_timeout);
let confirm_transaction_initial_timeout =
matches.value_of_t_or_exit("confirm_transaction_initial_timeout");
let confirm_transaction_initial_timeout =
Duration::from_secs(confirm_transaction_initial_timeout);
let (_, websocket_url) = ConfigInput::compute_websocket_url_setting(
matches.value_of("websocket_url").unwrap_or(""),
&config.websocket_url,
matches.value_of("json_rpc_url").unwrap_or(""),
&config.json_rpc_url,
);
let default_signer_arg_name = "keypair".to_string();
let (_, default_signer_path) = ConfigInput::compute_keypair_path_setting(
matches.value_of(&default_signer_arg_name).unwrap_or(""),
&config.keypair_path,
);
// TODO:
// let default_signer = DefaultSigner::new(default_signer_arg_name, &default_signer_path);
let default_signer = Box::new(Keypair::from_bytes(keypair_bytes).unwrap());
let CliCommandInfo { command, signers } =
parse_command(matches, default_signer, wallet_manager)?;
let verbose = matches.is_present("verbose");
let output_format = OutputFormat::from_matches(matches, "output_format", verbose);
let (_, commitment_config) = ConfigInput::compute_commitment_config(
matches.value_of("commitment").unwrap_or(""),
&config.commitment,
);
let address_labels = if matches.is_present("no_address_labels") {
HashMap::new()
} else {
config.address_labels
};
Ok((
CliConfig {
command,
json_rpc_url,
websocket_url,
signers: vec![],
keypair_path: default_signer_path,
// rpc_client: None,
rpc_timeout,
verbose,
output_format,
commitment_config,
send_transaction_config: RpcSendTransactionConfig {
preflight_commitment: Some(commitment_config.commitment),
encoding: Some(UiTransactionEncoding::Base64),
..RpcSendTransactionConfig::default()
},
confirm_transaction_initial_timeout,
address_labels,
},
signers,
))
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/cli.rs
|
use std::{collections::HashMap, error, rc::Rc, time::Duration};
use clap::ArgMatches;
use num_traits::FromPrimitive;
use solana_clap_v3_utils_wasm::{
input_parsers::value_of,
keypair::{CliSigners, SignerIndex},
};
use solana_cli_output_wasm::cli_output::{
get_name_value, CliSignature, CliValidatorsSortOrder, OutputFormat,
};
use solana_client_wasm::{
utils::{
nonce_utils,
rpc_config::{BlockhashQuery, RpcLargestAccountsFilter, RpcSendTransactionConfig},
},
ClientError, WasmClient,
};
use solana_extra_wasm::program::vote::vote_state::VoteAuthorize;
use solana_playground_utils_wasm::js::PgTerminal;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
clock::Epoch,
commitment_config::{CommitmentConfig, CommitmentLevel},
decode_error::DecodeError,
instruction::InstructionError,
pubkey::Pubkey,
signature::Signature,
signer::{Signer, SignerError},
slot_history::Slot,
transaction::VersionedTransaction,
};
use thiserror::Error;
use crate::{
commands::{
cluster_query::*, feature::*, inflation::*, nonce::*, program::*, stake::*, vote::*,
wallet::*,
},
utils::spend_utils::SpendAmount,
};
pub const DEFAULT_RPC_TIMEOUT_SECONDS: &str = "30";
pub const DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS: &str = "5";
const CHECKED: bool = true;
#[derive(Debug, PartialEq)]
#[allow(clippy::large_enum_variant)]
pub enum CliCommand {
// // Cluster Query Commands
// Catchup {
// node_pubkey: Option<Pubkey>,
// node_json_rpc_url: Option<String>,
// follow: bool,
// our_localhost_port: Option<u16>,
// log: bool,
// },
ClusterDate,
ClusterVersion,
Feature(FeatureCliCommand),
Inflation(InflationCliCommand),
// Fees {
// blockhash: Option<Hash>,
// },
FirstAvailableBlock,
GetBlock {
slot: Option<Slot>,
},
GetBlockTime {
slot: Option<Slot>,
},
GetEpoch,
GetEpochInfo,
GetGenesisHash,
GetSlot,
GetBlockHeight,
GetTransactionCount,
LargestAccounts {
filter: Option<RpcLargestAccountsFilter>,
},
// LeaderSchedule {
// epoch: Option<Epoch>,
// },
// LiveSlots,
// Logs {
// filter: RpcTransactionLogsFilter,
// },
// Ping {
// interval: Duration,
// count: Option<u64>,
// timeout: Duration,
// blockhash: Option<Hash>,
// print_timestamp: bool,
// compute_unit_price: Option<u64>,
// },
Rent {
data_length: usize,
use_lamports_unit: bool,
},
ShowBlockProduction {
epoch: Option<Epoch>,
slot_limit: Option<u64>,
},
// ShowGossip,
ShowStakes {
use_lamports_unit: bool,
vote_account_pubkeys: Option<Vec<Pubkey>>,
},
ShowValidators {
use_lamports_unit: bool,
sort_order: CliValidatorsSortOrder,
reverse_sort: bool,
number_validators: bool,
keep_unstaked_delinquents: bool,
delinquent_slot_distance: Option<Slot>,
},
Supply {
print_accounts: bool,
},
TotalSupply,
TransactionHistory {
address: Pubkey,
before: Option<Signature>,
until: Option<Signature>,
limit: usize,
show_transactions: bool,
},
// WaitForMaxStake {
// max_stake_percent: f32,
// },
// Nonce commands
AuthorizeNonceAccount {
nonce_account: Pubkey,
nonce_authority: SignerIndex,
memo: Option<String>,
new_authority: Pubkey,
},
CreateNonceAccount {
nonce_account: SignerIndex,
seed: Option<String>,
nonce_authority: Option<Pubkey>,
memo: Option<String>,
amount: SpendAmount,
},
GetNonce(Pubkey),
NewNonce {
nonce_account: Pubkey,
nonce_authority: SignerIndex,
memo: Option<String>,
},
ShowNonceAccount {
nonce_account_pubkey: Pubkey,
use_lamports_unit: bool,
},
WithdrawFromNonceAccount {
nonce_account: Pubkey,
nonce_authority: SignerIndex,
memo: Option<String>,
destination_account_pubkey: Pubkey,
lamports: u64,
},
// // Program Deployment
// Deploy {
// program_location: String,
// address: Option<SignerIndex>,
// use_deprecated_loader: bool,
// allow_excessive_balance: bool,
// skip_fee_check: bool,
// },
Program(ProgramCliCommand),
// // Stake Commands
// CreateStakeAccount {
// stake_account: SignerIndex,
// seed: Option<String>,
// staker: Option<Pubkey>,
// withdrawer: Option<Pubkey>,
// withdrawer_signer: Option<SignerIndex>,
// lockup: Lockup,
// amount: SpendAmount,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// from: SignerIndex,
// },
// DeactivateStake {
// stake_account_pubkey: Pubkey,
// stake_authority: SignerIndex,
// sign_only: bool,
// deactivate_delinquent: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// seed: Option<String>,
// fee_payer: SignerIndex,
// },
// DelegateStake {
// stake_account_pubkey: Pubkey,
// vote_account_pubkey: Pubkey,
// stake_authority: SignerIndex,
// force: bool,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
// SplitStake {
// stake_account_pubkey: Pubkey,
// stake_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// split_stake_account: SignerIndex,
// seed: Option<String>,
// lamports: u64,
// fee_payer: SignerIndex,
// },
// MergeStake {
// stake_account_pubkey: Pubkey,
// source_stake_account_pubkey: Pubkey,
// stake_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
ShowStakeHistory {
use_lamports_unit: bool,
limit_results: usize,
},
ShowStakeAccount {
pubkey: Pubkey,
use_lamports_unit: bool,
with_rewards: Option<usize>,
},
// StakeAuthorize {
// stake_account_pubkey: Pubkey,
// new_authorizations: Vec<StakeAuthorizationIndexed>,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// custodian: Option<SignerIndex>,
// no_wait: bool,
// },
// StakeSetLockup {
// stake_account_pubkey: Pubkey,
// lockup: LockupArgs,
// custodian: SignerIndex,
// new_custodian_signer: Option<SignerIndex>,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
// WithdrawStake {
// stake_account_pubkey: Pubkey,
// destination_account_pubkey: Pubkey,
// amount: SpendAmount,
// withdraw_authority: SignerIndex,
// custodian: Option<SignerIndex>,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// seed: Option<String>,
// fee_payer: SignerIndex,
// },
// // Validator Info Commands
// GetValidatorInfo(Option<Pubkey>),
// SetValidatorInfo {
// validator_info: Value,
// force_keybase: bool,
// info_pubkey: Option<Pubkey>,
// },
// // Vote Commands
// CreateVoteAccount {
// vote_account: SignerIndex,
// seed: Option<String>,
// identity_account: SignerIndex,
// authorized_voter: Option<Pubkey>,
// authorized_withdrawer: Pubkey,
// commission: u8,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
ShowVoteAccount {
pubkey: Pubkey,
use_lamports_unit: bool,
with_rewards: Option<usize>,
},
// WithdrawFromVoteAccount {
// vote_account_pubkey: Pubkey,
// destination_account_pubkey: Pubkey,
// withdraw_authority: SignerIndex,
// withdraw_amount: SpendAmount,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
// CloseVoteAccount {
// vote_account_pubkey: Pubkey,
// destination_account_pubkey: Pubkey,
// withdraw_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
VoteAuthorize {
vote_account_pubkey: Pubkey,
new_authorized_pubkey: Pubkey,
vote_authorize: VoteAuthorize,
sign_only: bool,
dump_transaction_message: bool,
blockhash_query: BlockhashQuery,
nonce_account: Option<Pubkey>,
nonce_authority: SignerIndex,
memo: Option<String>,
fee_payer: SignerIndex,
authorized: SignerIndex,
new_authorized: Option<SignerIndex>,
},
// VoteUpdateValidator {
// vote_account_pubkey: Pubkey,
// new_identity_account: SignerIndex,
// withdraw_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
// VoteUpdateCommission {
// vote_account_pubkey: Pubkey,
// commission: u8,
// withdraw_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<String>,
// fee_payer: SignerIndex,
// },
// Wallet Commands
Address,
Airdrop {
pubkey: Option<Pubkey>,
lamports: u64,
},
Balance {
pubkey: Option<Pubkey>,
use_lamports_unit: bool,
},
CreateAddressWithSeed {
from_pubkey: Option<Pubkey>,
seed: String,
program_id: Pubkey,
},
Confirm(Signature),
DecodeTransaction(VersionedTransaction),
// ResolveSigner(Option<String>),
ShowAccount {
pubkey: Pubkey,
output_file: Option<String>,
use_lamports_unit: bool,
},
Transfer {
amount: SpendAmount,
to: Pubkey,
from: SignerIndex,
sign_only: bool,
dump_transaction_message: bool,
allow_unfunded_recipient: bool,
no_wait: bool,
blockhash_query: BlockhashQuery,
nonce_account: Option<Pubkey>,
nonce_authority: SignerIndex,
memo: Option<String>,
fee_payer: SignerIndex,
derived_address_seed: Option<String>,
derived_address_program_id: Option<Pubkey>,
},
}
#[derive(Debug, PartialEq)]
pub struct CliCommandInfo {
pub command: CliCommand,
pub signers: CliSigners,
}
#[derive(Debug, Error)]
pub enum CliError {
#[error("Bad parameter: {0}")]
BadParameter(String),
#[error(transparent)]
ClientError(#[from] ClientError),
#[error("Command not recognized: {0}")]
CommandNotRecognized(String),
#[error("Account {1} has insufficient funds for fee ({0} SOL)")]
InsufficientFundsForFee(f64, Pubkey),
#[error("Account {1} has insufficient funds for spend ({0} SOL)")]
InsufficientFundsForSpend(f64, Pubkey),
#[error("Account {2} has insufficient funds for spend ({0} SOL) + fee ({1} SOL)")]
InsufficientFundsForSpendAndFee(f64, f64, Pubkey),
#[error(transparent)]
InvalidNonce(nonce_utils::NonceError),
#[error("Dynamic program error: {0}")]
DynamicProgramError(String),
#[error("RPC request error: {0}")]
RpcRequestError(String),
#[error("Keypair file not found: {0}")]
KeypairFileNotFound(String),
}
impl From<Box<dyn error::Error>> for CliError {
fn from(error: Box<dyn error::Error>) -> Self {
CliError::DynamicProgramError(error.to_string())
}
}
impl From<nonce_utils::NonceError> for CliError {
fn from(error: nonce_utils::NonceError) -> Self {
match error {
nonce_utils::NonceError::Client(client_error) => Self::RpcRequestError(client_error),
_ => Self::InvalidNonce(error),
}
}
}
pub struct CliConfig<'a> {
pub command: CliCommand,
pub json_rpc_url: String,
pub websocket_url: String,
pub keypair_path: String,
pub commitment_config: CommitmentConfig,
pub signers: Vec<&'a dyn Signer>,
// pub rpc_client: Option<Arc<WasmClient>>,
pub rpc_timeout: Duration,
pub verbose: bool,
pub output_format: OutputFormat,
pub send_transaction_config: RpcSendTransactionConfig,
pub confirm_transaction_initial_timeout: Duration,
pub address_labels: HashMap<String, String>,
}
impl CliConfig<'_> {
pub fn pubkey(&self) -> Result<Pubkey, SignerError> {
if !self.signers.is_empty() {
self.signers[0].try_pubkey()
} else {
Err(SignerError::Custom(
"Default keypair must be set if pubkey arg not provided".to_string(),
))
}
}
pub fn commitment(&self) -> CommitmentLevel {
self.commitment_config.commitment
}
}
// impl Default for CliConfig<'_> {
// fn default() -> CliConfig<'static> {
// CliConfig {
// command: CliCommand::Balance {
// pubkey: Some(Pubkey::default()),
// use_lamports_unit: false,
// },
// json_rpc_url: ConfigInput::default().json_rpc_url,
// websocket_url: ConfigInput::default().websocket_url,
// keypair_path: ConfigInput::default().keypair_path,
// commitment: ConfigInput::default().commitment,
// signers: Vec::new(),
// rpc_client: None,
// rpc_timeout: Duration::from_secs(u64::from_str(DEFAULT_RPC_TIMEOUT_SECONDS).unwrap()),
// verbose: false,
// output_format: OutputFormat::Display,
// send_transaction_config: RpcSendTransactionConfig::default(),
// confirm_transaction_initial_timeout: Duration::from_secs(
// u64::from_str(DEFAULT_CONFIRM_TX_TIMEOUT_SECONDS).unwrap(),
// ),
// address_labels: HashMap::new(),
// }
// }
// }
pub fn parse_command(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, Box<dyn error::Error>> {
let response = match matches.subcommand() {
// // Autocompletion Command
// ("completion", Some(matches)) => {
// let shell_choice = match matches.value_of("shell") {
// Some("bash") => Shell::Bash,
// Some("fish") => Shell::Fish,
// Some("zsh") => Shell::Zsh,
// Some("powershell") => Shell::PowerShell,
// Some("elvish") => Shell::Elvish,
// // This is safe, since we assign default_value and possible_values
// // are restricted
// _ => unreachable!(),
// };
// get_clap_app(
// crate_name!(),
// crate_description!(),
// solana_version::version!(),
// )
// .gen_completions_to("solana", shell_choice, &mut stdout());
// std::process::exit(0);
// }
// // Cluster Query Commands
Some(("block", matches)) => parse_get_block(matches),
Some(("block-height", matches)) => parse_get_block_height(matches),
Some(("block-production", matches)) => parse_show_block_production(matches),
Some(("block-time", matches)) => parse_get_block_time(matches),
// ("catchup", Some(matches)) => parse_catchup(matches, wallet_manager),
Some(("cluster-date", _matches)) => Ok(CliCommandInfo {
command: CliCommand::ClusterDate,
signers: vec![],
}),
Some(("cluster-version", _matches)) => Ok(CliCommandInfo {
command: CliCommand::ClusterVersion,
signers: vec![],
}),
Some(("epoch", matches)) => parse_get_epoch(matches),
Some(("epoch-info", matches)) => parse_get_epoch_info(matches),
Some(("feature", matches)) => {
parse_feature_subcommand(matches, default_signer, wallet_manager)
}
// ("fees", Some(matches)) => {
// let blockhash = value_of::<Hash>(matches, "blockhash");
// Ok(CliCommandInfo {
// command: CliCommand::Fees { blockhash },
// signers: vec![],
// })
// }
Some(("first-available-block", _matches)) => Ok(CliCommandInfo {
command: CliCommand::FirstAvailableBlock,
signers: vec![],
}),
Some(("genesis-hash", _matches)) => Ok(CliCommandInfo {
command: CliCommand::GetGenesisHash,
signers: vec![],
}),
// ("gossip", Some(_matches)) => Ok(CliCommandInfo {
// command: CliCommand::ShowGossip,
// signers: vec![],
// }),
Some(("inflation", matches)) => {
parse_inflation_subcommand(matches, default_signer, wallet_manager)
}
Some(("largest-accounts", matches)) => parse_largest_accounts(matches),
// ("leader-schedule", Some(matches)) => parse_leader_schedule(matches),
// ("live-slots", Some(_matches)) => Ok(CliCommandInfo {
// command: CliCommand::LiveSlots,
// signers: vec![],
// }),
// ("logs", Some(matches)) => parse_logs(matches, wallet_manager),
// ("ping", Some(matches)) => parse_cluster_ping(matches, default_signer, wallet_manager),
Some(("rent", matches)) => {
let data_length = value_of::<RentLengthValue>(matches, "data_length")
.unwrap()
.length();
let use_lamports_unit = matches.is_present("lamports");
Ok(CliCommandInfo {
command: CliCommand::Rent {
data_length,
use_lamports_unit,
},
signers: vec![],
})
}
Some(("slot", matches)) => parse_get_slot(matches),
Some(("stakes", matches)) => parse_show_stakes(matches, wallet_manager),
Some(("supply", matches)) => parse_supply(matches),
Some(("total-supply", matches)) => parse_total_supply(matches),
Some(("transaction-count", matches)) => parse_get_transaction_count(matches),
Some(("transaction-history", matches)) => {
parse_transaction_history(matches, wallet_manager)
}
Some(("validators", matches)) => parse_show_validators(matches),
// Nonce Commands
Some(("authorize-nonce-account", matches)) => {
parse_authorize_nonce_account(matches, default_signer, wallet_manager)
}
Some(("create-nonce-account", matches)) => {
parse_create_nonce_account(matches, default_signer, wallet_manager)
}
Some(("nonce", matches)) => parse_get_nonce(matches, wallet_manager),
Some(("new-nonce", matches)) => parse_new_nonce(matches, default_signer, wallet_manager),
Some(("nonce-account", matches)) => parse_show_nonce_account(matches, wallet_manager),
Some(("withdraw-from-nonce-account", matches)) => {
parse_withdraw_from_nonce_account(matches, default_signer, wallet_manager)
}
// Program Deployment
// ("deploy", Some(matches)) => {
// let (address_signer, _address) = signer_of(matches, "address_signer", wallet_manager)?;
// let mut signers = vec![default_signer];
// let address = address_signer.map(|signer| {
// signers.push(signer);
// 1
// });
// let skip_fee_check = matches.is_present("skip_fee_check");
// Ok(CliCommandInfo {
// command: CliCommand::Deploy {
// program_location: matches.value_of("program_location").unwrap().to_string(),
// address,
// use_deprecated_loader: matches.is_present("use_deprecated_loader"),
// allow_excessive_balance: matches.is_present("allow_excessive_balance"),
// skip_fee_check,
// },
// signers,
// })
// }
Some(("program", matches)) => {
parse_program_subcommand(matches, default_signer, wallet_manager)
}
// ("wait-for-max-stake", Some(matches)) => {
// let max_stake_percent = value_t_or_exit!(matches, "max_percent", f32);
// Ok(CliCommandInfo {
// command: CliCommand::WaitForMaxStake { max_stake_percent },
// signers: vec![],
// })
// }
// // Stake Commands
// ("create-stake-account", Some(matches)) => {
// parse_create_stake_account(matches, default_signer, wallet_manager, !CHECKED)
// }
// ("create-stake-account-checked", Some(matches)) => {
// parse_create_stake_account(matches, default_signer, wallet_manager, CHECKED)
// }
// ("delegate-stake", Some(matches)) => {
// parse_stake_delegate_stake(matches, default_signer, wallet_manager)
// }
// ("withdraw-stake", Some(matches)) => {
// parse_stake_withdraw_stake(matches, default_signer, wallet_manager)
// }
// ("deactivate-stake", Some(matches)) => {
// parse_stake_deactivate_stake(matches, default_signer, wallet_manager)
// }
// ("split-stake", Some(matches)) => {
// parse_split_stake(matches, default_signer, wallet_manager)
// }
// ("merge-stake", Some(matches)) => {
// parse_merge_stake(matches, default_signer, wallet_manager)
// }
// ("stake-authorize", Some(matches)) => {
// parse_stake_authorize(matches, default_signer, wallet_manager, !CHECKED)
// }
// ("stake-authorize-checked", Some(matches)) => {
// parse_stake_authorize(matches, default_signer, wallet_manager, CHECKED)
// }
// ("stake-set-lockup", Some(matches)) => {
// parse_stake_set_lockup(matches, default_signer, wallet_manager, !CHECKED)
// }
// ("stake-set-lockup-checked", Some(matches)) => {
// parse_stake_set_lockup(matches, default_signer, wallet_manager, CHECKED)
// }
Some(("stake-account", matches)) => parse_show_stake_account(matches, wallet_manager),
Some(("stake-history", matches)) => parse_show_stake_history(matches),
// // Validator Info Commands
// ("validator-info", Some(matches)) => match matches.subcommand() {
// ("publish", Some(matches)) => {
// parse_validator_info_command(matches, default_signer, wallet_manager)
// }
// ("get", Some(matches)) => parse_get_validator_info_command(matches),
// _ => unreachable!(),
// },
// Vote Commands
// ("create-vote-account", Some(matches)) => {
// parse_create_vote_account(matches, default_signer, wallet_manager)
// }
// ("vote-update-validator", Some(matches)) => {
// parse_vote_update_validator(matches, default_signer, wallet_manager)
// }
// ("vote-update-commission", Some(matches)) => {
// parse_vote_update_commission(matches, default_signer, wallet_manager)
// }
// ("vote-authorize-voter", Some(matches)) => parse_vote_authorize(
// matches,
// default_signer,
// wallet_manager,
// VoteAuthorize::Voter,
// !CHECKED,
// ),
// ("vote-authorize-withdrawer", Some(matches)) => parse_vote_authorize(
// matches,
// default_signer,
// wallet_manager,
// VoteAuthorize::Withdrawer,
// !CHECKED,
// ),
// ("vote-authorize-voter-checked", Some(matches)) => parse_vote_authorize(
// matches,
// default_signer,
// wallet_manager,
// VoteAuthorize::Voter,
// CHECKED,
// ),
Some(("vote-authorize-withdrawer-checked", matches)) => parse_vote_authorize(
matches,
default_signer,
wallet_manager,
VoteAuthorize::Withdrawer,
CHECKED,
),
Some(("vote-account", matches)) => parse_vote_get_account_command(matches, wallet_manager),
// ("withdraw-from-vote-account", Some(matches)) => {
// parse_withdraw_from_vote_account(matches, default_signer, wallet_manager)
// }
// ("close-vote-account", Some(matches)) => {
// parse_close_vote_account(matches, default_signer, wallet_manager)
// }
// // Wallet Commands
Some(("account", matches)) => parse_account(matches, wallet_manager),
Some(("address", _matches)) => Ok(CliCommandInfo {
command: CliCommand::Address,
signers: vec![default_signer],
}),
Some(("airdrop", matches)) => parse_airdrop(matches, default_signer, wallet_manager),
Some(("balance", matches)) => parse_balance(matches, default_signer, wallet_manager),
Some(("confirm", matches)) => parse_confirm(matches),
Some(("create-address-with-seed", matches)) => {
parse_create_address_with_seed(matches, default_signer, wallet_manager)
}
Some(("decode-transaction", matches)) => parse_decode_transaction(matches),
// Some(("resolve-signer", matches)) => {
// // TODO:
// let signer_path = resolve_signer(matches, "signer", wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::ResolveSigner(signer_path),
// signers: vec![],
// })
// }
Some(("transfer", matches)) => parse_transfer(matches, default_signer, wallet_manager),
//
// ("", None) => {
// PgTerminal::log_wasm("{}", matches.usage());
// Err(CliError::CommandNotRecognized(
// "no subcommand given".to_string(),
// ))
// }
_ => unreachable!(),
}?;
Ok(response)
}
pub type ProcessResult = Result<String, Box<dyn std::error::Error>>;
pub async fn process_command(config: &CliConfig<'_>) -> ProcessResult {
if config.verbose && config.output_format == OutputFormat::DisplayVerbose {
let mut msg = String::new();
let rpc_msg = format!("{}\n", get_name_value("RPC URL:", &config.json_rpc_url));
let default_signer_msg = format!(
"{}\n",
get_name_value("Default Signer:", &config.keypair_path)
);
// if config.keypair_path.starts_with("usb://") {
// let pubkey = config
// .pubkey()
// .map(|pubkey| format!("{:?}", pubkey))
// .unwrap_or_else(|_| "Unavailable".to_string());
// PgTerminal::log_wasm(&format!("{}", get_name_value("Pubkey:", &pubkey)));
// }
let commitment_msg = get_name_value(
"Commitment:",
&config.commitment_config.commitment.to_string(),
)
.to_string();
msg.push_str(&rpc_msg);
msg.push_str(&default_signer_msg);
msg.push_str(&commitment_msg);
PgTerminal::log_wasm(&msg);
}
let rpc_client =
WasmClient::new_with_commitment(&config.json_rpc_url, config.commitment_config);
match &config.command {
// // Cluster Query Commands
// // Return software version of solana-cli and cluster entrypoint node
// CliCommand::Catchup {
// node_pubkey,
// node_json_rpc_url,
// follow,
// our_localhost_port,
// log,
// } => process_catchup(
// &rpc_client,
// config,
// *node_pubkey,
// node_json_rpc_url.clone(),
// *follow,
// *our_localhost_port,
// *log,
// ),
CliCommand::ClusterDate => process_cluster_date(&rpc_client, config).await,
CliCommand::ClusterVersion => process_cluster_version(&rpc_client, config).await,
// CliCommand::Fees { ref blockhash } => process_fees(&rpc_client, config, blockhash.as_ref()),
CliCommand::Feature(feature_subcommand) => {
process_feature_subcommand(&rpc_client, config, feature_subcommand).await
}
CliCommand::FirstAvailableBlock => process_first_available_block(&rpc_client).await,
CliCommand::GetBlock { slot } => process_get_block(&rpc_client, config, *slot).await,
CliCommand::GetBlockTime { slot } => {
process_get_block_time(&rpc_client, config, *slot).await
}
CliCommand::GetEpoch => process_get_epoch(&rpc_client, config).await,
CliCommand::GetEpochInfo => process_get_epoch_info(&rpc_client, config).await,
CliCommand::GetGenesisHash => process_get_genesis_hash(&rpc_client).await,
CliCommand::GetSlot => process_get_slot(&rpc_client, config).await,
CliCommand::GetBlockHeight => process_get_block_height(&rpc_client, config).await,
CliCommand::LargestAccounts { filter } => {
process_largest_accounts(&rpc_client, config, filter.clone()).await
}
CliCommand::GetTransactionCount => process_get_transaction_count(&rpc_client, config).await,
CliCommand::Inflation(inflation_subcommand) => {
process_inflation_subcommand(&rpc_client, config, inflation_subcommand).await
}
// CliCommand::LeaderSchedule { epoch } => {
// process_leader_schedule(&rpc_client, config, *epoch)
// }
// CliCommand::LiveSlots => process_live_slots(config),
// CliCommand::Logs { filter } => process_logs(config, filter),
// CliCommand::Ping {
// interval,
// count,
// timeout,
// blockhash,
// print_timestamp,
// compute_unit_price,
// } => process_ping(
// &rpc_client,
// config,
// interval,
// count,
// timeout,
// blockhash,
// *print_timestamp,
// compute_unit_price,
// ),
CliCommand::Rent {
data_length,
use_lamports_unit,
} => process_calculate_rent(&rpc_client, config, *data_length, *use_lamports_unit).await,
CliCommand::ShowBlockProduction { epoch, slot_limit } => {
process_show_block_production(&rpc_client, config, *epoch, *slot_limit).await
}
// CliCommand::ShowGossip => process_show_gossip(&rpc_client, config),
CliCommand::ShowStakes {
use_lamports_unit,
vote_account_pubkeys,
} => {
process_show_stakes(
&rpc_client,
config,
*use_lamports_unit,
vote_account_pubkeys.as_deref(),
)
.await
}
// CliCommand::WaitForMaxStake { max_stake_percent } => {
// process_wait_for_max_stake(&rpc_client, config, *max_stake_percent)
// }
CliCommand::ShowValidators {
use_lamports_unit,
sort_order,
reverse_sort,
number_validators,
keep_unstaked_delinquents,
delinquent_slot_distance,
} => {
process_show_validators(
&rpc_client,
config,
*use_lamports_unit,
*sort_order,
*reverse_sort,
*number_validators,
*keep_unstaked_delinquents,
*delinquent_slot_distance,
)
.await
}
CliCommand::Supply { print_accounts } => {
process_supply(&rpc_client, config, *print_accounts).await
}
CliCommand::TotalSupply => process_total_supply(&rpc_client, config).await,
CliCommand::TransactionHistory {
address,
before,
until,
limit,
show_transactions,
} => {
process_transaction_history(
&rpc_client,
config,
address,
*before,
*until,
*limit,
*show_transactions,
)
.await
}
// Nonce Commands
// Assign authority to nonce account
CliCommand::AuthorizeNonceAccount {
nonce_account,
nonce_authority,
memo,
new_authority,
} => {
process_authorize_nonce_account(
&rpc_client,
config,
nonce_account,
*nonce_authority,
memo.as_ref(),
new_authority,
)
.await
}
// Create nonce account
CliCommand::CreateNonceAccount {
nonce_account,
seed,
nonce_authority,
memo,
amount,
} => {
process_create_nonce_account(
&rpc_client,
config,
*nonce_account,
seed.clone(),
*nonce_authority,
memo.as_ref(),
*amount,
)
.await
}
// Get the current nonce
CliCommand::GetNonce(nonce_account_pubkey) => {
process_get_nonce(&rpc_client, config, nonce_account_pubkey).await
}
// Get a new nonce
CliCommand::NewNonce {
nonce_account,
nonce_authority,
memo,
} => {
process_new_nonce(
&rpc_client,
config,
nonce_account,
*nonce_authority,
memo.as_ref(),
)
.await
}
// Show the contents of a nonce account
CliCommand::ShowNonceAccount {
nonce_account_pubkey,
use_lamports_unit,
} => {
process_show_nonce_account(
&rpc_client,
config,
nonce_account_pubkey,
*use_lamports_unit,
)
.await
}
// Withdraw lamports from a nonce account
CliCommand::WithdrawFromNonceAccount {
nonce_account,
nonce_authority,
memo,
destination_account_pubkey,
lamports,
} => {
process_withdraw_from_nonce_account(
&rpc_client,
config,
nonce_account,
*nonce_authority,
memo.as_ref(),
destination_account_pubkey,
*lamports,
)
.await
}
// // Program Deployment
// // Deploy a custom program to the chain
// CliCommand::Deploy {
// program_location,
// address,
// use_deprecated_loader,
// allow_excessive_balance,
// skip_fee_check,
// } => process_deploy(
// rpc_client,
// config,
// program_location,
// *address,
// *use_deprecated_loader,
// *allow_excessive_balance,
// *skip_fee_check,
// ),
CliCommand::Program(program_subcommand) => {
process_program_subcommand(&rpc_client, config, program_subcommand).await
}
// // Stake Commands
// // Create stake account
// CliCommand::CreateStakeAccount {
// stake_account,
// seed,
// staker,
// withdrawer,
// withdrawer_signer,
// lockup,
// amount,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// ref nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// from,
// } => process_create_stake_account(
// &rpc_client,
// config,
// *stake_account,
// seed,
// staker,
// withdrawer,
// *withdrawer_signer,
// lockup,
// *amount,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// nonce_account.as_ref(),
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// *from,
// ),
// CliCommand::DeactivateStake {
// stake_account_pubkey,
// stake_authority,
// sign_only,
// deactivate_delinquent,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// seed,
// fee_payer,
// } => process_deactivate_stake_account(
// &rpc_client,
// config,
// stake_account_pubkey,
// *stake_authority,
// *sign_only,
// *deactivate_delinquent,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// seed.as_ref(),
// *fee_payer,
// ),
// CliCommand::DelegateStake {
// stake_account_pubkey,
// vote_account_pubkey,
// stake_authority,
// force,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_delegate_stake(
// &rpc_client,
// config,
// stake_account_pubkey,
// vote_account_pubkey,
// *stake_authority,
// *force,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
// CliCommand::SplitStake {
// stake_account_pubkey,
// stake_authority,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// split_stake_account,
// seed,
// lamports,
// fee_payer,
// } => process_split_stake(
// &rpc_client,
// config,
// stake_account_pubkey,
// *stake_authority,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *split_stake_account,
// seed,
// *lamports,
// *fee_payer,
// ),
// CliCommand::MergeStake {
// stake_account_pubkey,
// source_stake_account_pubkey,
// stake_authority,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_merge_stake(
// &rpc_client,
// config,
// stake_account_pubkey,
// source_stake_account_pubkey,
// *stake_authority,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
CliCommand::ShowStakeAccount {
pubkey: stake_account_pubkey,
use_lamports_unit,
with_rewards,
} => {
process_show_stake_account(
&rpc_client,
config,
stake_account_pubkey,
*use_lamports_unit,
*with_rewards,
)
.await
}
CliCommand::ShowStakeHistory {
use_lamports_unit,
limit_results,
} => {
process_show_stake_history(&rpc_client, config, *use_lamports_unit, *limit_results)
.await
}
// CliCommand::StakeAuthorize {
// stake_account_pubkey,
// ref new_authorizations,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// custodian,
// no_wait,
// } => process_stake_authorize(
// &rpc_client,
// config,
// stake_account_pubkey,
// new_authorizations,
// *custodian,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// *no_wait,
// ),
// CliCommand::StakeSetLockup {
// stake_account_pubkey,
// lockup,
// custodian,
// new_custodian_signer,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_stake_set_lockup(
// &rpc_client,
// config,
// stake_account_pubkey,
// lockup,
// *new_custodian_signer,
// *custodian,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
// CliCommand::WithdrawStake {
// stake_account_pubkey,
// destination_account_pubkey,
// amount,
// withdraw_authority,
// custodian,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// ref nonce_account,
// nonce_authority,
// memo,
// seed,
// fee_payer,
// } => process_withdraw_stake(
// &rpc_client,
// config,
// stake_account_pubkey,
// destination_account_pubkey,
// *amount,
// *withdraw_authority,
// *custodian,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// nonce_account.as_ref(),
// *nonce_authority,
// memo.as_ref(),
// seed.as_ref(),
// *fee_payer,
// ),
// // Validator Info Commands
// // Return all or single validator info
// CliCommand::GetValidatorInfo(info_pubkey) => {
// process_get_validator_info(&rpc_client, config, *info_pubkey)
// }
// // Publish validator info
// CliCommand::SetValidatorInfo {
// validator_info,
// force_keybase,
// info_pubkey,
// } => process_set_validator_info(
// &rpc_client,
// config,
// validator_info,
// *force_keybase,
// *info_pubkey,
// ),
// // Vote Commands
// // Create vote account
// CliCommand::CreateVoteAccount {
// vote_account,
// seed,
// identity_account,
// authorized_voter,
// authorized_withdrawer,
// commission,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// ref nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_create_vote_account(
// &rpc_client,
// config,
// *vote_account,
// seed,
// *identity_account,
// authorized_voter,
// *authorized_withdrawer,
// *commission,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// nonce_account.as_ref(),
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
CliCommand::ShowVoteAccount {
pubkey: vote_account_pubkey,
use_lamports_unit,
with_rewards,
} => {
process_show_vote_account(
&rpc_client,
config,
vote_account_pubkey,
*use_lamports_unit,
*with_rewards,
)
.await
}
// CliCommand::WithdrawFromVoteAccount {
// vote_account_pubkey,
// withdraw_authority,
// withdraw_amount,
// destination_account_pubkey,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// ref nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_withdraw_from_vote_account(
// &rpc_client,
// config,
// vote_account_pubkey,
// *withdraw_authority,
// *withdraw_amount,
// destination_account_pubkey,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// nonce_account.as_ref(),
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
// CliCommand::CloseVoteAccount {
// vote_account_pubkey,
// withdraw_authority,
// destination_account_pubkey,
// memo,
// fee_payer,
// } => process_close_vote_account(
// &rpc_client,
// config,
// vote_account_pubkey,
// *withdraw_authority,
// destination_account_pubkey,
// memo.as_ref(),
// *fee_payer,
// ),
CliCommand::VoteAuthorize {
vote_account_pubkey,
new_authorized_pubkey,
vote_authorize,
sign_only,
dump_transaction_message,
blockhash_query,
nonce_account,
nonce_authority,
memo,
fee_payer,
authorized,
new_authorized,
} => {
process_vote_authorize(
&rpc_client,
config,
vote_account_pubkey,
new_authorized_pubkey,
*vote_authorize,
*authorized,
*new_authorized,
*sign_only,
*dump_transaction_message,
blockhash_query,
*nonce_account,
*nonce_authority,
memo.as_ref(),
*fee_payer,
)
.await
}
// CliCommand::VoteUpdateValidator {
// vote_account_pubkey,
// new_identity_account,
// withdraw_authority,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_vote_update_validator(
// &rpc_client,
// config,
// vote_account_pubkey,
// *new_identity_account,
// *withdraw_authority,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
// CliCommand::VoteUpdateCommission {
// vote_account_pubkey,
// commission,
// withdraw_authority,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority,
// memo,
// fee_payer,
// } => process_vote_update_commission(
// &rpc_client,
// config,
// vote_account_pubkey,
// *commission,
// *withdraw_authority,
// *sign_only,
// *dump_transaction_message,
// blockhash_query,
// *nonce_account,
// *nonce_authority,
// memo.as_ref(),
// *fee_payer,
// ),
// Wallet Commands
// Request an airdrop from Solana Faucet;
CliCommand::Airdrop { pubkey, lamports } => {
process_airdrop(&rpc_client, config, pubkey, *lamports).await
}
// Get address of this client
CliCommand::Address => Ok(format!("{}", config.pubkey()?)),
// Check client balance
CliCommand::Balance {
pubkey,
use_lamports_unit,
} => process_balance(&rpc_client, config, pubkey, *use_lamports_unit).await,
// Confirm the last client transaction by signature
CliCommand::Confirm(signature) => process_confirm(&rpc_client, config, signature).await,
CliCommand::CreateAddressWithSeed {
from_pubkey,
seed,
program_id,
} => process_create_address_with_seed(config, from_pubkey.as_ref(), seed, program_id),
CliCommand::DecodeTransaction(transaction) => {
process_decode_transaction(config, transaction)
}
// CliCommand::ResolveSigner(path) => {
// if let Some(path) = path {
// Ok(path.to_string())
// } else {
// Ok("Signer is valid".to_string())
// }
// }
CliCommand::ShowAccount {
pubkey,
output_file,
use_lamports_unit,
} => {
process_show_account(&rpc_client, config, pubkey, output_file, *use_lamports_unit).await
}
CliCommand::Transfer {
amount,
to,
from,
sign_only,
dump_transaction_message,
allow_unfunded_recipient,
no_wait,
ref blockhash_query,
ref nonce_account,
nonce_authority,
memo,
fee_payer,
derived_address_seed,
ref derived_address_program_id,
} => {
process_transfer(
&rpc_client,
config,
*amount,
to,
*from,
*sign_only,
*dump_transaction_message,
*allow_unfunded_recipient,
*no_wait,
blockhash_query,
nonce_account.as_ref(),
*nonce_authority,
memo.as_ref(),
*fee_payer,
derived_address_seed.clone(),
derived_address_program_id.as_ref(),
)
.await
}
}
}
pub type SignatureResult = Result<Signature, ClientError>;
fn common_error_adapter<E>(ix_error: &InstructionError) -> Option<E>
where
E: 'static + std::error::Error + DecodeError<E> + FromPrimitive,
{
if let InstructionError::Custom(code) = ix_error {
E::decode_custom_error_to_enum(*code)
} else {
None
}
}
pub fn log_instruction_custom_error<E>(result: SignatureResult, config: &CliConfig) -> ProcessResult
where
E: 'static + std::error::Error + DecodeError<E> + FromPrimitive,
{
log_instruction_custom_error_ex::<E, _>(result, config, common_error_adapter)
}
pub fn log_instruction_custom_error_ex<E, F>(
result: SignatureResult,
config: &CliConfig<'_>,
_error_adapter: F,
) -> ProcessResult
where
E: 'static + std::error::Error + DecodeError<E> + FromPrimitive,
F: Fn(&InstructionError) -> Option<E>,
{
match result {
Err(err) => {
// TODO:
// let maybe_tx_err = err.get_transaction_error();
// if let Some(TransactionError::InstructionError(_, ix_error)) = maybe_tx_err {
// if let Some(specific_error) = error_adapter(&ix_error) {
// return Err(specific_error.into());
// }
// }
Err(err.into())
}
Ok(sig) => {
let signature = CliSignature {
signature: sig.clone().to_string(),
};
Ok(config.output_format.formatted_string(&signature))
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/utils/memo.rs
|
use solana_sdk::{instruction::Instruction, pubkey::Pubkey};
pub trait WithMemo {
fn with_memo<T: AsRef<str>>(self, memo: Option<T>) -> Self;
}
impl WithMemo for Vec<Instruction> {
fn with_memo<T: AsRef<str>>(mut self, memo: Option<T>) -> Self {
if let Some(memo) = &memo {
let memo = memo.as_ref();
let memo_ix = Instruction {
program_id: Pubkey::try_from(
"MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr".as_bytes(),
)
.unwrap(),
accounts: vec![],
data: memo.as_bytes().to_vec(),
};
self.push(memo_ix);
}
self
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/utils/checks.rs
|
use solana_client_wasm::WasmClient;
use solana_client_wasm::{ClientError, ClientResult};
use solana_sdk::{
commitment_config::CommitmentConfig, message::Message, native_token::lamports_to_sol,
pubkey::Pubkey,
};
use crate::cli::CliError;
pub async fn check_account_for_fee(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
message: &Message,
) -> Result<(), CliError> {
check_account_for_multiple_fees(rpc_client, account_pubkey, &[message]).await
}
pub async fn check_account_for_fee_with_commitment(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
message: &Message,
commitment: CommitmentConfig,
) -> Result<(), CliError> {
check_account_for_multiple_fees_with_commitment(
rpc_client,
account_pubkey,
&[message],
commitment,
)
.await
}
pub async fn check_account_for_multiple_fees(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
messages: &[&Message],
) -> Result<(), CliError> {
check_account_for_multiple_fees_with_commitment(
rpc_client,
account_pubkey,
messages,
CommitmentConfig::default(),
)
.await
}
pub async fn check_account_for_multiple_fees_with_commitment(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
messages: &[&Message],
commitment: CommitmentConfig,
) -> Result<(), CliError> {
check_account_for_spend_multiple_fees_with_commitment(
rpc_client,
account_pubkey,
0,
messages,
commitment,
)
.await
}
pub async fn check_account_for_spend_multiple_fees_with_commitment(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
balance: u64,
messages: &[&Message],
commitment: CommitmentConfig,
) -> Result<(), CliError> {
let fee = get_fee_for_messages(rpc_client, messages).await?;
check_account_for_spend_and_fee_with_commitment(
rpc_client,
account_pubkey,
balance,
fee,
commitment,
)
.await
}
pub async fn check_account_for_spend_and_fee_with_commitment(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
balance: u64,
fee: u64,
commitment: CommitmentConfig,
) -> Result<(), CliError> {
if !check_account_for_balance_with_commitment(
rpc_client,
account_pubkey,
balance + fee,
commitment,
)
.await
.map_err(Into::<ClientError>::into)?
{
if balance > 0 {
return Err(CliError::InsufficientFundsForSpendAndFee(
lamports_to_sol(balance),
lamports_to_sol(fee),
*account_pubkey,
));
} else {
return Err(CliError::InsufficientFundsForFee(
lamports_to_sol(fee),
*account_pubkey,
));
}
}
Ok(())
}
pub async fn get_fee_for_messages(
rpc_client: &WasmClient,
messages: &[&Message],
) -> Result<u64, CliError> {
let mut total_fee = 0u64;
for message in messages {
let fee = rpc_client.get_fee_for_message(message).await?;
total_fee += fee;
}
Ok(total_fee)
}
pub async fn check_account_for_balance(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
balance: u64,
) -> ClientResult<bool> {
check_account_for_balance_with_commitment(
rpc_client,
account_pubkey,
balance,
CommitmentConfig::default(),
)
.await
}
pub async fn check_account_for_balance_with_commitment(
rpc_client: &WasmClient,
account_pubkey: &Pubkey,
balance: u64,
commitment_config: CommitmentConfig,
) -> ClientResult<bool> {
let lamports = rpc_client
.get_balance_with_commitment(account_pubkey, commitment_config)
.await?;
if lamports != 0 && lamports >= balance {
return Ok(true);
}
Ok(false)
}
pub fn check_unique_pubkeys(
pubkey0: (&Pubkey, String),
pubkey1: (&Pubkey, String),
) -> Result<(), CliError> {
if pubkey0.0 == pubkey1.0 {
Err(CliError::BadParameter(format!(
"Identical pubkeys found: `{}` and `{}` must be unique",
pubkey0.1, pubkey1.1
)))
} else {
Ok(())
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/utils/spend_utils.rs
|
use clap::ArgMatches;
use solana_clap_v3_utils_wasm::{input_parsers::lamports_of_sol, offline::SIGN_ONLY_ARG};
use solana_client_wasm::WasmClient;
use solana_sdk::{
commitment_config::CommitmentConfig, hash::Hash, message::Message,
native_token::lamports_to_sol, pubkey::Pubkey,
};
use crate::{
cli::CliError,
utils::checks::{check_account_for_balance_with_commitment, get_fee_for_messages},
};
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum SpendAmount {
All,
Some(u64),
RentExempt,
}
impl Default for SpendAmount {
fn default() -> Self {
Self::Some(u64::default())
}
}
impl SpendAmount {
pub fn new(amount: Option<u64>, sign_only: bool) -> Self {
match amount {
Some(lamports) => Self::Some(lamports),
None if !sign_only => Self::All,
_ => panic!("ALL amount not supported for sign-only operations"),
}
}
pub fn new_from_matches(matches: &ArgMatches, name: &str) -> Self {
let amount = lamports_of_sol(matches, name);
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
SpendAmount::new(amount, sign_only)
}
}
struct SpendAndFee {
spend: u64,
fee: u64,
}
pub async fn resolve_spend_tx_and_check_account_balance<F>(
rpc_client: &WasmClient,
sign_only: bool,
amount: SpendAmount,
blockhash: &Hash,
from_pubkey: &Pubkey,
build_message: F,
commitment: CommitmentConfig,
) -> Result<(Message, u64), CliError>
where
F: Fn(u64) -> Message,
{
resolve_spend_tx_and_check_account_balances(
rpc_client,
sign_only,
amount,
blockhash,
from_pubkey,
from_pubkey,
build_message,
commitment,
)
.await
}
#[allow(clippy::too_many_arguments)]
pub async fn resolve_spend_tx_and_check_account_balances<F>(
rpc_client: &WasmClient,
sign_only: bool,
amount: SpendAmount,
blockhash: &Hash,
from_pubkey: &Pubkey,
fee_pubkey: &Pubkey,
build_message: F,
commitment_config: CommitmentConfig,
) -> Result<(Message, u64), CliError>
where
F: Fn(u64) -> Message,
{
if sign_only {
let (message, SpendAndFee { spend, fee: _ }) = resolve_spend_message(
rpc_client,
amount,
None,
0,
from_pubkey,
fee_pubkey,
0,
build_message,
)
.await?;
Ok((message, spend))
} else {
let from_balance = rpc_client
.get_balance_with_commitment(from_pubkey, commitment_config)
.await?;
let from_rent_exempt_minimum = if amount == SpendAmount::RentExempt {
let data = rpc_client.get_account_data(from_pubkey).await?;
rpc_client
.get_minimum_balance_for_rent_exemption(data.len())
.await?
} else {
0
};
let (message, SpendAndFee { spend, fee }) = resolve_spend_message(
rpc_client,
amount,
Some(blockhash),
from_balance,
from_pubkey,
fee_pubkey,
from_rent_exempt_minimum,
build_message,
)
.await?;
if from_pubkey == fee_pubkey {
if from_balance == 0 || from_balance < spend + fee {
return Err(CliError::InsufficientFundsForSpendAndFee(
lamports_to_sol(spend),
lamports_to_sol(fee),
*from_pubkey,
));
}
} else {
if from_balance < spend {
return Err(CliError::InsufficientFundsForSpend(
lamports_to_sol(spend),
*from_pubkey,
));
}
if !check_account_for_balance_with_commitment(
rpc_client,
fee_pubkey,
fee,
commitment_config,
)
.await?
{
return Err(CliError::InsufficientFundsForFee(
lamports_to_sol(fee),
*fee_pubkey,
));
}
}
Ok((message, spend))
}
}
#[allow(clippy::too_many_arguments)]
async fn resolve_spend_message<F>(
rpc_client: &WasmClient,
amount: SpendAmount,
blockhash: Option<&Hash>,
from_balance: u64,
from_pubkey: &Pubkey,
fee_pubkey: &Pubkey,
from_rent_exempt_minimum: u64,
build_message: F,
) -> Result<(Message, SpendAndFee), CliError>
where
F: Fn(u64) -> Message,
{
let fee = match blockhash {
Some(blockhash) => {
let mut dummy_message = build_message(0);
dummy_message.recent_blockhash = *blockhash;
get_fee_for_messages(rpc_client, &[&dummy_message]).await?
}
None => 0, // Offline, cannot calulate fee
};
match amount {
SpendAmount::Some(lamports) => Ok((
build_message(lamports),
SpendAndFee {
spend: lamports,
fee,
},
)),
SpendAmount::All => {
let lamports = if from_pubkey == fee_pubkey {
from_balance.saturating_sub(fee)
} else {
from_balance
};
Ok((
build_message(lamports),
SpendAndFee {
spend: lamports,
fee,
},
))
}
SpendAmount::RentExempt => {
let mut lamports = if from_pubkey == fee_pubkey {
from_balance.saturating_sub(fee)
} else {
from_balance
};
lamports = lamports.saturating_sub(from_rent_exempt_minimum);
Ok((
build_message(lamports),
SpendAndFee {
spend: lamports,
fee,
},
))
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/utils/blockhash_query.rs
|
use clap::ArgMatches;
use solana_clap_v3_utils_wasm::{
input_parsers::{pubkey_of, value_of},
nonce::NONCE_ARG,
offline::{BLOCKHASH_ARG, SIGN_ONLY_ARG},
};
use solana_client_wasm::utils::rpc_config::BlockhashQuery;
pub fn blockhash_query_from_matches(matches: &ArgMatches) -> BlockhashQuery {
let blockhash = value_of(matches, BLOCKHASH_ARG.name);
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
let nonce_account = pubkey_of(matches, NONCE_ARG.name);
BlockhashQuery::new(blockhash, sign_only, nonce_account)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/utils/mod.rs
|
pub mod blockhash_query;
pub mod checks;
pub mod memo;
pub mod spend_utils;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/feature.rs
|
use std::{cmp::Ordering, collections::HashMap, fmt, rc::Rc, str::FromStr};
use clap::{Arg, ArgMatches, Command};
use console::style;
use serde::{Deserialize, Serialize};
use solana_clap_v3_utils_wasm::{input_parsers::*, input_validators::*};
use solana_cli_output_wasm::{
cli_output::{QuietDisplay, VerboseDisplay},
cli_version::CliVersion,
};
use solana_client_wasm::{
utils::rpc_request::MAX_MULTIPLE_ACCOUNTS,
{ClientError, WasmClient},
};
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::signer::Signer;
use solana_sdk::{
account::Account,
clock::Slot,
epoch_schedule::EpochSchedule,
feature::{self},
feature_set::FEATURE_NAMES,
pubkey::Pubkey,
};
use crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult};
const DEFAULT_MAX_ACTIVE_DISPLAY_AGE_SLOTS: Slot = 15_000_000; // ~90days
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ForceActivation {
No,
Almost,
Yes,
}
#[derive(Debug, PartialEq, Eq)]
pub enum FeatureCliCommand {
Status {
features: Vec<Pubkey>,
display_all: bool,
},
// Activate {
// feature: Pubkey,
// force: ForceActivation,
// },
}
#[derive(Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase", tag = "status", content = "sinceSlot")]
pub enum CliFeatureStatus {
Inactive,
Pending,
Active(Slot),
}
impl PartialOrd for CliFeatureStatus {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for CliFeatureStatus {
fn cmp(&self, other: &Self) -> Ordering {
match (self, other) {
(Self::Inactive, Self::Inactive) => Ordering::Equal,
(Self::Inactive, _) => Ordering::Greater,
(_, Self::Inactive) => Ordering::Less,
(Self::Pending, Self::Pending) => Ordering::Equal,
(Self::Pending, _) => Ordering::Greater,
(_, Self::Pending) => Ordering::Less,
(Self::Active(self_active_slot), Self::Active(other_active_slot)) => {
self_active_slot.cmp(other_active_slot)
}
}
}
}
#[derive(Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CliFeature {
pub id: String,
pub description: String,
#[serde(flatten)]
pub status: CliFeatureStatus,
}
impl PartialOrd for CliFeature {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for CliFeature {
fn cmp(&self, other: &Self) -> Ordering {
match self.status.cmp(&other.status) {
Ordering::Equal => self.id.cmp(&other.id),
ordering => ordering,
}
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliFeatures {
pub features: Vec<CliFeature>,
#[serde(skip)]
pub epoch_schedule: EpochSchedule,
#[serde(skip)]
pub current_slot: Slot,
pub feature_activation_allowed: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster_feature_sets: Option<CliClusterFeatureSets>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cluster_software_versions: Option<CliClusterSoftwareVersions>,
#[serde(skip)]
pub inactive: bool,
}
impl fmt::Display for CliFeatures {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if !self.features.is_empty() {
writeln!(
f,
"{}",
style(format!(
"{:<44} | {:<23} | {} | {}",
"Feature", "Status", "Activation Slot", "Description"
))
.bold()
)?;
}
for feature in &self.features {
writeln!(
f,
"{:<44} | {:<23} | {:<15} | {}",
feature.id,
match feature.status {
CliFeatureStatus::Inactive => style("inactive".to_string()).red(),
CliFeatureStatus::Pending => {
let current_epoch = self.epoch_schedule.get_epoch(self.current_slot);
style(format!("pending until epoch {}", current_epoch + 1)).yellow()
}
CliFeatureStatus::Active(activation_slot) => {
let activation_epoch = self.epoch_schedule.get_epoch(activation_slot);
style(format!("active since epoch {}", activation_epoch)).green()
}
},
match feature.status {
CliFeatureStatus::Active(activation_slot) => activation_slot.to_string(),
_ => "NA".to_string(),
},
feature.description,
)?;
}
if let Some(software_versions) = &self.cluster_software_versions {
write!(f, "{}", software_versions)?;
}
if let Some(feature_sets) = &self.cluster_feature_sets {
write!(f, "{}", feature_sets)?;
}
if self.inactive && !self.feature_activation_allowed {
writeln!(
f,
"{}",
style("\nFeature activation is not allowed at this time")
.bold()
.red()
)?;
}
Ok(())
}
}
impl QuietDisplay for CliFeatures {}
impl VerboseDisplay for CliFeatures {}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliClusterFeatureSets {
pub tool_feature_set: u32,
pub feature_sets: Vec<CliFeatureSetStats>,
#[serde(skip)]
pub stake_allowed: bool,
#[serde(skip)]
pub rpc_allowed: bool,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliClusterSoftwareVersions {
tool_software_version: CliVersion,
software_versions: Vec<CliSoftwareVersionStats>,
}
impl fmt::Display for CliClusterSoftwareVersions {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let software_version_title = "Software Version";
let stake_percent_title = "Stake";
let rpc_percent_title = "RPC";
let mut max_software_version_len = software_version_title.len();
let mut max_stake_percent_len = stake_percent_title.len();
let mut max_rpc_percent_len = rpc_percent_title.len();
let software_versions: Vec<_> = self
.software_versions
.iter()
.map(|software_version_stats| {
let stake_percent = format!("{:.2}%", software_version_stats.stake_percent);
let rpc_percent = format!("{:.2}%", software_version_stats.rpc_percent);
let software_version = software_version_stats.software_version.to_string();
max_software_version_len = max_software_version_len.max(software_version.len());
max_stake_percent_len = max_stake_percent_len.max(stake_percent.len());
max_rpc_percent_len = max_rpc_percent_len.max(rpc_percent.len());
(software_version, stake_percent, rpc_percent)
})
.collect();
writeln!(
f,
"\n\n{}",
style(format!(
"Tool Software Version: {}",
self.tool_software_version
))
.bold()
)?;
writeln!(
f,
"{}",
style(format!(
"{1:<0$} {3:>2$} {5:>4$}",
max_software_version_len,
software_version_title,
max_stake_percent_len,
stake_percent_title,
max_rpc_percent_len,
rpc_percent_title,
))
.bold(),
)?;
for (software_version, stake_percent, rpc_percent) in software_versions {
let me = self.tool_software_version.to_string() == software_version;
writeln!(
f,
"{1:<0$} {3:>2$} {5:>4$} {6}",
max_software_version_len,
software_version,
max_stake_percent_len,
stake_percent,
max_rpc_percent_len,
rpc_percent,
if me { "<-- me" } else { "" },
)?;
}
writeln!(f)
}
}
impl fmt::Display for CliClusterFeatureSets {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut tool_feature_set_matches_cluster = false;
let software_versions_title = "Software Version";
let feature_set_title = "Feature Set";
let stake_percent_title = "Stake";
let rpc_percent_title = "RPC";
let mut max_software_versions_len = software_versions_title.len();
let mut max_feature_set_len = feature_set_title.len();
let mut max_stake_percent_len = stake_percent_title.len();
let mut max_rpc_percent_len = rpc_percent_title.len();
let feature_sets: Vec<_> = self
.feature_sets
.iter()
.map(|feature_set_info| {
let me = if self.tool_feature_set == feature_set_info.feature_set {
tool_feature_set_matches_cluster = true;
true
} else {
false
};
let software_versions: Vec<_> = feature_set_info
.software_versions
.iter()
.map(ToString::to_string)
.collect();
let software_versions = software_versions.join(", ");
let feature_set = if feature_set_info.feature_set == 0 {
"unknown".to_string()
} else {
feature_set_info.feature_set.to_string()
};
let stake_percent = format!("{:.2}%", feature_set_info.stake_percent);
let rpc_percent = format!("{:.2}%", feature_set_info.rpc_percent);
max_software_versions_len = max_software_versions_len.max(software_versions.len());
max_feature_set_len = max_feature_set_len.max(feature_set.len());
max_stake_percent_len = max_stake_percent_len.max(stake_percent.len());
max_rpc_percent_len = max_rpc_percent_len.max(rpc_percent.len());
(
software_versions,
feature_set,
stake_percent,
rpc_percent,
me,
)
})
.collect();
if !tool_feature_set_matches_cluster {
writeln!(
f,
"\n{}",
style("To activate features the tool and cluster feature sets must match, select a tool version that matches the cluster")
.bold())?;
} else {
if !self.stake_allowed {
write!(
f,
"\n{}",
style("To activate features the stake must be >= 95%")
.bold()
.red()
)?;
}
if !self.rpc_allowed {
write!(
f,
"\n{}",
style("To activate features the RPC nodes must be >= 95%")
.bold()
.red()
)?;
}
}
writeln!(
f,
"\n\n{}",
style(format!("Tool Feature Set: {}", self.tool_feature_set)).bold()
)?;
writeln!(
f,
"{}",
style(format!(
"{1:<0$} {3:<2$} {5:>4$} {7:>6$}",
max_software_versions_len,
software_versions_title,
max_feature_set_len,
feature_set_title,
max_stake_percent_len,
stake_percent_title,
max_rpc_percent_len,
rpc_percent_title,
))
.bold(),
)?;
for (software_versions, feature_set, stake_percent, rpc_percent, me) in feature_sets {
writeln!(
f,
"{1:<0$} {3:>2$} {5:>4$} {7:>6$} {8}",
max_software_versions_len,
software_versions,
max_feature_set_len,
feature_set,
max_stake_percent_len,
stake_percent,
max_rpc_percent_len,
rpc_percent,
if me { "<-- me" } else { "" },
)?;
}
writeln!(f)
}
}
impl QuietDisplay for CliClusterFeatureSets {}
impl VerboseDisplay for CliClusterFeatureSets {}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliFeatureSetStats {
software_versions: Vec<CliVersion>,
feature_set: u32,
stake_percent: f64,
rpc_percent: f32,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliSoftwareVersionStats {
software_version: CliVersion,
stake_percent: f64,
rpc_percent: f32,
}
pub trait FeatureSubCommands {
fn feature_subcommands(self) -> Self;
}
impl FeatureSubCommands for Command<'_> {
fn feature_subcommands(self) -> Self {
self.subcommand(
Command::new("feature")
.about("Runtime feature management")
.subcommand_required(true)
.arg_required_else_help(true)
.subcommand(
Command::new("status")
.about("Query runtime feature status")
.arg(
Arg::new("features")
.value_name("ADDRESS")
.validator(is_valid_pubkey)
.index(1)
.multiple_occurrences(true)
.help("Feature status to query [default: all known features]"),
)
.arg(
Arg::new("display_all")
.long("display-all")
.help("display all features regardless of age"),
),
), // .subcommand(
// Command::new("activate")
// .about("Activate a runtime feature")
// .arg(
// Arg::new("feature")
// .value_name("FEATURE_KEYPAIR")
// .validator(is_valid_signer)
// .index(1)
// .required(true)
// .help("The signer for the feature to activate"),
// )
// .arg(
// Arg::new("force")
// .long("yolo")
// .hide(true)
// .multiple_occurrences(true)
// .help("Override activation sanity checks. Don't use this flag"),
// ),
// ),
)
}
}
fn known_feature(feature: &Pubkey) -> Result<(), CliError> {
if FEATURE_NAMES.contains_key(feature) {
Ok(())
} else {
Err(CliError::BadParameter(format!(
"Unknown feature: {}",
feature
)))
}
}
pub fn parse_feature_subcommand(
matches: &ArgMatches,
_default_signer: Box<dyn Signer>,
_wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let response = match matches.subcommand() {
// Some(("activate",matches)) => {
// let (feature_signer, feature) = signer_of(matches, "feature", wallet_manager)?;
// let mut signers = vec![default_signer];
// let force = match matches.occurrences_of("force") {
// 2 => ForceActivation::Yes,
// 1 => ForceActivation::Almost,
// _ => ForceActivation::No,
// };
// signers.push(feature_signer.unwrap());
// let feature = feature.unwrap();
// known_feature(&feature)?;
// CliCommandInfo {
// command: CliCommand::Feature(FeatureCliCommand::Activate { feature, force }),
// signers,
// }
// }
Some(("status", matches)) => {
let mut features = if let Some(features) = pubkeys_of(matches, "features") {
for feature in &features {
known_feature(feature)?;
}
features
} else {
FEATURE_NAMES.keys().cloned().collect()
};
let display_all =
matches.is_present("display_all") || features.len() < FEATURE_NAMES.len();
features.sort();
CliCommandInfo {
command: CliCommand::Feature(FeatureCliCommand::Status {
features,
display_all,
}),
signers: vec![],
}
}
_ => unreachable!(),
};
Ok(response)
}
pub async fn process_feature_subcommand(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
feature_subcommand: &FeatureCliCommand,
) -> ProcessResult {
match feature_subcommand {
FeatureCliCommand::Status {
features,
display_all,
} => process_status(rpc_client, config, features, *display_all).await,
// FeatureCliCommand::Activate { feature, force } => {
// process_activate(rpc_client, config, *feature, *force).await
// }
}
}
#[derive(Debug, Default)]
struct FeatureSetStatsEntry {
stake_percent: f64,
rpc_nodes_percent: f32,
software_versions: Vec<CliVersion>,
}
#[derive(Debug, Default, Clone, Copy)]
struct ClusterInfoStatsEntry {
stake_percent: f64,
rpc_percent: f32,
}
struct ClusterInfoStats {
stats_map: HashMap<(u32, CliVersion), ClusterInfoStatsEntry>,
}
impl ClusterInfoStats {
fn aggregate_by_feature_set(&self) -> HashMap<u32, FeatureSetStatsEntry> {
let mut feature_set_map = HashMap::<u32, FeatureSetStatsEntry>::new();
for ((feature_set, software_version), stats_entry) in &self.stats_map {
let map_entry = feature_set_map.entry(*feature_set).or_default();
map_entry.rpc_nodes_percent += stats_entry.rpc_percent;
map_entry.stake_percent += stats_entry.stake_percent;
map_entry.software_versions.push(software_version.clone());
}
for stats_entry in feature_set_map.values_mut() {
stats_entry
.software_versions
.sort_by(|l, r| l.cmp(r).reverse());
}
feature_set_map
}
fn aggregate_by_software_version(&self) -> HashMap<CliVersion, ClusterInfoStatsEntry> {
let mut software_version_map = HashMap::<CliVersion, ClusterInfoStatsEntry>::new();
for ((_feature_set, software_version), stats_entry) in &self.stats_map {
let map_entry = software_version_map
.entry(software_version.clone())
.or_default();
map_entry.rpc_percent += stats_entry.rpc_percent;
map_entry.stake_percent += stats_entry.stake_percent;
}
software_version_map
}
}
async fn cluster_info_stats(rpc_client: &WasmClient) -> Result<ClusterInfoStats, ClientError> {
#[derive(Default)]
struct StatsEntry {
stake_lamports: u64,
rpc_nodes_count: u32,
}
let cluster_info_list = rpc_client
.get_cluster_nodes()
.await?
.into_iter()
.map(|contact_info| {
(
contact_info.pubkey,
contact_info.feature_set,
contact_info.rpc.is_some(),
contact_info
.version
.and_then(|v| CliVersion::from_str(&v).ok())
.unwrap_or_else(CliVersion::unknown_version),
)
})
.collect::<Vec<_>>();
let vote_accounts = rpc_client.get_vote_accounts().await?;
let mut total_active_stake: u64 = vote_accounts
.delinquent
.iter()
.map(|vote_account| vote_account.activated_stake)
.sum();
let vote_stakes = vote_accounts
.current
.into_iter()
.map(|vote_account| {
total_active_stake += vote_account.activated_stake;
(vote_account.node_pubkey, vote_account.activated_stake)
})
.collect::<HashMap<_, _>>();
let mut cluster_info_stats: HashMap<(u32, CliVersion), StatsEntry> = HashMap::new();
let mut total_rpc_nodes = 0;
for (node_id, feature_set, is_rpc, version) in cluster_info_list {
let feature_set = feature_set.unwrap_or(0);
let stats_entry = cluster_info_stats
.entry((feature_set, version))
.or_default();
if let Some(vote_stake) = vote_stakes.get(&node_id) {
stats_entry.stake_lamports += *vote_stake;
}
if is_rpc {
stats_entry.rpc_nodes_count += 1;
total_rpc_nodes += 1;
}
}
Ok(ClusterInfoStats {
stats_map: cluster_info_stats
.into_iter()
.filter_map(
|(
cluster_config,
StatsEntry {
stake_lamports,
rpc_nodes_count,
},
)| {
let stake_percent = (stake_lamports as f64 / total_active_stake as f64) * 100.;
let rpc_percent = (rpc_nodes_count as f32 / total_rpc_nodes as f32) * 100.;
if stake_percent >= 0.001 || rpc_percent >= 0.001 {
Some((
cluster_config,
ClusterInfoStatsEntry {
stake_percent,
rpc_percent,
},
))
} else {
None
}
},
)
.collect(),
})
}
// Feature activation is only allowed when 95% of the active stake is on the current feature set
async fn feature_activation_allowed(
rpc_client: &WasmClient,
quiet: bool,
) -> Result<
(
bool,
Option<CliClusterFeatureSets>,
Option<CliClusterSoftwareVersions>,
),
ClientError,
> {
let cluster_info_stats = cluster_info_stats(rpc_client).await?;
let feature_set_stats = cluster_info_stats.aggregate_by_feature_set();
let tool_version = solana_version::Version::default();
let tool_feature_set = tool_version.feature_set;
let tool_software_version = CliVersion::from(semver::Version::new(
tool_version.major as u64,
tool_version.minor as u64,
tool_version.patch as u64,
));
let (stake_allowed, rpc_allowed) = feature_set_stats
.get(&tool_feature_set)
.map(
|FeatureSetStatsEntry {
stake_percent,
rpc_nodes_percent,
..
}| (*stake_percent >= 95., *rpc_nodes_percent >= 95.),
)
.unwrap_or_default();
let cluster_software_versions = if quiet {
None
} else {
let mut software_versions: Vec<_> = cluster_info_stats
.aggregate_by_software_version()
.into_iter()
.map(|(software_version, stats)| CliSoftwareVersionStats {
software_version,
stake_percent: stats.stake_percent,
rpc_percent: stats.rpc_percent,
})
.collect();
software_versions.sort_by(|l, r| l.software_version.cmp(&r.software_version).reverse());
Some(CliClusterSoftwareVersions {
software_versions,
tool_software_version,
})
};
let cluster_feature_sets = if quiet {
None
} else {
let mut feature_sets: Vec<_> = feature_set_stats
.into_iter()
.map(|(feature_set, stats_entry)| CliFeatureSetStats {
feature_set,
software_versions: stats_entry.software_versions,
rpc_percent: stats_entry.rpc_nodes_percent,
stake_percent: stats_entry.stake_percent,
})
.collect();
feature_sets.sort_by(|l, r| {
match l.software_versions[0]
.cmp(&r.software_versions[0])
.reverse()
{
Ordering::Equal => {
match l
.stake_percent
.partial_cmp(&r.stake_percent)
.unwrap()
.reverse()
{
Ordering::Equal => {
l.rpc_percent.partial_cmp(&r.rpc_percent).unwrap().reverse()
}
o => o,
}
}
o => o,
}
});
Some(CliClusterFeatureSets {
tool_feature_set,
feature_sets,
stake_allowed,
rpc_allowed,
})
};
Ok((
stake_allowed && rpc_allowed,
cluster_feature_sets,
cluster_software_versions,
))
}
fn status_from_account(account: Account) -> Option<CliFeatureStatus> {
feature::from_account(&account).map(|feature| match feature.activated_at {
None => CliFeatureStatus::Pending,
Some(activation_slot) => CliFeatureStatus::Active(activation_slot),
})
}
async fn get_feature_status(
rpc_client: &WasmClient,
feature_id: &Pubkey,
) -> Result<Option<CliFeatureStatus>, Box<dyn std::error::Error>> {
rpc_client
.get_account(feature_id)
.await
.map(status_from_account)
.map_err(|e| e.into())
}
pub async fn get_feature_is_active(
rpc_client: &WasmClient,
feature_id: &Pubkey,
) -> Result<bool, Box<dyn std::error::Error>> {
get_feature_status(rpc_client, feature_id)
.await
.map(|status| matches!(status, Some(CliFeatureStatus::Active(_))))
}
async fn process_status(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
feature_ids: &[Pubkey],
display_all: bool,
) -> ProcessResult {
let current_slot = rpc_client.get_slot().await?;
let filter = if !display_all {
current_slot.checked_sub(DEFAULT_MAX_ACTIVE_DISPLAY_AGE_SLOTS)
} else {
None
};
let mut inactive = false;
let mut features = vec![];
for feature_ids in feature_ids.chunks(MAX_MULTIPLE_ACCOUNTS) {
let mut feature_chunk = rpc_client
.get_multiple_accounts(feature_ids)
.await
.unwrap_or_default()
.into_iter()
.zip(feature_ids)
.map(|(account, feature_id)| {
let feature_name = FEATURE_NAMES.get(feature_id).unwrap();
account
.and_then(status_from_account)
.map(|feature_status| CliFeature {
id: feature_id.to_string(),
description: feature_name.to_string(),
status: feature_status,
})
.unwrap_or_else(|| {
inactive = true;
CliFeature {
id: feature_id.to_string(),
description: feature_name.to_string(),
status: CliFeatureStatus::Inactive,
}
})
})
.filter(|feature| match (filter, &feature.status) {
(Some(min_activation), CliFeatureStatus::Active(activation)) => {
activation > &min_activation
}
_ => true,
})
.collect::<Vec<_>>();
features.append(&mut feature_chunk);
}
features.sort_unstable();
let (feature_activation_allowed, cluster_feature_sets, cluster_software_versions) =
feature_activation_allowed(rpc_client, features.len() <= 1).await?;
let epoch_schedule = rpc_client.get_epoch_schedule().await?;
let feature_set = CliFeatures {
features,
current_slot,
epoch_schedule,
feature_activation_allowed,
cluster_feature_sets,
cluster_software_versions,
inactive,
};
Ok(config.output_format.formatted_string(&feature_set))
}
// async fn process_activate(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// feature_id: Pubkey,
// force: ForceActivation,
// ) -> ProcessResult {
// let account = rpc_client
// .get_multiple_accounts(&[feature_id])
// .await?
// .into_iter()
// .next()
// .unwrap();
// if let Some(account) = account {
// if feature::from_account(&account).is_some() {
// return Err(format!("{} has already been activated", feature_id).into());
// }
// }
// if !feature_activation_allowed(rpc_client, false).await?.0 {
// match force {
// ForceActivation::Almost =>
// return Err("Add force argument once more to override the sanity check to force feature activation ".into()),
// ForceActivation::Yes => PgTerminal::log_wasm("FEATURE ACTIVATION FORCED"),
// ForceActivation::No =>
// return Err("Feature activation is not allowed at this time".into()),
// }
// }
// let rent = rpc_client
// .get_minimum_balance_for_rent_exemption(Feature::size_of())
// .await?;
// let blockhash = rpc_client.get_latest_blockhash().await?;
// let (message, _) = resolve_spend_tx_and_check_account_balance(
// rpc_client,
// false,
// SpendAmount::Some(rent),
// &blockhash,
// &config.signers[0].pubkey(),
// |lamports| {
// Message::new(
// &feature::activate_with_lamports(
// &feature_id,
// &config.signers[0].pubkey(),
// lamports,
// ),
// Some(&config.signers[0].pubkey()),
// )
// },
// config.commitment_config,
// )
// .await?;
// let mut transaction = Transaction::new_unsigned(message);
// transaction.try_sign(&config.signers, blockhash)?;
// PgTerminal::log_wasm(
// "Activating {} ({})",
// FEATURE_NAMES.get(&feature_id).unwrap(),
// feature_id
// );
// // TODO:
// // rpc_client.send_and_confirm_transaction_with_spinner(&transaction)?;
// rpc_client
// .send_and_confirm_transaction(&transaction)
// .await?;
// Ok("".to_string())
// }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/inflation.rs
|
use std::rc::Rc;
use clap::{Arg, ArgMatches, Command};
use solana_clap_v3_utils_wasm::input_parsers::{pubkeys_of, value_of};
use solana_cli_output_wasm::cli_output::{
CliEpochRewardshMetadata, CliInflation, CliKeyedEpochReward, CliKeyedEpochRewards,
};
use solana_client_wasm::WasmClient;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{clock::Epoch, pubkey::Pubkey, signer::Signer};
use super::stake::{get_epoch_boundary_timestamps, make_cli_reward};
use crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult};
#[derive(Debug, PartialEq, Eq)]
pub enum InflationCliCommand {
Show,
Rewards(Vec<Pubkey>, Option<Epoch>),
}
pub trait InflationSubCommands {
fn inflation_subcommands(self) -> Self;
}
impl InflationSubCommands for Command<'_> {
fn inflation_subcommands(self) -> Self {
self.subcommand(
Command::new("inflation")
.about("Show inflation information")
.subcommand(
Command::new("rewards")
.about("Show inflation rewards for a set of addresses")
.arg(pubkey!(
Arg::new("addresses")
.value_name("ADDRESS")
.index(1)
.multiple_occurrences(true)
.required(true),
"Address of account to query for rewards. "
))
.arg(
Arg::new("rewards_epoch")
.long("rewards-epoch")
.takes_value(true)
.value_name("EPOCH")
.help("Display rewards for specific epoch [default: latest epoch]"),
),
),
)
}
}
pub fn parse_inflation_subcommand(
matches: &ArgMatches,
_default_signer: Box<dyn Signer>,
_wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let command = match matches.subcommand() {
Some(("rewards", matches)) => {
let addresses = pubkeys_of(matches, "addresses").unwrap();
let rewards_epoch = value_of(matches, "rewards_epoch");
InflationCliCommand::Rewards(addresses, rewards_epoch)
}
_ => InflationCliCommand::Show,
};
Ok(CliCommandInfo {
command: CliCommand::Inflation(command),
signers: vec![],
})
}
pub async fn process_inflation_subcommand(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
inflation_subcommand: &InflationCliCommand,
) -> ProcessResult {
match inflation_subcommand {
InflationCliCommand::Show => process_show(rpc_client, config).await,
InflationCliCommand::Rewards(ref addresses, rewards_epoch) => {
process_rewards(rpc_client, config, addresses, *rewards_epoch).await
}
}
}
async fn process_show(rpc_client: &WasmClient, config: &CliConfig<'_>) -> ProcessResult {
let governor = rpc_client.get_inflation_governor().await?;
let current_rate = rpc_client.get_inflation_rate().await?;
let inflation = CliInflation {
governor,
current_rate,
};
Ok(config.output_format.formatted_string(&inflation))
}
async fn process_rewards(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
addresses: &[Pubkey],
rewards_epoch: Option<Epoch>,
) -> ProcessResult {
let rewards = rpc_client
.get_inflation_reward_with_config(addresses, rewards_epoch)
.await
.map_err(|err| {
if let Some(epoch) = rewards_epoch {
format!("Rewards not available for epoch {}", epoch)
} else {
format!("Rewards not available {}", err)
}
})?;
let epoch_schedule = rpc_client.get_epoch_schedule().await?;
let mut epoch_rewards: Vec<CliKeyedEpochReward> = vec![];
let epoch_metadata = if let Some(Some(first_reward)) = rewards.iter().find(|&v| v.is_some()) {
let (epoch_start_time, epoch_end_time) =
get_epoch_boundary_timestamps(rpc_client, first_reward, &epoch_schedule).await?;
for (reward, address) in rewards.iter().zip(addresses) {
let cli_reward = reward
.as_ref()
.and_then(|reward| make_cli_reward(reward, epoch_start_time, epoch_end_time));
epoch_rewards.push(CliKeyedEpochReward {
address: address.to_string(),
reward: cli_reward,
});
}
let block_time = rpc_client
.get_block_time(first_reward.effective_slot)
.await?;
Some(CliEpochRewardshMetadata {
epoch: first_reward.epoch,
effective_slot: first_reward.effective_slot,
block_time,
})
} else {
None
};
let cli_rewards = CliKeyedEpochRewards {
epoch_metadata,
rewards: epoch_rewards,
};
Ok(config.output_format.formatted_string(&cli_rewards))
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/config.rs
|
use clap::{Arg, ArgGroup, Command};
pub trait ConfigSubCommands {
fn config_subcommands(self) -> Self;
}
impl ConfigSubCommands for Command<'_> {
fn config_subcommands(self) -> Self {
self.subcommand(
Command::new("config")
.about("Solana command-line tool configuration settings")
.aliases(&["get", "set"])
.subcommand_required(true)
.arg_required_else_help(true)
.subcommand(
Command::new("get")
.about("Get current config settings")
.arg(
Arg::new("specific_setting")
.index(1)
.value_name("CONFIG_FIELD")
.takes_value(true)
.possible_values([
"json_rpc_url",
"websocket_url",
// "keypair",
"commitment",
])
.help("Return a specific config setting"),
),
)
.subcommand(
Command::new("set").about("Set a config setting").group(
ArgGroup::new("config_settings")
.args(&[
"json_rpc_url",
"websocket_url",
// "keypair",
"commitment",
])
.multiple(true), // NOTE: .required is panicking clap when there is no argument
// .required(true),
),
), // .subcommand(
// Command::new("import-address-labels")
// .about("Import a list of address labels")
// .arg(
// Arg::new("filename")
// .index(1)
// .value_name("FILENAME")
// .takes_value(true)
// .help("YAML file of address labels"),
// ),
// )
// .subcommand(
// Command::new("export-address-labels")
// .about("Export the current address labels")
// .arg(
// Arg::new("filename")
// .index(1)
// .value_name("FILENAME")
// .takes_value(true)
// .help("YAML file to receive the current address labels"),
// ),
// ),
)
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/stake.rs
|
use std::{ops::Deref, rc::Rc};
use clap::{Arg, ArgMatches, Command};
use solana_clap_v3_utils_wasm::{input_parsers::*, input_validators::*};
use solana_cli_output_wasm::cli_output::{
CliEpochReward, CliStakeHistory, CliStakeHistoryEntry, CliStakeState, CliStakeType,
OutputFormat,
};
use solana_client_wasm::{utils::rpc_response::RpcInflationReward, WasmClient};
use solana_playground_utils_wasm::js::PgTerminal;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
account::from_account,
account_utils::StateMut,
clock::{Clock, UnixTimestamp, SECONDS_PER_DAY},
epoch_schedule::EpochSchedule,
pubkey::Pubkey,
stake::{
self,
state::{Meta, StakeActivationStatus, StakeStateV2},
},
stake_history::StakeHistory,
sysvar::{clock, stake_history},
};
use crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult};
// pub const STAKE_AUTHORITY_ARG: ArgConstant<'static> = ArgConstant {
// name: "stake_authority",
// long: "stake-authority",
// help: "Authorized staker [default: cli config keypair]",
// };
// pub const WITHDRAW_AUTHORITY_ARG: ArgConstant<'static> = ArgConstant {
// name: "withdraw_authority",
// long: "withdraw-authority",
// help: "Authorized withdrawer [default: cli config keypair]",
// };
// pub const CUSTODIAN_ARG: ArgConstant<'static> = ArgConstant {
// name: "custodian",
// long: "custodian",
// help: "Authority to override account lockup",
// };
// fn stake_authority_arg<'a, 'b>() -> Arg<'a, 'b> {
// Arg::new(STAKE_AUTHORITY_ARG.name)
// .long(STAKE_AUTHORITY_ARG.long)
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help(STAKE_AUTHORITY_ARG.help)
// }
// fn withdraw_authority_arg<'a, 'b>() -> Arg<'a, 'b> {
// Arg::new(WITHDRAW_AUTHORITY_ARG.name)
// .long(WITHDRAW_AUTHORITY_ARG.long)
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help(WITHDRAW_AUTHORITY_ARG.help)
// }
// fn custodian_arg<'a, 'b>() -> Arg<'a, 'b> {
// Arg::new(CUSTODIAN_ARG.name)
// .long(CUSTODIAN_ARG.long)
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help(CUSTODIAN_ARG.help)
// }
// pub(crate) struct StakeAuthorization {
// authorization_type: StakeAuthorize,
// new_authority_pubkey: Pubkey,
// authority_pubkey: Option<Pubkey>,
// }
// #[derive(Debug, PartialEq, Eq)]
// pub struct StakeAuthorizationIndexed {
// pub authorization_type: StakeAuthorize,
// pub new_authority_pubkey: Pubkey,
// pub authority: SignerIndex,
// pub new_authority_signer: Option<SignerIndex>,
// }
pub trait StakeSubCommands {
fn stake_subcommands(self) -> Self;
}
impl StakeSubCommands for Command<'_> {
fn stake_subcommands(self) -> Self {
// self.subcommand(
// Command::new("create-stake-account")
// .about("Create a stake account")
// .arg(
// Arg::new("stake_account")
// .index(1)
// .value_name("STAKE_ACCOUNT_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Stake account to create (or base of derived address if --seed is used)")
// )
// .arg(
// Arg::new("amount")
// .index(2)
// .value_name("AMOUNT")
// .takes_value(true)
// .validator(is_amount_or_all)
// .required(true)
// .help("The amount to send to the stake account, in SOL; accepts keyword ALL")
// )
// .arg(
// pubkey!(Arg::new("custodian")
// .long("custodian")
// .value_name("PUBKEY"),
// "Authority to modify lockups. ")
// )
// .arg(
// Arg::new("seed")
// .long("seed")
// .value_name("STRING")
// .takes_value(true)
// .help("Seed for address generation; if specified, the resulting account \
// will be at a derived address of the STAKE_ACCOUNT_KEYPAIR pubkey")
// )
// .arg(
// Arg::new("lockup_epoch")
// .long("lockup-epoch")
// .value_name("NUMBER")
// .takes_value(true)
// .help("The epoch height at which this account will be available for withdrawal")
// )
// .arg(
// Arg::new("lockup_date")
// .long("lockup-date")
// .value_name("RFC3339 DATETIME")
// .validator(is_rfc3339_datetime)
// .takes_value(true)
// .help("The date and time at which this account will be available for withdrawal")
// )
// .arg(
// Arg::new(STAKE_AUTHORITY_ARG.name)
// .long(STAKE_AUTHORITY_ARG.long)
// .value_name("PUBKEY")
// .takes_value(true)
// .validator(is_valid_pubkey)
// .help(STAKE_AUTHORITY_ARG.help)
// )
// .arg(
// Arg::new(WITHDRAW_AUTHORITY_ARG.name)
// .long(WITHDRAW_AUTHORITY_ARG.long)
// .value_name("PUBKEY")
// .takes_value(true)
// .validator(is_valid_pubkey)
// .help(WITHDRAW_AUTHORITY_ARG.help)
// )
// .arg(
// Arg::new("from")
// .long("from")
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help("Source account of funds [default: cli config keypair]"),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("create-stake-account-checked")
// .about("Create a stake account, checking the withdraw authority as a signer")
// .arg(
// Arg::new("stake_account")
// .index(1)
// .value_name("STAKE_ACCOUNT_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Stake account to create (or base of derived address if --seed is used)")
// )
// .arg(
// Arg::new("amount")
// .index(2)
// .value_name("AMOUNT")
// .takes_value(true)
// .validator(is_amount_or_all)
// .required(true)
// .help("The amount to send to the stake account, in SOL; accepts keyword ALL")
// )
// .arg(
// Arg::new("seed")
// .long("seed")
// .value_name("STRING")
// .takes_value(true)
// .help("Seed for address generation; if specified, the resulting account \
// will be at a derived address of the STAKE_ACCOUNT_KEYPAIR pubkey")
// )
// .arg(
// Arg::new(STAKE_AUTHORITY_ARG.name)
// .long(STAKE_AUTHORITY_ARG.long)
// .value_name("PUBKEY")
// .takes_value(true)
// .validator(is_valid_pubkey)
// .help(STAKE_AUTHORITY_ARG.help)
// )
// .arg(
// Arg::new(WITHDRAW_AUTHORITY_ARG.name)
// .long(WITHDRAW_AUTHORITY_ARG.long)
// .value_name("KEYPAIR")
// .takes_value(true)
// .validator(is_valid_signer)
// .help(WITHDRAW_AUTHORITY_ARG.help)
// )
// .arg(
// Arg::new("from")
// .long("from")
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help("Source account of funds [default: cli config keypair]"),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("delegate-stake")
// .about("Delegate stake to a vote account")
// .arg(
// Arg::new("force")
// .long("force")
// .takes_value(false)
// .hidden(true) // Don't document this argument to discourage its use
// .help("Override vote account sanity checks (use carefully!)")
// )
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account to delegate")
// )
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(2)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "The vote account to which the stake will be delegated")
// )
// .arg(stake_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("stake-authorize")
// .about("Authorize a new signing keypair for the given stake account")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .required(true)
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS"),
// "Stake account in which to set a new authority. ")
// )
// .arg(
// pubkey!(Arg::new("new_stake_authority")
// .long("new-stake-authority")
// .required_unless("new_withdraw_authority")
// .value_name("PUBKEY"),
// "New authorized staker")
// )
// .arg(
// pubkey!(Arg::new("new_withdraw_authority")
// .long("new-withdraw-authority")
// .required_unless("new_stake_authority")
// .value_name("PUBKEY"),
// "New authorized withdrawer. ")
// )
// .arg(stake_authority_arg())
// .arg(withdraw_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(custodian_arg())
// .arg(
// Arg::new("no_wait")
// .long("no-wait")
// .takes_value(false)
// .help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
// )
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("stake-authorize-checked")
// .about("Authorize a new signing keypair for the given stake account, checking the authority as a signer")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .required(true)
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS"),
// "Stake account in which to set a new authority. ")
// )
// .arg(
// Arg::new("new_stake_authority")
// .long("new-stake-authority")
// .value_name("KEYPAIR")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("New authorized staker")
// )
// .arg(
// Arg::new("new_withdraw_authority")
// .long("new-withdraw-authority")
// .value_name("KEYPAIR")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("New authorized withdrawer")
// )
// .arg(stake_authority_arg())
// .arg(withdraw_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(custodian_arg())
// .arg(
// Arg::new("no_wait")
// .long("no-wait")
// .takes_value(false)
// .help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
// )
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("deactivate-stake")
// .about("Deactivate the delegated stake from the stake account")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account to be deactivated (or base of derived address if --seed is used). ")
// )
// .arg(
// Arg::new("seed")
// .long("seed")
// .value_name("STRING")
// .takes_value(true)
// .help("Seed for address generation; if specified, the resulting account \
// will be at a derived address of STAKE_ACCOUNT_ADDRESS")
// )
// .arg(
// Arg::new("delinquent")
// .long("delinquent")
// .takes_value(false)
// .conflicts_with(SIGN_ONLY_ARG.name)
// .help("Deactivate abandoned stake that is currently delegated to a delinquent vote account")
// )
// .arg(stake_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("split-stake")
// .about("Duplicate a stake account, splitting the tokens between the two")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account to split (or base of derived address if --seed is used). ")
// )
// .arg(
// Arg::new("split_stake_account")
// .index(2)
// .value_name("SPLIT_STAKE_ACCOUNT")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Keypair of the new stake account")
// )
// .arg(
// Arg::new("amount")
// .index(3)
// .value_name("AMOUNT")
// .takes_value(true)
// .validator(is_amount)
// .required(true)
// .help("The amount to move into the new stake account, in SOL")
// )
// .arg(
// Arg::new("seed")
// .long("seed")
// .value_name("STRING")
// .takes_value(true)
// .help("Seed for address generation; if specified, the resulting account \
// will be at a derived address of SPLIT_STAKE_ACCOUNT")
// )
// .arg(stake_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("merge-stake")
// .about("Merges one stake account into another")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account to merge into")
// )
// .arg(
// pubkey!(Arg::new("source_stake_account_pubkey")
// .index(2)
// .value_name("SOURCE_STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Source stake account for the merge. If successful, this stake account \
// will no longer exist after the merge")
// )
// .arg(stake_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("withdraw-stake")
// .about("Withdraw the unstaked SOL from the stake account")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account from which to withdraw (or base of derived address if --seed is used). ")
// )
// .arg(
// pubkey!(Arg::new("destination_account_pubkey")
// .index(2)
// .value_name("RECIPIENT_ADDRESS")
// .required(true),
// "Recipient of withdrawn SOL")
// )
// .arg(
// Arg::new("amount")
// .index(3)
// .value_name("AMOUNT")
// .takes_value(true)
// .validator(is_amount_or_all)
// .required(true)
// .help("The amount to withdraw from the stake account, in SOL; accepts keyword ALL")
// )
// .arg(
// Arg::new("seed")
// .long("seed")
// .value_name("STRING")
// .takes_value(true)
// .help("Seed for address generation; if specified, the resulting account \
// will be at a derived address of STAKE_ACCOUNT_ADDRESS")
// )
// .arg(withdraw_authority_arg())
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(custodian_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("stake-set-lockup")
// .about("Set Lockup for the stake account")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account for which to set lockup parameters. ")
// )
// .arg(
// Arg::new("lockup_epoch")
// .long("lockup-epoch")
// .value_name("NUMBER")
// .takes_value(true)
// .help("The epoch height at which this account will be available for withdrawal")
// )
// .arg(
// Arg::new("lockup_date")
// .long("lockup-date")
// .value_name("RFC3339 DATETIME")
// .validator(is_rfc3339_datetime)
// .takes_value(true)
// .help("The date and time at which this account will be available for withdrawal")
// )
// .arg(
// pubkey!(Arg::new("new_custodian")
// .long("new-custodian")
// .value_name("PUBKEY"),
// "Identity of a new lockup custodian. ")
// )
// .group(ArgGroup::with_name("lockup_details")
// .args(&["lockup_epoch", "lockup_date", "new_custodian"])
// .multiple(true)
// .required(true))
// .arg(
// Arg::new("custodian")
// .long("custodian")
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help("Keypair of the existing custodian [default: cli config pubkey]")
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("stake-set-lockup-checked")
// .about("Set Lockup for the stake account, checking the new authority as a signer")
// .arg(
// pubkey!(Arg::new("stake_account_pubkey")
// .index(1)
// .value_name("STAKE_ACCOUNT_ADDRESS")
// .required(true),
// "Stake account for which to set lockup parameters. ")
// )
// .arg(
// Arg::new("lockup_epoch")
// .long("lockup-epoch")
// .value_name("NUMBER")
// .takes_value(true)
// .help("The epoch height at which this account will be available for withdrawal")
// )
// .arg(
// Arg::new("lockup_date")
// .long("lockup-date")
// .value_name("RFC3339 DATETIME")
// .validator(is_rfc3339_datetime)
// .takes_value(true)
// .help("The date and time at which this account will be available for withdrawal")
// )
// .arg(
// Arg::new("new_custodian")
// .long("new-custodian")
// .value_name("KEYPAIR")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Keypair of a new lockup custodian")
// )
// .group(ArgGroup::with_name("lockup_details")
// .args(&["lockup_epoch", "lockup_date", "new_custodian"])
// .multiple(true)
// .required(true))
// .arg(
// Arg::new("custodian")
// .long("custodian")
// .takes_value(true)
// .value_name("KEYPAIR")
// .validator(is_valid_signer)
// .help("Keypair of the existing custodian [default: cli config pubkey]")
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
self.subcommand(
Command::new("stake-account")
.about("Show the contents of a stake account")
.alias("show-stake-account")
.arg(
pubkey!(Arg::new("stake_account_pubkey")
.index(1)
.value_name("STAKE_ACCOUNT_ADDRESS")
.required(true),
"The stake account to display. ")
)
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL")
)
.arg(
Arg::new("with_rewards")
.long("with-rewards")
.takes_value(false)
.help("Display inflation rewards"),
)
.arg(
Arg::new("num_rewards_epochs")
.long("num-rewards-epochs")
.takes_value(true)
.value_name("NUM")
.validator(|s| is_within_range(s, 1, 10))
.default_value_if("with_rewards", None, Some("1"))
.requires("with_rewards")
.help("Display rewards for NUM recent epochs, max 10 [default: latest epoch only]"),
),
)
.subcommand(
Command::new("stake-history")
.about("Show the stake history")
.alias("show-stake-history")
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL")
)
.arg(
Arg::new("limit")
.long("limit")
.takes_value(true)
.value_name("NUM")
.default_value("10")
.validator(|s| {
s.parse::<usize>()
.map(|_| ())
.map_err(|e| e.to_string())
})
.help("Display NUM recent epochs worth of stake history in text mode. 0 for all")
)
)
}
}
// pub fn parse_create_stake_account(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// checked: bool,
// ) -> Result<CliCommandInfo, CliError> {
// let seed = matches.value_of("seed").map(|s| s.to_string());
// let epoch = value_of(matches, "lockup_epoch").unwrap_or(0);
// let unix_timestamp = unix_timestamp_from_rfc3339_datetime(matches, "lockup_date").unwrap_or(0);
// let custodian = pubkey_of_signer(matches, "custodian", wallet_manager)?.unwrap_or_default();
// let staker = pubkey_of_signer(matches, STAKE_AUTHORITY_ARG.name, wallet_manager)?;
// let (withdrawer_signer, withdrawer) = if checked {
// signer_of(matches, WITHDRAW_AUTHORITY_ARG.name, wallet_manager)?
// } else {
// (
// None,
// pubkey_of_signer(matches, WITHDRAW_AUTHORITY_ARG.name, wallet_manager)?,
// )
// };
// let amount = SpendAmount::new_from_matches(matches, "amount");
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of_signer(matches, NONCE_ARG.name, wallet_manager)?;
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let (from, from_pubkey) = signer_of(matches, "from", wallet_manager)?;
// let (stake_account, stake_account_pubkey) =
// signer_of(matches, "stake_account", wallet_manager)?;
// let mut bulk_signers = vec![fee_payer, from, stake_account];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// if withdrawer_signer.is_some() {
// bulk_signers.push(withdrawer_signer);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::CreateStakeAccount {
// stake_account: signer_info.index_of(stake_account_pubkey).unwrap(),
// seed,
// staker,
// withdrawer,
// withdrawer_signer: if checked {
// signer_info.index_of(withdrawer)
// } else {
// None
// },
// lockup: Lockup {
// unix_timestamp,
// epoch,
// custodian,
// },
// amount,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// from: signer_info.index_of(from_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_stake_delegate_stake(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let vote_account_pubkey =
// pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
// let force = matches.is_present("force");
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (stake_authority, stake_authority_pubkey) =
// signer_of(matches, STAKE_AUTHORITY_ARG.name, wallet_manager)?;
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![stake_authority, fee_payer];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::DelegateStake {
// stake_account_pubkey,
// vote_account_pubkey,
// stake_authority: signer_info.index_of(stake_authority_pubkey).unwrap(),
// force,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_stake_authorize(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// checked: bool,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let mut new_authorizations = Vec::new();
// let mut bulk_signers = Vec::new();
// let (new_staker_signer, new_staker) = if checked {
// signer_of(matches, "new_stake_authority", wallet_manager)?
// } else {
// (
// None,
// pubkey_of_signer(matches, "new_stake_authority", wallet_manager)?,
// )
// };
// if let Some(new_authority_pubkey) = new_staker {
// let (authority, authority_pubkey) = {
// let (authority, authority_pubkey) =
// signer_of(matches, STAKE_AUTHORITY_ARG.name, wallet_manager)?;
// // Withdraw authority may also change the staker
// if authority.is_none() {
// signer_of(matches, WITHDRAW_AUTHORITY_ARG.name, wallet_manager)?
// } else {
// (authority, authority_pubkey)
// }
// };
// new_authorizations.push(StakeAuthorization {
// authorization_type: StakeAuthorize::Staker,
// new_authority_pubkey,
// authority_pubkey,
// });
// bulk_signers.push(authority);
// if new_staker.is_some() {
// bulk_signers.push(new_staker_signer);
// }
// };
// let (new_withdrawer_signer, new_withdrawer) = if checked {
// signer_of(matches, "new_withdraw_authority", wallet_manager)?
// } else {
// (
// None,
// pubkey_of_signer(matches, "new_withdraw_authority", wallet_manager)?,
// )
// };
// if let Some(new_authority_pubkey) = new_withdrawer {
// let (authority, authority_pubkey) =
// signer_of(matches, WITHDRAW_AUTHORITY_ARG.name, wallet_manager)?;
// new_authorizations.push(StakeAuthorization {
// authorization_type: StakeAuthorize::Withdrawer,
// new_authority_pubkey,
// authority_pubkey,
// });
// bulk_signers.push(authority);
// if new_withdrawer_signer.is_some() {
// bulk_signers.push(new_withdrawer_signer);
// }
// };
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let (custodian, custodian_pubkey) = signer_of(matches, "custodian", wallet_manager)?;
// let no_wait = matches.is_present("no_wait");
// bulk_signers.push(fee_payer);
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// if custodian.is_some() {
// bulk_signers.push(custodian);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// let new_authorizations = new_authorizations
// .into_iter()
// .map(
// |StakeAuthorization {
// authorization_type,
// new_authority_pubkey,
// authority_pubkey,
// }| {
// StakeAuthorizationIndexed {
// authorization_type,
// new_authority_pubkey,
// authority: signer_info.index_of(authority_pubkey).unwrap(),
// new_authority_signer: signer_info.index_of(Some(new_authority_pubkey)),
// }
// },
// )
// .collect();
// Ok(CliCommandInfo {
// command: CliCommand::StakeAuthorize {
// stake_account_pubkey,
// new_authorizations,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// custodian: custodian_pubkey.and_then(|_| signer_info.index_of(custodian_pubkey)),
// no_wait,
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_split_stake(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let (split_stake_account, split_stake_account_pubkey) =
// signer_of(matches, "split_stake_account", wallet_manager)?;
// let lamports = lamports_of_sol(matches, "amount").unwrap();
// let seed = matches.value_of("seed").map(|s| s.to_string());
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (stake_authority, stake_authority_pubkey) =
// signer_of(matches, STAKE_AUTHORITY_ARG.name, wallet_manager)?;
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![stake_authority, fee_payer, split_stake_account];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::SplitStake {
// stake_account_pubkey,
// stake_authority: signer_info.index_of(stake_authority_pubkey).unwrap(),
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// split_stake_account: signer_info.index_of(split_stake_account_pubkey).unwrap(),
// seed,
// lamports,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_merge_stake(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let source_stake_account_pubkey = pubkey_of(matches, "source_stake_account_pubkey").unwrap();
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (stake_authority, stake_authority_pubkey) =
// signer_of(matches, STAKE_AUTHORITY_ARG.name, wallet_manager)?;
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![stake_authority, fee_payer];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::MergeStake {
// stake_account_pubkey,
// source_stake_account_pubkey,
// stake_authority: signer_info.index_of(stake_authority_pubkey).unwrap(),
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_stake_deactivate_stake(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let deactivate_delinquent = matches.is_present("delinquent");
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let seed = value_t!(matches, "seed", String).ok();
// let (stake_authority, stake_authority_pubkey) =
// signer_of(matches, STAKE_AUTHORITY_ARG.name, wallet_manager)?;
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![stake_authority, fee_payer];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::DeactivateStake {
// stake_account_pubkey,
// stake_authority: signer_info.index_of(stake_authority_pubkey).unwrap(),
// sign_only,
// deactivate_delinquent,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// seed,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_stake_withdraw_stake(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let destination_account_pubkey =
// pubkey_of_signer(matches, "destination_account_pubkey", wallet_manager)?.unwrap();
// let amount = SpendAmount::new_from_matches(matches, "amount");
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let seed = value_t!(matches, "seed", String).ok();
// let (withdraw_authority, withdraw_authority_pubkey) =
// signer_of(matches, WITHDRAW_AUTHORITY_ARG.name, wallet_manager)?;
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let (custodian, custodian_pubkey) = signer_of(matches, "custodian", wallet_manager)?;
// let mut bulk_signers = vec![withdraw_authority, fee_payer];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// if custodian.is_some() {
// bulk_signers.push(custodian);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::WithdrawStake {
// stake_account_pubkey,
// destination_account_pubkey,
// amount,
// withdraw_authority: signer_info.index_of(withdraw_authority_pubkey).unwrap(),
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// seed,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// custodian: custodian_pubkey.and_then(|_| signer_info.index_of(custodian_pubkey)),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_stake_set_lockup(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// checked: bool,
// ) -> Result<CliCommandInfo, CliError> {
// let stake_account_pubkey =
// pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
// let epoch = value_of(matches, "lockup_epoch");
// let unix_timestamp = unix_timestamp_from_rfc3339_datetime(matches, "lockup_date");
// let (new_custodian_signer, new_custodian) = if checked {
// signer_of(matches, "new_custodian", wallet_manager)?
// } else {
// (
// None,
// pubkey_of_signer(matches, "new_custodian", wallet_manager)?,
// )
// };
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (custodian, custodian_pubkey) = signer_of(matches, "custodian", wallet_manager)?;
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![custodian, fee_payer];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// if new_custodian_signer.is_some() {
// bulk_signers.push(new_custodian_signer);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::StakeSetLockup {
// stake_account_pubkey,
// lockup: LockupArgs {
// custodian: new_custodian,
// epoch,
// unix_timestamp,
// },
// new_custodian_signer: if checked {
// signer_info.index_of(new_custodian)
// } else {
// None
// },
// custodian: signer_info.index_of(custodian_pubkey).unwrap(),
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
pub fn parse_show_stake_account(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let stake_account_pubkey =
pubkey_of_signer(matches, "stake_account_pubkey", wallet_manager)?.unwrap();
let use_lamports_unit = matches.is_present("lamports");
let with_rewards = if matches.is_present("with_rewards") {
Some(value_of(matches, "num_rewards_epochs").unwrap())
} else {
None
};
Ok(CliCommandInfo {
command: CliCommand::ShowStakeAccount {
pubkey: stake_account_pubkey,
use_lamports_unit,
with_rewards,
},
signers: vec![],
})
}
pub fn parse_show_stake_history(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let use_lamports_unit = matches.is_present("lamports");
let limit_results = value_of(matches, "limit").unwrap();
Ok(CliCommandInfo {
command: CliCommand::ShowStakeHistory {
use_lamports_unit,
limit_results,
},
signers: vec![],
})
}
// #[allow(clippy::too_many_arguments)]
// pub fn process_create_stake_account(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account: SignerIndex,
// seed: &Option<String>,
// staker: &Option<Pubkey>,
// withdrawer: &Option<Pubkey>,
// withdrawer_signer: Option<SignerIndex>,
// lockup: &Lockup,
// amount: SpendAmount,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<&Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// from: SignerIndex,
// ) -> ProcessResult {
// let stake_account = config.signers[stake_account];
// let stake_account_address = if let Some(seed) = seed {
// Pubkey::create_with_seed(&stake_account.pubkey(), seed, &stake::program::id())?
// } else {
// stake_account.pubkey()
// };
// let from = config.signers[from];
// check_unique_pubkeys(
// (&from.pubkey(), "from keypair".to_string()),
// (&stake_account_address, "stake_account".to_string()),
// )?;
// let fee_payer = config.signers[fee_payer];
// let nonce_authority = config.signers[nonce_authority];
// let build_message = |lamports| {
// let authorized = Authorized {
// staker: staker.unwrap_or(from.pubkey()),
// withdrawer: withdrawer.unwrap_or(from.pubkey()),
// };
// let ixs = match (seed, withdrawer_signer) {
// (Some(seed), Some(_withdrawer_signer)) => {
// stake_instruction::create_account_with_seed_checked(
// &from.pubkey(), // from
// &stake_account_address, // to
// &stake_account.pubkey(), // base
// seed, // seed
// &authorized,
// lamports,
// )
// }
// (Some(seed), None) => stake_instruction::create_account_with_seed(
// &from.pubkey(), // from
// &stake_account_address, // to
// &stake_account.pubkey(), // base
// seed, // seed
// &authorized,
// lockup,
// lamports,
// ),
// (None, Some(_withdrawer_signer)) => stake_instruction::create_account_checked(
// &from.pubkey(),
// &stake_account.pubkey(),
// &authorized,
// lamports,
// ),
// (None, None) => stake_instruction::create_account(
// &from.pubkey(),
// &stake_account.pubkey(),
// &authorized,
// lockup,
// lamports,
// ),
// }
// .with_memo(memo);
// if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// }
// };
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let (message, lamports) = resolve_spend_tx_and_check_account_balances(
// rpc_client,
// sign_only,
// amount,
// &recent_blockhash,
// &from.pubkey(),
// &fee_payer.pubkey(),
// build_message,
// config.commitment,
// )?;
// if !sign_only {
// if let Ok(stake_account) = rpc_client.get_account(&stake_account_address) {
// let err_msg = if stake_account.owner == stake::program::id() {
// format!("Stake account {} already exists", stake_account_address)
// } else {
// format!(
// "Account {} already exists and is not a stake account",
// stake_account_address
// )
// };
// return Err(CliError::BadParameter(err_msg).into());
// }
// let minimum_balance =
// rpc_client.get_minimum_balance_for_rent_exemption(StakeState::size_of())?;
// if lamports < minimum_balance {
// return Err(CliError::BadParameter(format!(
// "need at least {} lamports for stake account to be rent exempt, provided lamports: {}",
// minimum_balance, lamports
// ))
// .into());
// }
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// }
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
// log_instruction_custom_error::<SystemError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_stake_authorize(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// new_authorizations: &[StakeAuthorizationIndexed],
// custodian: Option<SignerIndex>,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// no_wait: bool,
// ) -> ProcessResult {
// let mut ixs = Vec::new();
// let custodian = custodian.map(|index| config.signers[index]);
// let current_stake_account = if !sign_only {
// Some(get_stake_account_state(
// rpc_client,
// stake_account_pubkey,
// config.commitment,
// )?)
// } else {
// None
// };
// for StakeAuthorizationIndexed {
// authorization_type,
// new_authority_pubkey,
// authority,
// new_authority_signer,
// } in new_authorizations.iter()
// {
// check_unique_pubkeys(
// (stake_account_pubkey, "stake_account_pubkey".to_string()),
// (new_authority_pubkey, "new_authorized_pubkey".to_string()),
// )?;
// let authority = config.signers[*authority];
// if let Some(current_stake_account) = current_stake_account {
// let authorized = match current_stake_account {
// StakeState::Stake(Meta { authorized, .. }, ..) => Some(authorized),
// StakeState::Initialized(Meta { authorized, .. }) => Some(authorized),
// _ => None,
// };
// if let Some(authorized) = authorized {
// match authorization_type {
// StakeAuthorize::Staker => check_current_authority(
// &[authorized.withdrawer, authorized.staker],
// &authority.pubkey(),
// )?,
// StakeAuthorize::Withdrawer => {
// check_current_authority(&[authorized.withdrawer], &authority.pubkey())?;
// }
// }
// } else {
// return Err(CliError::RpcRequestError(format!(
// "{:?} is not an Initialized or Delegated stake account",
// stake_account_pubkey,
// ))
// .into());
// }
// }
// if new_authority_signer.is_some() {
// ixs.push(stake_instruction::authorize_checked(
// stake_account_pubkey, // stake account to update
// &authority.pubkey(), // currently authorized
// new_authority_pubkey, // new stake signer
// *authorization_type, // stake or withdraw
// custodian.map(|signer| signer.pubkey()).as_ref(),
// ));
// } else {
// ixs.push(stake_instruction::authorize(
// stake_account_pubkey, // stake account to update
// &authority.pubkey(), // currently authorized
// new_authority_pubkey, // new stake signer
// *authorization_type, // stake or withdraw
// custodian.map(|signer| signer.pubkey()).as_ref(),
// ));
// }
// }
// ixs = ixs.with_memo(memo);
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let nonce_authority = config.signers[nonce_authority];
// let fee_payer = config.signers[fee_payer];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = if no_wait {
// rpc_client.send_transaction(&tx)
// } else {
// rpc_client.send_and_confirm_transaction_with_spinner(&tx)
// };
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_deactivate_stake_account(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// stake_authority: SignerIndex,
// sign_only: bool,
// deactivate_delinquent: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// seed: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let stake_account_address = if let Some(seed) = seed {
// Pubkey::create_with_seed(stake_account_pubkey, seed, &stake::program::id())?
// } else {
// *stake_account_pubkey
// };
// let ixs = vec![if deactivate_delinquent {
// let stake_account = rpc_client.get_account(&stake_account_address)?;
// if stake_account.owner != stake::program::id() {
// return Err(CliError::BadParameter(format!(
// "{} is not a stake account",
// stake_account_address,
// ))
// .into());
// }
// let vote_account_address = match stake_account.state() {
// Ok(stake_state) => match stake_state {
// StakeState::Stake(_, stake) => stake.delegation.voter_pubkey,
// _ => {
// return Err(CliError::BadParameter(format!(
// "{} is not a delegated stake account",
// stake_account_address,
// ))
// .into())
// }
// },
// Err(err) => {
// return Err(CliError::RpcRequestError(format!(
// "Account data could not be deserialized to stake state: {}",
// err
// ))
// .into())
// }
// };
// let current_epoch = rpc_client.get_epoch_info()?.epoch;
// let (_, vote_state) = crate::vote::get_vote_account(
// rpc_client,
// &vote_account_address,
// rpc_client.commitment(),
// )?;
// if !eligible_for_deactivate_delinquent(&vote_state.epoch_credits, current_epoch) {
// return Err(CliError::BadParameter(format!(
// "Stake has not been delinquent for {} epochs",
// stake::MINIMUM_DELINQUENT_EPOCHS_FOR_DEACTIVATION,
// ))
// .into());
// }
// // Search for a reference vote account
// let reference_vote_account_address = rpc_client
// .get_vote_accounts()?
// .current
// .into_iter()
// .find(|vote_account_info| {
// acceptable_reference_epoch_credits(&vote_account_info.epoch_credits, current_epoch)
// });
// let reference_vote_account_address = reference_vote_account_address
// .ok_or_else(|| {
// CliError::RpcRequestError("Unable to find a reference vote account".into())
// })?
// .vote_pubkey
// .parse()?;
// stake_instruction::deactivate_delinquent_stake(
// &stake_account_address,
// &vote_account_address,
// &reference_vote_account_address,
// )
// } else {
// let stake_authority = config.signers[stake_authority];
// stake_instruction::deactivate_stake(&stake_account_address, &stake_authority.pubkey())
// }]
// .with_memo(memo);
// let nonce_authority = config.signers[nonce_authority];
// let fee_payer = config.signers[fee_payer];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_withdraw_stake(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// destination_account_pubkey: &Pubkey,
// amount: SpendAmount,
// withdraw_authority: SignerIndex,
// custodian: Option<SignerIndex>,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<&Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// seed: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let withdraw_authority = config.signers[withdraw_authority];
// let custodian = custodian.map(|index| config.signers[index]);
// let stake_account_address = if let Some(seed) = seed {
// Pubkey::create_with_seed(stake_account_pubkey, seed, &stake::program::id())?
// } else {
// *stake_account_pubkey
// };
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let fee_payer = config.signers[fee_payer];
// let nonce_authority = config.signers[nonce_authority];
// let build_message = |lamports| {
// let ixs = vec![stake_instruction::withdraw(
// &stake_account_address,
// &withdraw_authority.pubkey(),
// destination_account_pubkey,
// lamports,
// custodian.map(|signer| signer.pubkey()).as_ref(),
// )]
// .with_memo(memo);
// if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// }
// };
// let (message, _) = resolve_spend_tx_and_check_account_balances(
// rpc_client,
// sign_only,
// amount,
// &recent_blockhash,
// &stake_account_address,
// &fee_payer.pubkey(),
// build_message,
// config.commitment,
// )?;
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_split_stake(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// stake_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// split_stake_account: SignerIndex,
// split_stake_account_seed: &Option<String>,
// lamports: u64,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let split_stake_account = config.signers[split_stake_account];
// let fee_payer = config.signers[fee_payer];
// if split_stake_account_seed.is_none() {
// check_unique_pubkeys(
// (&fee_payer.pubkey(), "fee-payer keypair".to_string()),
// (
// &split_stake_account.pubkey(),
// "split_stake_account".to_string(),
// ),
// )?;
// }
// check_unique_pubkeys(
// (&fee_payer.pubkey(), "fee-payer keypair".to_string()),
// (stake_account_pubkey, "stake_account".to_string()),
// )?;
// check_unique_pubkeys(
// (stake_account_pubkey, "stake_account".to_string()),
// (
// &split_stake_account.pubkey(),
// "split_stake_account".to_string(),
// ),
// )?;
// let stake_authority = config.signers[stake_authority];
// let split_stake_account_address = if let Some(seed) = split_stake_account_seed {
// Pubkey::create_with_seed(&split_stake_account.pubkey(), seed, &stake::program::id())?
// } else {
// split_stake_account.pubkey()
// };
// if !sign_only {
// if let Ok(stake_account) = rpc_client.get_account(&split_stake_account_address) {
// let err_msg = if stake_account.owner == stake::program::id() {
// format!(
// "Stake account {} already exists",
// split_stake_account_address
// )
// } else {
// format!(
// "Account {} already exists and is not a stake account",
// split_stake_account_address
// )
// };
// return Err(CliError::BadParameter(err_msg).into());
// }
// let minimum_balance =
// rpc_client.get_minimum_balance_for_rent_exemption(StakeState::size_of())?;
// if lamports < minimum_balance {
// return Err(CliError::BadParameter(format!(
// "need at least {} lamports for stake account to be rent exempt, provided lamports: {}",
// minimum_balance, lamports
// ))
// .into());
// }
// }
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let ixs = if let Some(seed) = split_stake_account_seed {
// stake_instruction::split_with_seed(
// stake_account_pubkey,
// &stake_authority.pubkey(),
// lamports,
// &split_stake_account_address,
// &split_stake_account.pubkey(),
// seed,
// )
// .with_memo(memo)
// } else {
// stake_instruction::split(
// stake_account_pubkey,
// &stake_authority.pubkey(),
// lamports,
// &split_stake_account_address,
// )
// .with_memo(memo)
// };
// let nonce_authority = config.signers[nonce_authority];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_merge_stake(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// source_stake_account_pubkey: &Pubkey,
// stake_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let fee_payer = config.signers[fee_payer];
// check_unique_pubkeys(
// (&fee_payer.pubkey(), "fee-payer keypair".to_string()),
// (stake_account_pubkey, "stake_account".to_string()),
// )?;
// check_unique_pubkeys(
// (&fee_payer.pubkey(), "fee-payer keypair".to_string()),
// (
// source_stake_account_pubkey,
// "source_stake_account".to_string(),
// ),
// )?;
// check_unique_pubkeys(
// (stake_account_pubkey, "stake_account".to_string()),
// (
// source_stake_account_pubkey,
// "source_stake_account".to_string(),
// ),
// )?;
// let stake_authority = config.signers[stake_authority];
// if !sign_only {
// for stake_account_address in &[stake_account_pubkey, source_stake_account_pubkey] {
// if let Ok(stake_account) = rpc_client.get_account(stake_account_address) {
// if stake_account.owner != stake::program::id() {
// return Err(CliError::BadParameter(format!(
// "Account {} is not a stake account",
// stake_account_address
// ))
// .into());
// }
// }
// }
// }
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let ixs = stake_instruction::merge(
// stake_account_pubkey,
// source_stake_account_pubkey,
// &stake_authority.pubkey(),
// )
// .with_memo(memo);
// let nonce_authority = config.signers[nonce_authority];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner_and_config(
// &tx,
// config.commitment,
// config.send_transaction_config,
// );
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_stake_set_lockup(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// lockup: &LockupArgs,
// new_custodian_signer: Option<SignerIndex>,
// custodian: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let custodian = config.signers[custodian];
// let ixs = vec![if new_custodian_signer.is_some() {
// stake_instruction::set_lockup_checked(stake_account_pubkey, lockup, &custodian.pubkey())
// } else {
// stake_instruction::set_lockup(stake_account_pubkey, lockup, &custodian.pubkey())
// }]
// .with_memo(memo);
// let nonce_authority = config.signers[nonce_authority];
// let fee_payer = config.signers[fee_payer];
// if !sign_only {
// let state = get_stake_account_state(rpc_client, stake_account_pubkey, config.commitment)?;
// let lockup = match state {
// StakeState::Stake(Meta { lockup, .. }, ..) => Some(lockup),
// StakeState::Initialized(Meta { lockup, .. }) => Some(lockup),
// _ => None,
// };
// if let Some(lockup) = lockup {
// if lockup.custodian != Pubkey::default() {
// check_current_authority(&[lockup.custodian], &custodian.pubkey())?;
// }
// } else {
// return Err(CliError::RpcRequestError(format!(
// "{:?} is not an Initialized or Delegated stake account",
// stake_account_pubkey,
// ))
// .into());
// }
// }
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
fn u64_some_if_not_zero(n: u64) -> Option<u64> {
if n > 0 {
Some(n)
} else {
None
}
}
pub fn build_stake_state(
account_balance: u64,
stake_state: &StakeStateV2,
use_lamports_unit: bool,
stake_history: &StakeHistory,
clock: &Clock,
) -> CliStakeState {
match stake_state {
StakeStateV2::Stake(
Meta {
rent_exempt_reserve,
authorized,
lockup,
},
stake,
_,
) => {
let current_epoch = clock.epoch;
let StakeActivationStatus {
effective,
activating,
deactivating,
} = stake.delegation.stake_activating_and_deactivating(
current_epoch,
stake_history,
None,
);
let lockup = if lockup.is_in_force(clock, None) {
Some(lockup.into())
} else {
None
};
CliStakeState {
stake_type: CliStakeType::Stake,
account_balance,
credits_observed: Some(stake.credits_observed),
delegated_stake: Some(stake.delegation.stake),
delegated_vote_account_address: if stake.delegation.voter_pubkey
!= Pubkey::default()
{
Some(stake.delegation.voter_pubkey.to_string())
} else {
None
},
activation_epoch: Some(if stake.delegation.activation_epoch < u64::MAX {
stake.delegation.activation_epoch
} else {
0
}),
deactivation_epoch: if stake.delegation.deactivation_epoch < u64::MAX {
Some(stake.delegation.deactivation_epoch)
} else {
None
},
authorized: Some(authorized.into()),
lockup,
use_lamports_unit,
current_epoch,
rent_exempt_reserve: Some(*rent_exempt_reserve),
active_stake: u64_some_if_not_zero(effective),
activating_stake: u64_some_if_not_zero(activating),
deactivating_stake: u64_some_if_not_zero(deactivating),
..CliStakeState::default()
}
}
StakeStateV2::RewardsPool => CliStakeState {
stake_type: CliStakeType::RewardsPool,
account_balance,
..CliStakeState::default()
},
StakeStateV2::Uninitialized => CliStakeState {
account_balance,
..CliStakeState::default()
},
StakeStateV2::Initialized(Meta {
rent_exempt_reserve,
authorized,
lockup,
}) => {
let lockup = if lockup.is_in_force(clock, None) {
Some(lockup.into())
} else {
None
};
CliStakeState {
stake_type: CliStakeType::Initialized,
account_balance,
credits_observed: Some(0),
authorized: Some(authorized.into()),
lockup,
use_lamports_unit,
rent_exempt_reserve: Some(*rent_exempt_reserve),
..CliStakeState::default()
}
}
}
}
// fn get_stake_account_state(
// rpc_client: &WasmClient,
// stake_account_pubkey: &Pubkey,
// commitment_config: CommitmentConfig,
// ) -> Result<StakeState, Box<dyn std::error::Error>> {
// let stake_account = rpc_client
// .get_account_with_commitment(stake_account_pubkey, commitment_config)?
// .value
// .ok_or_else(|| {
// CliError::RpcRequestError(format!("{:?} account does not exist", stake_account_pubkey))
// })?;
// if stake_account.owner != stake::program::id() {
// return Err(CliError::RpcRequestError(format!(
// "{:?} is not a stake account",
// stake_account_pubkey,
// ))
// .into());
// }
// stake_account.state().map_err(|err| {
// CliError::RpcRequestError(format!(
// "Account data could not be deserialized to stake state: {}",
// err
// ))
// .into()
// })
// }
pub(crate) fn check_current_authority(
permitted_authorities: &[Pubkey],
provided_current_authority: &Pubkey,
) -> Result<(), CliError> {
if !permitted_authorities.contains(provided_current_authority) {
Err(CliError::RpcRequestError(format!(
"Invalid authority provided: {:?}, expected {:?}",
provided_current_authority, permitted_authorities
)))
} else {
Ok(())
}
}
pub async fn get_epoch_boundary_timestamps(
rpc_client: &WasmClient,
reward: &RpcInflationReward,
epoch_schedule: &EpochSchedule,
) -> Result<(UnixTimestamp, UnixTimestamp), Box<dyn std::error::Error>> {
let epoch_end_time = rpc_client.get_block_time(reward.effective_slot).await?;
let mut epoch_start_slot = epoch_schedule.get_first_slot_in_epoch(reward.epoch);
let epoch_start_time = loop {
if epoch_start_slot >= reward.effective_slot {
return Err("epoch_start_time not found".to_string().into());
}
match rpc_client.get_block_time(epoch_start_slot).await {
Ok(block_time) => {
break block_time;
}
Err(_) => {
epoch_start_slot += 1;
}
}
};
Ok((epoch_start_time, epoch_end_time))
}
pub fn make_cli_reward(
reward: &RpcInflationReward,
epoch_start_time: UnixTimestamp,
epoch_end_time: UnixTimestamp,
) -> Option<CliEpochReward> {
let wallclock_epoch_duration = epoch_end_time.checked_sub(epoch_start_time)?;
if reward.post_balance > reward.amount {
let rate_change = reward.amount as f64 / (reward.post_balance - reward.amount) as f64;
let wallclock_epochs_per_year =
(SECONDS_PER_DAY * 365) as f64 / wallclock_epoch_duration as f64;
let apr = rate_change * wallclock_epochs_per_year;
Some(CliEpochReward {
epoch: reward.epoch,
effective_slot: reward.effective_slot,
amount: reward.amount,
post_balance: reward.post_balance,
percent_change: rate_change * 100.0,
apr: Some(apr * 100.0),
commission: reward.commission,
})
} else {
None
}
}
pub(crate) async fn fetch_epoch_rewards(
rpc_client: &WasmClient,
address: &Pubkey,
mut num_epochs: usize,
) -> Result<Vec<CliEpochReward>, Box<dyn std::error::Error>> {
let mut all_epoch_rewards = vec![];
let epoch_schedule = rpc_client.get_epoch_schedule().await?;
let mut rewards_epoch = rpc_client.get_epoch_info().await?.epoch;
// NOTE: Change for WASM
// let mut process_reward =
// |reward: &Option<RpcInflationReward>| -> Result<(), Box<dyn std::error::Error>> {
// if let Some(reward) = reward {
// let (epoch_start_time, epoch_end_time) =
// get_epoch_boundary_timestamps(rpc_client, reward, &epoch_schedule).await?;
// if let Some(cli_reward) = make_cli_reward(reward, epoch_start_time, epoch_end_time)
// {
// all_epoch_rewards.push(cli_reward);
// }
// }
// Ok(())
// };
while num_epochs > 0 && rewards_epoch > 0 {
rewards_epoch = rewards_epoch.saturating_sub(1);
if let Ok(rewards) = rpc_client
.get_inflation_reward_with_config(&[*address], Some(rewards_epoch))
.await
{
let reward = &rewards[0];
if let Some(reward) = reward {
let (epoch_start_time, epoch_end_time) =
get_epoch_boundary_timestamps(rpc_client, reward, &epoch_schedule).await?;
if let Some(cli_reward) = make_cli_reward(reward, epoch_start_time, epoch_end_time)
{
all_epoch_rewards.push(cli_reward);
}
}
} else {
PgTerminal::log_wasm(&format!(
"Rewards not available for epoch {}",
rewards_epoch
));
}
num_epochs = num_epochs.saturating_sub(1);
}
Ok(all_epoch_rewards)
}
pub async fn process_show_stake_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
stake_account_address: &Pubkey,
use_lamports_unit: bool,
with_rewards: Option<usize>,
) -> ProcessResult {
let stake_account = rpc_client.get_account(stake_account_address).await?;
if stake_account.owner != stake::program::id() {
return Err(CliError::RpcRequestError(format!(
"{:?} is not a stake account",
stake_account_address,
))
.into());
}
match stake_account.state() {
Ok(stake_state) => {
let stake_history_account = rpc_client.get_account(&stake_history::id()).await?;
let stake_history = from_account(&stake_history_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize stake history".to_string())
})?;
let clock_account = rpc_client.get_account(&clock::id()).await?;
let clock: Clock = from_account(&clock_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize clock sysvar".to_string())
})?;
let mut state = build_stake_state(
stake_account.lamports,
&stake_state,
use_lamports_unit,
&stake_history,
&clock,
);
if state.stake_type == CliStakeType::Stake && state.activation_epoch.is_some() {
// NOTE: async closures are unstable
// let epoch_rewards = with_rewards.and_then(|num_epochs| {
// match fetch_epoch_rewards(rpc_client, stake_account_address, num_epochs) {
// Ok(rewards) => Some(rewards),
// Err(error) => {
// PgTerminal::log_wasm("Failed to fetch epoch rewards: {:?}", error);
// None
// }
// }
// });
let epoch_rewards = if with_rewards.is_some() {
match fetch_epoch_rewards(
rpc_client,
stake_account_address,
with_rewards.unwrap(),
)
.await
{
Ok(rewards) => Some(rewards),
Err(error) => {
PgTerminal::log_wasm(&format!(
"Failed to fetch epoch rewards: {:?}",
error
));
None
}
}
} else {
None
};
state.epoch_rewards = epoch_rewards;
}
Ok(config.output_format.formatted_string(&state))
}
Err(err) => Err(CliError::RpcRequestError(format!(
"Account data could not be deserialized to stake state: {}",
err
))
.into()),
}
}
pub async fn process_show_stake_history(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
use_lamports_unit: bool,
limit_results: usize,
) -> ProcessResult {
let stake_history_account = rpc_client.get_account(&stake_history::id()).await?;
let stake_history =
from_account::<StakeHistory, _>(&stake_history_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize stake history".to_string())
})?;
let limit_results = match config.output_format {
OutputFormat::Json | OutputFormat::JsonCompact => usize::MAX,
_ => {
if limit_results == 0 {
usize::MAX
} else {
limit_results
}
}
};
let mut entries: Vec<CliStakeHistoryEntry> = vec![];
for entry in stake_history.deref().iter().take(limit_results) {
entries.push(entry.into());
}
let stake_history_output = CliStakeHistory {
entries,
use_lamports_unit,
};
Ok(config.output_format.formatted_string(&stake_history_output))
}
// #[allow(clippy::too_many_arguments)]
// pub fn process_delegate_stake(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// stake_account_pubkey: &Pubkey,
// vote_account_pubkey: &Pubkey,
// stake_authority: SignerIndex,
// force: bool,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// check_unique_pubkeys(
// (&config.signers[0].pubkey(), "cli keypair".to_string()),
// (stake_account_pubkey, "stake_account_pubkey".to_string()),
// )?;
// let stake_authority = config.signers[stake_authority];
// if !sign_only {
// // Sanity check the vote account to ensure it is attached to a validator that has recently
// // voted at the tip of the ledger
// let vote_account_data = rpc_client
// .get_account(vote_account_pubkey)
// .map_err(|err| {
// CliError::RpcRequestError(format!(
// "Vote account not found: {}. error: {}",
// vote_account_pubkey, err,
// ))
// })?
// .data;
// let vote_state = VoteState::deserialize(&vote_account_data).map_err(|_| {
// CliError::RpcRequestError(
// "Account data could not be deserialized to vote state".to_string(),
// )
// })?;
// let sanity_check_result = match vote_state.root_slot {
// None => Err(CliError::BadParameter(
// "Unable to delegate. Vote account has no root slot".to_string(),
// )),
// Some(root_slot) => {
// let min_root_slot = rpc_client
// .get_slot()?
// .saturating_sub(DELINQUENT_VALIDATOR_SLOT_DISTANCE);
// if root_slot < min_root_slot {
// Err(CliError::DynamicProgramError(format!(
// "Unable to delegate. Vote account appears delinquent \
// because its current root slot, {}, is less than {}",
// root_slot, min_root_slot
// )))
// } else {
// Ok(())
// }
// }
// };
// if let Err(err) = &sanity_check_result {
// if !force {
// sanity_check_result?;
// } else {
// println!("--force supplied, ignoring: {}", err);
// }
// }
// }
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
// let ixs = vec![stake_instruction::delegate_stake(
// stake_account_pubkey,
// &stake_authority.pubkey(),
// vote_account_pubkey,
// )]
// .with_memo(memo);
// let nonce_authority = config.signers[nonce_authority];
// let fee_payer = config.signers[fee_payer];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment,
// )?;
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
// log_instruction_custom_error::<StakeError>(result, config)
// }
// }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/cluster_query.rs
|
use std::{
collections::{BTreeMap, HashMap},
fmt,
rc::Rc,
str::FromStr,
time::Duration,
};
use clap::{Arg, ArgMatches, Command};
use serde::{Deserialize, Serialize};
use solana_clap_v3_utils_wasm::{
input_parsers::{pubkey_of_signer, pubkeys_of_multiple_signers, value_of},
input_validators::is_slot,
};
use solana_cli_output_wasm::{
cli_output::{
build_balance_message, format_labeled_address, println_transaction,
unix_timestamp_to_string, writeln_name_value, CliAccountBalances, CliBlock,
CliBlockProduction, CliBlockProductionEntry, CliBlockTime, CliEpochInfo,
CliKeyedStakeState, CliSlotStatus, CliStakeVec, CliSupply, CliValidator, CliValidators,
CliValidatorsSortOrder, CliValidatorsStakeByVersion, OutputFormat, QuietDisplay,
VerboseDisplay,
},
cli_version::CliVersion,
};
use solana_client_wasm::{
utils::{
rpc_config::{
GetConfirmedSignaturesForAddress2Config, RpcAccountInfoConfig, RpcBlockConfig,
RpcGetVoteAccountsConfig, RpcLargestAccountsConfig, RpcLargestAccountsFilter,
RpcProgramAccountsConfig, RpcTransactionConfig,
},
rpc_filter::{Memcmp, MemcmpEncodedBytes, MemcmpEncoding, RpcFilterType},
rpc_request::DELINQUENT_VALIDATOR_SLOT_DISTANCE,
},
WasmClient,
};
use solana_extra_wasm::{
account_decoder::UiAccountEncoding, program::vote::vote_state::VoteState,
transaction_status::UiTransactionEncoding,
};
use solana_playground_utils_wasm::js::PgTerminal;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
account::from_account,
account_utils::StateMut,
clock::{self, Clock, Slot},
commitment_config::CommitmentConfig,
epoch_schedule::Epoch,
native_token::lamports_to_sol,
nonce::State as NonceState,
pubkey::Pubkey,
rent::Rent,
signature::Signature,
slot_history,
stake::{self, state::StakeStateV2},
sysvar::{
self,
slot_history::SlotHistory,
stake_history::{self},
},
timing,
};
use thiserror::Error;
use crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult};
pub trait ClusterQuerySubCommands {
fn cluster_query_subcommands(self) -> Self;
}
impl ClusterQuerySubCommands for Command<'_> {
fn cluster_query_subcommands(self) -> Self {
self.subcommand(
Command::new("block").about("Get a confirmed block").arg(
Arg::new("slot")
.validator(is_slot)
.index(1)
.takes_value(true)
.value_name("SLOT")
.help("Slot number of the block to query"),
),
)
// .subcommand(
// Command::new("catchup")
// .about("Wait for a validator to catch up to the cluster")
// .arg(
// pubkey!(Arg::new("node_pubkey")
// .index(1)
// .value_name("OUR_VALIDATOR_PUBKEY")
// .required(false),
// "Identity pubkey of the validator"),
// )
// .arg(
// Arg::new("node_json_rpc_url")
// .index(2)
// .value_name("OUR_URL")
// .takes_value(true)
// .validator(is_url)
// .help("JSON RPC URL for validator, which is useful for validators with a private RPC service")
// )
// .arg(
// Arg::new("follow")
// .long("follow")
// .takes_value(false)
// .help("Continue reporting progress even after the validator has caught up"),
// )
// .arg(
// Arg::new("our_localhost")
// .long("our-localhost")
// .takes_value(false)
// .value_name("PORT")
// .default_value(DEFAULT_RPC_PORT_STR)
// .validator(is_port)
// .help("Guess Identity pubkey and validator rpc node assuming local (possibly private) validator"),
// )
// .arg(
// Arg::new("log")
// .long("log")
// .takes_value(false)
// .help("Don't update the progress inplace; instead show updates with its own new lines"),
// ),
// )
.subcommand(Command::new("cluster-date").about(
"Get current cluster date, computed from genesis creation time and network time",
))
.subcommand(
Command::new("cluster-version").about("Get the version of the cluster entrypoint"),
)
// // Deprecated in v1.8.0
// .subcommand(
// Command::new("fees")
// .about("Display current cluster fees (Deprecated in v1.8.0)")
// .arg(
// Arg::new("blockhash")
// .long("blockhash")
// .takes_value(true)
// .value_name("BLOCKHASH")
// .validator(is_hash)
// .help("Query fees for BLOCKHASH instead of the most recent blockhash")
// ),
// )
.subcommand(
Command::new("first-available-block")
.about("Get the first available block in the storage"),
)
.subcommand(
Command::new("block-time")
.about("Get estimated production time of a block")
.alias("get-block-time")
.arg(
Arg::new("slot")
.index(1)
.takes_value(true)
.value_name("SLOT")
.help("Slot number of the block to query"),
),
)
// .subcommand(Command::new("leader-schedule")
// .about("Display leader schedule")
// .arg(
// Arg::new("epoch")
// .long("epoch")
// .takes_value(true)
// .value_name("EPOCH")
// .validator(is_epoch)
// .help("Epoch to show leader schedule for. [default: current]")
// )
// )
.subcommand(
Command::new("epoch-info")
.about("Get information about the current epoch")
.alias("get-epoch-info"),
)
.subcommand(
Command::new("genesis-hash")
.about("Get the genesis hash")
.alias("get-genesis-hash"),
)
.subcommand(
Command::new("slot")
.about("Get current slot")
.alias("get-slot"),
)
.subcommand(Command::new("block-height").about("Get current block height"))
.subcommand(Command::new("epoch").about("Get current epoch"))
.subcommand(
Command::new("largest-accounts")
.about("Get addresses of largest cluster accounts")
.arg(
Arg::new("circulating")
.long("circulating")
.takes_value(false)
.help("Filter address list to only circulating accounts"),
)
.arg(
Arg::new("non_circulating")
.long("non-circulating")
.takes_value(false)
.conflicts_with("circulating")
.help("Filter address list to only non-circulating accounts"),
),
)
.subcommand(
Command::new("supply")
.about("Get information about the cluster supply of SOL")
.arg(
Arg::new("print_accounts")
.long("print-accounts")
.takes_value(false)
.help("Print list of non-circulating account addresses"),
),
)
.subcommand(Command::new("total-supply").about("Get total number of SOL"))
.subcommand(
Command::new("transaction-count")
.about("Get current transaction count")
.alias("get-transaction-count"),
)
// .subcommand(
// Command::new("ping")
// .about("Submit transactions sequentially")
// .arg(
// Arg::new("interval")
// .short("i")
// .long("interval")
// .value_name("SECONDS")
// .takes_value(true)
// .default_value("2")
// .help("Wait interval seconds between submitting the next transaction"),
// )
// .arg(
// Arg::new("count")
// .short("c")
// .long("count")
// .value_name("NUMBER")
// .takes_value(true)
// .help("Stop after submitting count transactions"),
// )
// .arg(
// Arg::new("print_timestamp")
// .short("D")
// .long("print-timestamp")
// .takes_value(false)
// .help("Print timestamp (unix time + microseconds as in gettimeofday) before each line"),
// )
// .arg(
// Arg::new("timeout")
// .short("t")
// .long("timeout")
// .value_name("SECONDS")
// .takes_value(true)
// .default_value("15")
// .help("Wait up to timeout seconds for transaction confirmation"),
// )
// .arg(
// Arg::new("compute_unit_price")
// .long("compute-unit-price")
// .value_name("MICRO-LAMPORTS")
// .takes_value(true)
// .help("Set the price in micro-lamports of each transaction compute unit"),
// )
// .arg(blockhash_arg()),
// )
// .subcommand(
// Command::new("live-slots")
// .about("Show information about the current slot progression"),
// )
// .subcommand(
// Command::new("logs")
// .about("Stream transaction logs")
// .arg(
// pubkey!(Arg::new("address")
// .index(1)
// .value_name("ADDRESS"),
// "Account address to monitor \
// [default: monitor all transactions except for votes] \
// ")
// )
// .arg(
// Arg::new("include_votes")
// .long("include-votes")
// .takes_value(false)
// .conflicts_with("address")
// .help("Include vote transactions when monitoring all transactions")
// ),
// )
.subcommand(
Command::new("block-production")
.about("Show information about block production")
.alias("show-block-production")
.arg(
Arg::new("epoch")
.long("epoch")
.takes_value(true)
.help("Epoch to show block production for [default: current epoch]"),
)
.arg(
Arg::new("slot_limit")
.long("slot-limit")
.takes_value(true)
.help("Limit results to this many slots from the end of the epoch [default: full epoch]"),
),
)
// .subcommand(
// Command::new("gossip")
// .about("Show the current gossip network nodes")
// .alias("show-gossip")
// )
.subcommand(
Command::new("stakes")
.about("Show stake account information")
.arg(
pubkey!(Arg::new("vote_account_pubkeys")
.index(1)
.value_name("VOTE_ACCOUNT_PUBKEYS")
.multiple_occurrences(true),
"Only show stake accounts delegated to the provided vote accounts. "),
)
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
),
)
.subcommand(
Command::new("validators")
.about("Show summary information about the current validators")
.alias("show-validators")
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
)
.arg(
Arg::new("number")
.long("number")
.short('n')
.takes_value(false)
.help("Number the validators"),
)
.arg(
Arg::new("reverse")
.long("reverse")
.short('r')
.takes_value(false)
.help("Reverse order while sorting"),
)
.arg(
Arg::new("sort")
.long("sort")
.takes_value(true)
.possible_values([
"delinquent",
"commission",
"credits",
"identity",
"last-vote",
"root",
"skip-rate",
"stake",
"version",
"vote-account",
])
.default_value("stake")
.help("Sort order (does not affect JSON output)"),
)
.arg(
Arg::new("keep_unstaked_delinquents")
.long("keep-unstaked-delinquents")
.takes_value(false)
.help("Don't discard unstaked, delinquent validators")
)
.arg(
Arg::new("delinquent_slot_distance")
.long("delinquent-slot-distance")
.takes_value(true)
.value_name("SLOT_DISTANCE")
.validator(is_slot)
.help(
concatcp!(
"Minimum slot distance from the tip to consider a validator delinquent. [default: ",
DELINQUENT_VALIDATOR_SLOT_DISTANCE,
"]",
))
),
)
.subcommand(
Command::new("transaction-history")
.about(
"Show historical transactions affecting the given address \
from newest to oldest",
)
.arg(pubkey!(
Arg::new("address")
.index(1)
.value_name("ADDRESS")
.required(true),
"Account address"
))
.arg(
Arg::new("limit")
.long("limit")
.takes_value(true)
.value_name("LIMIT")
.validator(is_slot)
.default_value("1000")
.help("Maximum number of transaction signatures to return"),
)
.arg(
Arg::new("before")
.long("before")
.value_name("TRANSACTION_SIGNATURE")
.takes_value(true)
.help("Start with the first signature older than this one"),
)
.arg(
Arg::new("show_transactions")
.long("show-transactions")
.takes_value(false)
.help("Display the full transactions"),
),
)
// .subcommand(
// Command::new("wait-for-max-stake")
// .about("Wait for the max stake of any one node to drop below a percentage of total.")
// .arg(
// Arg::new("max_percent")
// .long("max-percent")
// .value_name("PERCENT")
// .takes_value(true)
// .index(1),
// ),
// )
.subcommand(
Command::new("rent")
.about("Calculate per-epoch and rent-exempt-minimum values for a given account data field length.")
.arg(
Arg::new("data_length")
.index(1)
.value_name("DATA_LENGTH_OR_MONIKER")
.required(true)
.validator(|s| {
RentLengthValue::from_str(s)
.map(|_| ())
.map_err(|e| e.to_string())
})
.help("Length of data field in the account to calculate rent for, or moniker: [nonce, stake, system, vote]"),
)
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display rent in lamports instead of SOL"),
),
)
}
}
// pub fn parse_catchup(
// matches: &ArgMatches,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let node_pubkey = pubkey_of_signer(matches, "node_pubkey", wallet_manager)?;
// let mut our_localhost_port = value_t!(matches, "our_localhost", u16).ok();
// // if there is no explicitly specified --our-localhost,
// // disable the guess mode (= our_localhost_port)
// if matches.occurrences_of("our_localhost") == 0 {
// our_localhost_port = None
// }
// let node_json_rpc_url = value_t!(matches, "node_json_rpc_url", String).ok();
// // requirement of node_pubkey is relaxed only if our_localhost_port
// if our_localhost_port.is_none() && node_pubkey.is_none() {
// return Err(CliError::BadParameter(
// "OUR_VALIDATOR_PUBKEY (and possibly OUR_URL) must be specified \
// unless --our-localhost is given"
// .into(),
// ));
// }
// let follow = matches.is_present("follow");
// let log = matches.is_present("log");
// Ok(CliCommandInfo {
// command: CliCommand::Catchup {
// node_pubkey,
// node_json_rpc_url,
// follow,
// our_localhost_port,
// log,
// },
// signers: vec![],
// })
// }
// pub fn parse_cluster_ping(
// matches: &ArgMatches,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let interval = Duration::from_secs(value_t_or_exit!(matches, "interval", u64));
// let count = if matches.is_present("count") {
// Some(value_t_or_exit!(matches, "count", u64))
// } else {
// None
// };
// let timeout = Duration::from_secs(value_t_or_exit!(matches, "timeout", u64));
// let blockhash = value_of(matches, BLOCKHASH_ARG.name);
// let print_timestamp = matches.is_present("print_timestamp");
// let compute_unit_price = value_of(matches, "compute_unit_price");
// Ok(CliCommandInfo {
// command: CliCommand::Ping {
// interval,
// count,
// timeout,
// blockhash,
// print_timestamp,
// compute_unit_price,
// },
// signers: vec![default_signer.signer_from_path(matches, wallet_manager)?],
// })
// }
pub fn parse_get_block(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let slot = value_of(matches, "slot");
Ok(CliCommandInfo {
command: CliCommand::GetBlock { slot },
signers: vec![],
})
}
pub fn parse_get_block_time(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let slot = value_of(matches, "slot");
Ok(CliCommandInfo {
command: CliCommand::GetBlockTime { slot },
signers: vec![],
})
}
pub fn parse_get_epoch(_matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
Ok(CliCommandInfo {
command: CliCommand::GetEpoch,
signers: vec![],
})
}
pub fn parse_get_epoch_info(_matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
Ok(CliCommandInfo {
command: CliCommand::GetEpochInfo,
signers: vec![],
})
}
pub fn parse_get_slot(_matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
Ok(CliCommandInfo {
command: CliCommand::GetSlot,
signers: vec![],
})
}
pub fn parse_get_block_height(_matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
Ok(CliCommandInfo {
command: CliCommand::GetBlockHeight,
signers: vec![],
})
}
pub fn parse_largest_accounts(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let filter = if matches.is_present("circulating") {
Some(RpcLargestAccountsFilter::Circulating)
} else if matches.is_present("non_circulating") {
Some(RpcLargestAccountsFilter::NonCirculating)
} else {
None
};
Ok(CliCommandInfo {
command: CliCommand::LargestAccounts { filter },
signers: vec![],
})
}
pub fn parse_supply(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let print_accounts = matches.is_present("print_accounts");
Ok(CliCommandInfo {
command: CliCommand::Supply { print_accounts },
signers: vec![],
})
}
pub fn parse_total_supply(_matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
Ok(CliCommandInfo {
command: CliCommand::TotalSupply,
signers: vec![],
})
}
pub fn parse_get_transaction_count(_matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
Ok(CliCommandInfo {
command: CliCommand::GetTransactionCount,
signers: vec![],
})
}
pub fn parse_show_stakes(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let use_lamports_unit = matches.is_present("lamports");
let vote_account_pubkeys =
pubkeys_of_multiple_signers(matches, "vote_account_pubkeys", wallet_manager)?;
Ok(CliCommandInfo {
command: CliCommand::ShowStakes {
use_lamports_unit,
vote_account_pubkeys,
},
signers: vec![],
})
}
pub fn parse_show_validators(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let use_lamports_unit = matches.is_present("lamports");
let number_validators = matches.is_present("number");
let reverse_sort = matches.is_present("reverse");
let keep_unstaked_delinquents = matches.is_present("keep_unstaked_delinquents");
let delinquent_slot_distance = value_of(matches, "delinquent_slot_distance");
let sort_order = match matches.value_of_t_or_exit::<String>("sort").as_str() {
"delinquent" => CliValidatorsSortOrder::Delinquent,
"commission" => CliValidatorsSortOrder::Commission,
"credits" => CliValidatorsSortOrder::EpochCredits,
"identity" => CliValidatorsSortOrder::Identity,
"last-vote" => CliValidatorsSortOrder::LastVote,
"root" => CliValidatorsSortOrder::Root,
"skip-rate" => CliValidatorsSortOrder::SkipRate,
"stake" => CliValidatorsSortOrder::Stake,
"vote-account" => CliValidatorsSortOrder::VoteAccount,
"version" => CliValidatorsSortOrder::Version,
_ => unreachable!(),
};
Ok(CliCommandInfo {
command: CliCommand::ShowValidators {
use_lamports_unit,
sort_order,
reverse_sort,
number_validators,
keep_unstaked_delinquents,
delinquent_slot_distance,
},
signers: vec![],
})
}
pub fn parse_transaction_history(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let address = pubkey_of_signer(matches, "address", wallet_manager)?.unwrap();
let before = match matches.value_of("before") {
Some(signature) => Some(
signature
.parse()
.map_err(|err| CliError::BadParameter(format!("Invalid signature: {}", err)))?,
),
None => None,
};
let until = match matches.value_of("until") {
Some(signature) => Some(
signature
.parse()
.map_err(|err| CliError::BadParameter(format!("Invalid signature: {}", err)))?,
),
None => None,
};
let limit = matches.value_of_t_or_exit::<usize>("limit");
let show_transactions = matches.is_present("show_transactions");
Ok(CliCommandInfo {
command: CliCommand::TransactionHistory {
address,
before,
until,
limit,
show_transactions,
},
signers: vec![],
})
}
// pub fn process_catchup(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// node_pubkey: Option<Pubkey>,
// mut node_json_rpc_url: Option<String>,
// follow: bool,
// our_localhost_port: Option<u16>,
// log: bool,
// ) -> ProcessResult {
// let sleep_interval = 5;
// let progress_bar = new_spinner_progress_bar();
// progress_bar.set_message("Connecting...");
// if let Some(our_localhost_port) = our_localhost_port {
// let gussed_default = Some(format!("http://localhost:{}", our_localhost_port));
// if node_json_rpc_url.is_some() && node_json_rpc_url != gussed_default {
// // go to new line to leave this message on console
// PgTerminal::log_wasm(
// "Preferring explicitly given rpc ({}) as us, \
// although --our-localhost is given\n",
// node_json_rpc_url.as_ref().unwrap()
// );
// } else {
// node_json_rpc_url = gussed_default;
// }
// }
// let (node_client, node_pubkey) = if our_localhost_port.is_some() {
// let client = WasmClient::new(node_json_rpc_url.unwrap());
// let guessed_default = Some(client.get_identity()?);
// (
// client,
// (if node_pubkey.is_some() && node_pubkey != guessed_default {
// // go to new line to leave this message on console
// PgTerminal::log_wasm(
// "Preferring explicitly given node pubkey ({}) as us, \
// although --our-localhost is given\n",
// node_pubkey.unwrap()
// );
// node_pubkey
// } else {
// guessed_default
// })
// .unwrap(),
// )
// } else if let Some(node_pubkey) = node_pubkey {
// if let Some(node_json_rpc_url) = node_json_rpc_url {
// (WasmClient::new(node_json_rpc_url), node_pubkey)
// } else {
// let rpc_addr = loop {
// let cluster_nodes = rpc_client.get_cluster_nodes()?;
// if let Some(contact_info) = cluster_nodes
// .iter()
// .find(|contact_info| contact_info.pubkey == node_pubkey.to_string())
// {
// if let Some(rpc_addr) = contact_info.rpc {
// break rpc_addr;
// }
// progress_bar.set_message(format!("RPC service not found for {}", node_pubkey));
// } else {
// progress_bar
// .set_message(format!("Contact information not found for {}", node_pubkey));
// }
// sleep(Duration::from_secs(sleep_interval as u64));
// };
// (WasmClient::new_socket(rpc_addr), node_pubkey)
// }
// } else {
// unreachable!()
// };
// let reported_node_pubkey = loop {
// match node_client.get_identity() {
// Ok(reported_node_pubkey) => break reported_node_pubkey,
// Err(err) => {
// if let ClientErrorKind::Reqwest(err) = err.kind() {
// progress_bar.set_message(format!("Connection failed: {}", err));
// sleep(Duration::from_secs(sleep_interval as u64));
// continue;
// }
// return Err(Box::new(err));
// }
// }
// };
// if reported_node_pubkey != node_pubkey {
// return Err(format!(
// "The identity reported by node RPC URL does not match. Expected: {:?}. Reported: {:?}",
// node_pubkey, reported_node_pubkey
// )
// .into());
// }
// if rpc_client.get_identity()? == node_pubkey {
// return Err("Both RPC URLs reference the same node, unable to monitor for catchup. Try a different --url".into());
// }
// let mut previous_rpc_slot = std::u64::MAX;
// let mut previous_slot_distance = 0;
// let mut retry_count = 0;
// let max_retry_count = 5;
// let mut get_slot_while_retrying = |client: &WasmClient| {
// loop {
// match client.get_slot_with_commitment(config.commitment) {
// Ok(r) => {
// retry_count = 0;
// return Ok(r);
// }
// Err(e) => {
// if retry_count >= max_retry_count {
// return Err(e);
// }
// retry_count += 1;
// if log {
// // go to new line to leave this message on console
// PgTerminal::log_wasm("Retrying({}/{}): {}\n", retry_count, max_retry_count, e);
// }
// sleep(Duration::from_secs(1));
// }
// };
// }
// };
// let start_node_slot = get_slot_while_retrying(&node_client)?;
// let start_rpc_slot = get_slot_while_retrying(rpc_client)?;
// let start_slot_distance = start_rpc_slot as i64 - start_node_slot as i64;
// let mut total_sleep_interval = 0;
// loop {
// // humbly retry; the reference node (rpc_client) could be spotty,
// // especially if pointing to api.meinnet-beta.solana.com at times
// let rpc_slot = get_slot_while_retrying(rpc_client)?;
// let node_slot = get_slot_while_retrying(&node_client)?;
// if !follow && node_slot > std::cmp::min(previous_rpc_slot, rpc_slot) {
// progress_bar.finish_and_clear();
// return Ok(format!(
// "{} has caught up (us:{} them:{})",
// node_pubkey, node_slot, rpc_slot,
// ));
// }
// let slot_distance = rpc_slot as i64 - node_slot as i64;
// let slots_per_second =
// (previous_slot_distance - slot_distance) as f64 / f64::from(sleep_interval);
// let average_time_remaining = if slot_distance == 0 || total_sleep_interval == 0 {
// "".to_string()
// } else {
// let distance_delta = start_slot_distance as i64 - slot_distance as i64;
// let average_catchup_slots_per_second =
// distance_delta as f64 / f64::from(total_sleep_interval);
// let average_time_remaining =
// (slot_distance as f64 / average_catchup_slots_per_second).round();
// if !average_time_remaining.is_normal() {
// "".to_string()
// } else if average_time_remaining < 0.0 {
// format!(
// " (AVG: {:.1} slots/second (falling))",
// average_catchup_slots_per_second
// )
// } else {
// // important not to miss next scheduled lead slots
// let total_node_slot_delta = node_slot as i64 - start_node_slot as i64;
// let average_node_slots_per_second =
// total_node_slot_delta as f64 / f64::from(total_sleep_interval);
// let expected_finish_slot = (node_slot as f64
// + average_time_remaining as f64 * average_node_slots_per_second as f64)
// .round();
// format!(
// " (AVG: {:.1} slots/second, ETA: slot {} in {})",
// average_catchup_slots_per_second,
// expected_finish_slot,
// humantime::format_duration(Duration::from_secs_f64(average_time_remaining))
// )
// }
// };
// progress_bar.set_message(format!(
// "{} slot(s) {} (us:{} them:{}){}",
// slot_distance.abs(),
// if slot_distance >= 0 {
// "behind"
// } else {
// "ahead"
// },
// node_slot,
// rpc_slot,
// if slot_distance == 0 || previous_rpc_slot == std::u64::MAX {
// "".to_string()
// } else {
// format!(
// ", {} node is {} at {:.1} slots/second{}",
// if slot_distance >= 0 { "our" } else { "their" },
// if slots_per_second < 0.0 {
// "falling behind"
// } else {
// "gaining"
// },
// slots_per_second,
// average_time_remaining
// )
// },
// ));
// if log {
// PgTerminal::log_wasm();
// }
// sleep(Duration::from_secs(sleep_interval as u64));
// previous_rpc_slot = rpc_slot;
// previous_slot_distance = slot_distance;
// total_sleep_interval += sleep_interval;
// }
// }
pub async fn process_cluster_date(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
) -> ProcessResult {
let maybe_account = rpc_client
.get_account_with_commitment(&sysvar::clock::id(), config.commitment_config)
.await?;
let slot = rpc_client.get_slot().await?;
if let Some(clock_account) = maybe_account {
let clock: Clock = from_account(&clock_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize clock sysvar".to_string())
})?;
let block_time = CliBlockTime {
slot,
timestamp: clock.unix_timestamp,
};
Ok(config.output_format.formatted_string(&block_time))
} else {
Err(format!("AccountNotFound: pubkey={}", sysvar::clock::id()).into())
}
}
pub async fn process_cluster_version(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
) -> ProcessResult {
let remote_version = rpc_client.get_version().await?;
if config.verbose {
Ok(format!("{:?}", remote_version))
} else {
Ok(remote_version.to_string())
}
}
// pub fn process_fees(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// blockhash: Option<&Hash>,
// ) -> ProcessResult {
// let fees = if let Some(recent_blockhash) = blockhash {
// #[allow(deprecated)]
// let result = rpc_client.get_fee_calculator_for_blockhash_with_commitment(
// recent_blockhash,
// config.commitment,
// )?;
// if let Some(fee_calculator) = result.value {
// CliFees::some(
// result.context.slot,
// *recent_blockhash,
// fee_calculator.lamports_per_signature,
// None,
// None,
// )
// } else {
// CliFees::none()
// }
// } else {
// #[allow(deprecated)]
// let result = rpc_client.get_fees_with_commitment(config.commitment)?;
// CliFees::some(
// result.context.slot,
// result.value.blockhash,
// result.value.fee_calculator.lamports_per_signature,
// None,
// Some(result.value.last_valid_block_height),
// )
// };
// Ok(config.output_format.formatted_string(&fees))
// }
pub async fn process_first_available_block(rpc_client: &WasmClient) -> ProcessResult {
let first_available_block = rpc_client.get_first_available_block().await?;
Ok(format!("{}", first_available_block))
}
// pub fn parse_leader_schedule(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
// let epoch = value_of(matches, "epoch");
// Ok(CliCommandInfo {
// command: CliCommand::LeaderSchedule { epoch },
// signers: vec![],
// })
// }
// pub fn process_leader_schedule(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// epoch: Option<Epoch>,
// ) -> ProcessResult {
// let epoch_info = rpc_client.get_epoch_info()?;
// let epoch = epoch.unwrap_or(epoch_info.epoch);
// if epoch > epoch_info.epoch {
// return Err(format!("Epoch {} is in the future", epoch).into());
// }
// let epoch_schedule = rpc_client.get_epoch_schedule()?;
// let first_slot_in_epoch = epoch_schedule.get_first_slot_in_epoch(epoch);
// let leader_schedule = rpc_client.get_leader_schedule(Some(first_slot_in_epoch))?;
// if leader_schedule.is_none() {
// return Err(format!(
// "Unable to fetch leader schedule for slot {}",
// first_slot_in_epoch
// )
// .into());
// }
// let leader_schedule = leader_schedule.unwrap();
// let mut leader_per_slot_index = Vec::new();
// for (pubkey, leader_slots) in leader_schedule.iter() {
// for slot_index in leader_slots.iter() {
// if *slot_index >= leader_per_slot_index.len() {
// leader_per_slot_index.resize(*slot_index + 1, "?");
// }
// leader_per_slot_index[*slot_index] = pubkey;
// }
// }
// let mut leader_schedule_entries = vec![];
// for (slot_index, leader) in leader_per_slot_index.iter().enumerate() {
// leader_schedule_entries.push(CliLeaderScheduleEntry {
// slot: first_slot_in_epoch + slot_index as u64,
// leader: leader.to_string(),
// });
// }
// Ok(config.output_format.formatted_string(&CliLeaderSchedule {
// epoch,
// leader_schedule_entries,
// }))
// }
pub async fn process_get_block(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
slot: Option<Slot>,
) -> ProcessResult {
let slot = if let Some(slot) = slot {
slot
} else {
rpc_client
.get_slot_with_commitment(CommitmentConfig::finalized())
.await?
};
let encoded_confirmed_block = rpc_client
.get_block_with_config(
slot,
RpcBlockConfig {
encoding: Some(UiTransactionEncoding::Base64),
commitment: Some(CommitmentConfig::confirmed()),
max_supported_transaction_version: Some(0),
..RpcBlockConfig::default()
},
)
.await?
.into();
let cli_block = CliBlock {
encoded_confirmed_block,
slot,
};
Ok(config.output_format.formatted_string(&cli_block))
}
pub async fn process_get_block_time(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
slot: Option<Slot>,
) -> ProcessResult {
let slot = if let Some(slot) = slot {
slot
} else {
rpc_client
.get_slot_with_commitment(CommitmentConfig::finalized())
.await?
};
let timestamp = rpc_client.get_block_time(slot).await?;
let block_time = CliBlockTime { slot, timestamp };
Ok(config.output_format.formatted_string(&block_time))
}
pub async fn process_get_epoch(rpc_client: &WasmClient, _config: &CliConfig<'_>) -> ProcessResult {
let epoch_info = rpc_client.get_epoch_info().await?;
Ok(epoch_info.epoch.to_string())
}
pub async fn process_get_epoch_info(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
) -> ProcessResult {
let epoch_info = rpc_client.get_epoch_info().await?;
let mut cli_epoch_info = CliEpochInfo {
epoch_info,
average_slot_time_ms: 0,
start_block_time: None,
current_block_time: None,
};
match config.output_format {
OutputFormat::Json | OutputFormat::JsonCompact => {}
_ => {
let epoch_info = cli_epoch_info.epoch_info.clone();
let average_slot_time_ms = rpc_client
.get_recent_performance_samples(Some(60))
.await
.ok()
.and_then(|samples| {
let (slots, secs) = samples.iter().fold((0, 0), |(slots, secs), sample| {
(slots + sample.num_slots, secs + sample.sample_period_secs)
});
(secs as u64).saturating_mul(1000).checked_div(slots)
})
.unwrap_or(clock::DEFAULT_MS_PER_SLOT);
let epoch_expected_start_slot = epoch_info.absolute_slot - epoch_info.slot_index;
let first_block_in_epoch = rpc_client
.get_blocks_with_limit(epoch_expected_start_slot, 1)
.await
.ok()
.and_then(|slot_vec| slot_vec.first().cloned())
.unwrap_or(epoch_expected_start_slot);
let start_block_time = rpc_client
.get_block_time(first_block_in_epoch)
.await
.ok()
.map(|time| {
time + (((first_block_in_epoch - epoch_expected_start_slot)
* average_slot_time_ms)
/ 1000) as i64
});
let current_block_time = rpc_client
.get_block_time(epoch_info.absolute_slot)
.await
.ok();
cli_epoch_info.average_slot_time_ms = average_slot_time_ms;
cli_epoch_info.start_block_time = start_block_time;
cli_epoch_info.current_block_time = current_block_time;
}
}
Ok(config.output_format.formatted_string(&cli_epoch_info))
}
pub async fn process_get_genesis_hash(rpc_client: &WasmClient) -> ProcessResult {
let genesis_hash = rpc_client.get_genesis_hash().await?;
Ok(genesis_hash.to_string())
}
pub async fn process_get_slot(rpc_client: &WasmClient, _config: &CliConfig<'_>) -> ProcessResult {
let slot = rpc_client.get_slot().await?;
Ok(slot.to_string())
}
pub async fn process_get_block_height(
rpc_client: &WasmClient,
_config: &CliConfig<'_>,
) -> ProcessResult {
let block_height = rpc_client.get_block_height().await?;
Ok(block_height.to_string())
}
pub fn parse_show_block_production(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let epoch = matches.value_of_t::<Epoch>("epoch").ok();
let slot_limit = matches.value_of_t::<u64>("slot_limit").ok();
Ok(CliCommandInfo {
command: CliCommand::ShowBlockProduction { epoch, slot_limit },
signers: vec![],
})
}
pub async fn process_show_block_production(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
epoch: Option<Epoch>,
slot_limit: Option<u64>,
) -> ProcessResult {
let epoch_schedule = rpc_client.get_epoch_schedule().await?;
let epoch_info = rpc_client
.get_epoch_info_with_commitment(CommitmentConfig::finalized())
.await?;
let epoch = epoch.unwrap_or(epoch_info.epoch);
if epoch > epoch_info.epoch {
return Err(format!("Epoch {} is in the future", epoch).into());
}
let first_slot_in_epoch = epoch_schedule.get_first_slot_in_epoch(epoch);
let end_slot = std::cmp::min(
epoch_info.absolute_slot,
epoch_schedule.get_last_slot_in_epoch(epoch),
);
let mut start_slot = if let Some(slot_limit) = slot_limit {
std::cmp::max(end_slot.saturating_sub(slot_limit), first_slot_in_epoch)
} else {
first_slot_in_epoch
};
// let progress_bar = new_spinner_progress_bar();
// progress_bar.set_message(format!(
// "Fetching confirmed blocks between slots {} and {}...",
// start_slot, end_slot
// ));
let slot_history_account = rpc_client
.get_account_with_commitment(&sysvar::slot_history::id(), CommitmentConfig::finalized())
.await?
.unwrap();
let slot_history: SlotHistory = from_account(&slot_history_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize slot history".to_string())
})?;
let (confirmed_blocks, start_slot) =
if start_slot >= slot_history.oldest() && end_slot <= slot_history.newest() {
// Fast, more reliable path using the SlotHistory sysvar
let confirmed_blocks: Vec<_> = (start_slot..=end_slot)
.filter(|slot| slot_history.check(*slot) == slot_history::Check::Found)
.collect();
(confirmed_blocks, start_slot)
} else {
// Slow, less reliable path using `getBlocks`.
//
// "less reliable" because if the RPC node has holds in its ledger then the block production data will be
// incorrect. This condition currently can't be detected over RPC
//
let minimum_ledger_slot = rpc_client.minimum_ledger_slot().await?;
if minimum_ledger_slot > end_slot {
return Err(format!(
"Ledger data not available for slots {} to {} (minimum ledger slot is {})",
start_slot, end_slot, minimum_ledger_slot
)
.into());
}
if minimum_ledger_slot > start_slot {
// progress_bar.println(format!(
// "{}",
// style(format!(
// "Note: Requested start slot was {} but minimum ledger slot is {}",
// start_slot, minimum_ledger_slot
// ))
// .italic(),
// ));
start_slot = minimum_ledger_slot;
}
let confirmed_blocks = rpc_client.get_blocks(start_slot, Some(end_slot)).await?;
(confirmed_blocks, start_slot)
};
let start_slot_index = (start_slot - first_slot_in_epoch) as usize;
let end_slot_index = (end_slot - first_slot_in_epoch) as usize;
let total_slots = end_slot_index - start_slot_index + 1;
let total_blocks_produced = confirmed_blocks.len();
assert!(total_blocks_produced <= total_slots);
let total_slots_skipped = total_slots - total_blocks_produced;
let mut leader_slot_count = HashMap::new();
let mut leader_skipped_slots = HashMap::new();
// progress_bar.set_message(format!("Fetching leader schedule for epoch {}...", epoch));
let leader_schedule = rpc_client
.get_leader_schedule_with_commitment(Some(start_slot), CommitmentConfig::finalized())
.await?;
if leader_schedule.is_none() {
return Err(format!("Unable to fetch leader schedule for slot {}", start_slot).into());
}
let leader_schedule = leader_schedule.unwrap();
let mut leader_per_slot_index = Vec::new();
leader_per_slot_index.resize(total_slots, "?".to_string());
for (pubkey, leader_slots) in leader_schedule.iter() {
let pubkey = format_labeled_address(pubkey, &config.address_labels);
for slot_index in leader_slots.iter() {
if *slot_index >= start_slot_index && *slot_index <= end_slot_index {
leader_per_slot_index[*slot_index - start_slot_index].clone_from(&pubkey);
}
}
}
// progress_bar.set_message(format!(
// "Processing {} slots containing {} blocks and {} empty slots...",
// total_slots, total_blocks_produced, total_slots_skipped
// ));
let mut confirmed_blocks_index = 0;
let mut individual_slot_status = vec![];
for (slot_index, leader) in leader_per_slot_index.iter().enumerate() {
let slot = start_slot + slot_index as u64;
let slot_count = leader_slot_count.entry(leader).or_insert(0);
*slot_count += 1;
let skipped_slots = leader_skipped_slots.entry(leader).or_insert(0);
loop {
if confirmed_blocks_index < confirmed_blocks.len() {
let slot_of_next_confirmed_block = confirmed_blocks[confirmed_blocks_index];
if slot_of_next_confirmed_block < slot {
confirmed_blocks_index += 1;
continue;
}
if slot_of_next_confirmed_block == slot {
individual_slot_status.push(CliSlotStatus {
slot,
leader: (*leader).to_string(),
skipped: false,
});
break;
}
}
*skipped_slots += 1;
individual_slot_status.push(CliSlotStatus {
slot,
leader: (*leader).to_string(),
skipped: true,
});
break;
}
}
// progress_bar.finish_and_clear();
let mut leaders: Vec<CliBlockProductionEntry> = leader_slot_count
.iter()
.map(|(leader, leader_slots)| {
let skipped_slots = leader_skipped_slots.get(leader).unwrap();
let blocks_produced = leader_slots - skipped_slots;
CliBlockProductionEntry {
identity_pubkey: (**leader).to_string(),
leader_slots: *leader_slots,
blocks_produced,
skipped_slots: *skipped_slots,
}
})
.collect();
leaders.sort_by(|a, b| a.identity_pubkey.partial_cmp(&b.identity_pubkey).unwrap());
let block_production = CliBlockProduction {
epoch,
start_slot,
end_slot,
total_slots,
total_blocks_produced,
total_slots_skipped,
leaders,
individual_slot_status,
verbose: config.verbose,
};
Ok(config.output_format.formatted_string(&block_production))
}
pub async fn process_largest_accounts(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
filter: Option<RpcLargestAccountsFilter>,
) -> ProcessResult {
let accounts = rpc_client
.get_largest_accounts_with_config(RpcLargestAccountsConfig {
commitment: Some(config.commitment_config),
filter,
})
.await?;
let largest_accounts = CliAccountBalances { accounts };
Ok(config.output_format.formatted_string(&largest_accounts))
}
pub async fn process_supply(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
print_accounts: bool,
) -> ProcessResult {
let client_supply_response = rpc_client.get_supply().await?;
let mut supply: CliSupply = client_supply_response.into();
supply.print_accounts = print_accounts;
Ok(config.output_format.formatted_string(&supply))
}
pub async fn process_total_supply(
rpc_client: &WasmClient,
_config: &CliConfig<'_>,
) -> ProcessResult {
let supply = rpc_client.get_supply().await?;
Ok(format!("{} SOL", lamports_to_sol(supply.total)))
}
pub async fn process_get_transaction_count(
rpc_client: &WasmClient,
_config: &CliConfig<'_>,
) -> ProcessResult {
let transaction_count = rpc_client.get_transaction_count().await?;
Ok(transaction_count.to_string())
}
// pub fn process_ping(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// interval: &Duration,
// count: &Option<u64>,
// timeout: &Duration,
// fixed_blockhash: &Option<Hash>,
// print_timestamp: bool,
// compute_unit_price: &Option<u64>,
// ) -> ProcessResult {
// let (signal_sender, signal_receiver) = unbounded();
// ctrlc::set_handler(move || {
// let _ = signal_sender.send(());
// })
// .expect("Error setting Ctrl-C handler");
// let mut cli_pings = vec![];
// let mut submit_count = 0;
// let mut confirmed_count = 0;
// let mut confirmation_time: VecDeque<u64> = VecDeque::with_capacity(1024);
// let mut blockhash = rpc_client.get_latest_blockhash()?;
// let mut lamports = 0;
// let mut blockhash_acquired = Instant::now();
// let mut blockhash_from_cluster = false;
// if let Some(fixed_blockhash) = fixed_blockhash {
// if *fixed_blockhash != Hash::default() {
// blockhash = *fixed_blockhash;
// } else {
// blockhash_from_cluster = true;
// }
// }
// 'mainloop: for seq in 0..count.unwrap_or(std::u64::MAX) {
// let now = Instant::now();
// if fixed_blockhash.is_none() && now.duration_since(blockhash_acquired).as_secs() > 60 {
// // Fetch a new blockhash every minute
// let new_blockhash = rpc_client.get_new_latest_blockhash(&blockhash)?;
// blockhash = new_blockhash;
// lamports = 0;
// blockhash_acquired = Instant::now();
// }
// let to = config.signers[0].pubkey();
// lamports += 1;
// let build_message = |lamports| {
// let mut ixs = vec![system_instruction::transfer(
// &config.signers[0].pubkey(),
// &to,
// lamports,
// )];
// if let Some(compute_unit_price) = compute_unit_price {
// ixs.push(ComputeBudgetInstruction::set_compute_unit_price(
// *compute_unit_price,
// ));
// }
// Message::new(&ixs, Some(&config.signers[0].pubkey()))
// };
// let (message, _) = resolve_spend_tx_and_check_account_balance(
// rpc_client,
// false,
// SpendAmount::Some(lamports),
// &blockhash,
// &config.signers[0].pubkey(),
// build_message,
// config.commitment,
// )?;
// let mut tx = Transaction::new_unsigned(message);
// tx.try_sign(&config.signers, blockhash)?;
// let timestamp = || {
// let micros = SystemTime::now()
// .duration_since(UNIX_EPOCH)
// .unwrap()
// .as_micros();
// format!("[{}.{:06}] ", micros / 1_000_000, micros % 1_000_000)
// };
// match rpc_client.send_transaction(&tx) {
// Ok(signature) => {
// let transaction_sent = Instant::now();
// loop {
// let signature_status = rpc_client.get_signature_status(&signature)?;
// let elapsed_time = Instant::now().duration_since(transaction_sent);
// if let Some(transaction_status) = signature_status {
// match transaction_status {
// Ok(()) => {
// let elapsed_time_millis = elapsed_time.as_millis() as u64;
// confirmation_time.push_back(elapsed_time_millis);
// let cli_ping_data = CliPingData {
// success: true,
// signature: Some(signature.to_string()),
// ms: Some(elapsed_time_millis),
// error: None,
// timestamp: timestamp(),
// print_timestamp,
// sequence: seq,
// lamports: Some(lamports),
// };
// eprint!("{}", cli_ping_data);
// cli_pings.push(cli_ping_data);
// confirmed_count += 1;
// }
// Err(err) => {
// let cli_ping_data = CliPingData {
// success: false,
// signature: Some(signature.to_string()),
// ms: None,
// error: Some(err.to_string()),
// timestamp: timestamp(),
// print_timestamp,
// sequence: seq,
// lamports: None,
// };
// eprint!("{}", cli_ping_data);
// cli_pings.push(cli_ping_data);
// }
// }
// break;
// }
// if elapsed_time >= *timeout {
// let cli_ping_data = CliPingData {
// success: false,
// signature: Some(signature.to_string()),
// ms: None,
// error: None,
// timestamp: timestamp(),
// print_timestamp,
// sequence: seq,
// lamports: None,
// };
// eprint!("{}", cli_ping_data);
// cli_pings.push(cli_ping_data);
// break;
// }
// // Sleep for half a slot
// if signal_receiver
// .recv_timeout(Duration::from_millis(clock::DEFAULT_MS_PER_SLOT / 2))
// .is_ok()
// {
// break 'mainloop;
// }
// }
// }
// Err(err) => {
// let cli_ping_data = CliPingData {
// success: false,
// signature: None,
// ms: None,
// error: Some(err.to_string()),
// timestamp: timestamp(),
// print_timestamp,
// sequence: seq,
// lamports: None,
// };
// eprint!("{}", cli_ping_data);
// cli_pings.push(cli_ping_data);
// }
// }
// submit_count += 1;
// if signal_receiver.recv_timeout(*interval).is_ok() {
// break 'mainloop;
// }
// }
// let transaction_stats = CliPingTxStats {
// num_transactions: submit_count,
// num_transaction_confirmed: confirmed_count,
// };
// let confirmation_stats = if !confirmation_time.is_empty() {
// let samples: Vec<f64> = confirmation_time.iter().map(|t| *t as f64).collect();
// let dist = criterion_stats::Distribution::from(samples.into_boxed_slice());
// let mean = dist.mean();
// Some(CliPingConfirmationStats {
// min: dist.min(),
// mean,
// max: dist.max(),
// std_dev: dist.std_dev(Some(mean)),
// })
// } else {
// None
// };
// let cli_ping = CliPing {
// source_pubkey: config.signers[0].pubkey().to_string(),
// fixed_blockhash: fixed_blockhash.map(|_| blockhash.to_string()),
// blockhash_from_cluster,
// pings: cli_pings,
// transaction_stats,
// confirmation_stats,
// };
// Ok(config.output_format.formatted_string(&cli_ping))
// }
// pub fn parse_logs(
// matches: &ArgMatches,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let address = pubkey_of_signer(matches, "address", wallet_manager)?;
// let include_votes = matches.is_present("include_votes");
// let filter = match address {
// None => {
// if include_votes {
// RpcTransactionLogsFilter::AllWithVotes
// } else {
// RpcTransactionLogsFilter::All
// }
// }
// Some(address) => RpcTransactionLogsFilter::Mentions(vec![address.to_string()]),
// };
// Ok(CliCommandInfo {
// command: CliCommand::Logs { filter },
// signers: vec![],
// })
// }
// pub fn process_logs(config: &CliConfig<'_>, filter: &RpcTransactionLogsFilter) -> ProcessResult {
// PgTerminal::log_wasm(
// "Streaming transaction logs{}. {:?} commitment",
// match filter {
// RpcTransactionLogsFilter::All => "".into(),
// RpcTransactionLogsFilter::AllWithVotes => " (including votes)".into(),
// RpcTransactionLogsFilter::Mentions(addresses) =>
// format!(" mentioning {}", addresses.join(",")),
// },
// config.commitment.commitment
// );
// let (_client, receiver) = PubsubClient::logs_subscribe(
// &config.websocket_url,
// filter.clone(),
// RpcTransactionLogsConfig {
// commitment: Some(config.commitment),
// },
// )?;
// loop {
// match receiver.recv() {
// Ok(logs) => {
// PgTerminal::log_wasm("Transaction executed in slot {}:", logs.context.slot);
// PgTerminal::log_wasm(" Signature: {}", logs.value.signature);
// PgTerminal::log_wasm(
// " Status: {}",
// logs.value
// .err
// .map(|err| err.to_string())
// .unwrap_or_else(|| "Ok".to_string())
// );
// PgTerminal::log_wasm(" Log Messages:");
// for log in logs.value.logs {
// PgTerminal::log_wasm(" {}", log);
// }
// }
// Err(err) => {
// return Ok(format!("Disconnected: {}", err));
// }
// }
// }
// }
// pub fn process_live_slots(config: &CliConfig<'_>) -> ProcessResult {
// let exit = Arc::new(AtomicBool::new(false));
// let mut current: Option<SlotInfo> = None;
// let mut message = "".to_string();
// let slot_progress = new_spinner_progress_bar();
// slot_progress.set_message("Connecting...");
// let (mut client, receiver) = PubsubClient::slot_subscribe(&config.websocket_url)?;
// slot_progress.set_message("Connected.");
// let spacer = "|";
// slot_progress.println(spacer);
// let mut last_root = std::u64::MAX;
// let mut last_root_update = Instant::now();
// let mut slots_per_second = std::f64::NAN;
// loop {
// if exit.load(Ordering::Relaxed) {
// PgTerminal::log_wasm("{}", message);
// client.shutdown().unwrap();
// break;
// }
// match receiver.recv() {
// Ok(new_info) => {
// if last_root == std::u64::MAX {
// last_root = new_info.root;
// last_root_update = Instant::now();
// }
// if last_root_update.elapsed().as_secs() >= 5 {
// let root = new_info.root;
// slots_per_second =
// (root - last_root) as f64 / last_root_update.elapsed().as_secs() as f64;
// last_root_update = Instant::now();
// last_root = root;
// }
// message = if slots_per_second.is_nan() {
// format!("{:?}", new_info)
// } else {
// format!(
// "{:?} | root slot advancing at {:.2} slots/second",
// new_info, slots_per_second
// )
// };
// slot_progress.set_message(message.clone());
// if let Some(previous) = current {
// let slot_delta: i64 = new_info.slot as i64 - previous.slot as i64;
// let root_delta: i64 = new_info.root as i64 - previous.root as i64;
// //
// // if slot has advanced out of step with the root, we detect
// // a mismatch and output the slot information
// //
// if slot_delta != root_delta {
// let prev_root = format!(
// "|<--- {} <- … <- {} <- {} (prev)",
// previous.root, previous.parent, previous.slot
// );
// slot_progress.println(&prev_root);
// let new_root = format!(
// "| '- {} <- … <- {} <- {} (next)",
// new_info.root, new_info.parent, new_info.slot
// );
// slot_progress.println(prev_root);
// slot_progress.println(new_root);
// slot_progress.println(spacer);
// }
// }
// current = Some(new_info);
// }
// Err(err) => {
// PgTerminal::log_wasm("disconnected: {}", err);
// break;
// }
// }
// }
// Ok("".to_string())
// }
// pub fn process_show_gossip(rpc_client: &WasmClient, config: &CliConfig<'_>) -> ProcessResult {
// let cluster_nodes = rpc_client.get_cluster_nodes()?;
// let nodes: Vec<_> = cluster_nodes
// .into_iter()
// .map(|node| CliGossipNode::new(node, &config.address_labels))
// .collect();
// Ok(config
// .output_format
// .formatted_string(&CliGossipNodes(nodes)))
// }
pub async fn process_show_stakes(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
use_lamports_unit: bool,
vote_account_pubkeys: Option<&[Pubkey]>,
) -> ProcessResult {
use crate::commands::stake::build_stake_state;
let mut program_accounts_config = RpcProgramAccountsConfig {
account_config: RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
..RpcAccountInfoConfig::default()
},
..RpcProgramAccountsConfig::default()
};
if let Some(vote_account_pubkeys) = vote_account_pubkeys {
// Use server-side filtering if only one vote account is provided
if vote_account_pubkeys.len() == 1 {
program_accounts_config.filters = Some(vec![
// Filter by `StakeState::Stake(_, _)`
RpcFilterType::Memcmp(Memcmp {
offset: 0,
bytes: MemcmpEncodedBytes::Base58(bs58::encode([2, 0, 0, 0]).into_string()),
encoding: Some(MemcmpEncoding::Binary),
}),
// Filter by `Delegation::voter_pubkey`, which begins at byte offset 124
RpcFilterType::Memcmp(Memcmp {
offset: 124,
bytes: MemcmpEncodedBytes::Base58(vote_account_pubkeys[0].to_string()),
encoding: Some(MemcmpEncoding::Binary),
}),
]);
}
}
let all_stake_accounts = rpc_client
.get_program_accounts_with_config(&stake::program::id(), program_accounts_config)
.await?;
let stake_history_account = rpc_client.get_account(&stake_history::id()).await?;
let clock_account = rpc_client.get_account(&sysvar::clock::id()).await?;
let clock: Clock = from_account(&clock_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize clock sysvar".to_string())
})?;
let stake_history = from_account(&stake_history_account).ok_or_else(|| {
CliError::RpcRequestError("Failed to deserialize stake history".to_string())
})?;
let mut stake_accounts: Vec<CliKeyedStakeState> = vec![];
for (stake_pubkey, stake_account) in all_stake_accounts {
if let Ok(stake_state) = stake_account.state() {
match stake_state {
StakeStateV2::Initialized(_) => {
if vote_account_pubkeys.is_none() {
stake_accounts.push(CliKeyedStakeState {
stake_pubkey: stake_pubkey.to_string(),
stake_state: build_stake_state(
stake_account.lamports,
&stake_state,
use_lamports_unit,
&stake_history,
&clock,
),
});
}
}
StakeStateV2::Stake(_, stake, _) => {
if vote_account_pubkeys.is_none()
|| vote_account_pubkeys
.unwrap()
.contains(&stake.delegation.voter_pubkey)
{
stake_accounts.push(CliKeyedStakeState {
stake_pubkey: stake_pubkey.to_string(),
stake_state: build_stake_state(
stake_account.lamports,
&stake_state,
use_lamports_unit,
&stake_history,
&clock,
),
});
}
}
_ => {}
}
}
}
Ok(config
.output_format
.formatted_string(&CliStakeVec::new(stake_accounts)))
}
// pub fn process_wait_for_max_stake(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// max_stake_percent: f32,
// ) -> ProcessResult {
// let now = std::time::Instant::now();
// rpc_client.wait_for_max_stake(config.commitment, max_stake_percent)?;
// Ok(format!("Done waiting, took: {}s", now.elapsed().as_secs()))
// }
#[allow(clippy::too_many_arguments)]
pub async fn process_show_validators(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
use_lamports_unit: bool,
validators_sort_order: CliValidatorsSortOrder,
validators_reverse_sort: bool,
number_validators: bool,
keep_unstaked_delinquents: bool,
delinquent_slot_distance: Option<Slot>,
) -> ProcessResult {
// let progress_bar = new_spinner_progress_bar();
// progress_bar.set_message("Fetching vote accounts...");
let epoch_info = rpc_client.get_epoch_info().await?;
let vote_accounts = rpc_client
.get_vote_accounts_with_config(RpcGetVoteAccountsConfig {
keep_unstaked_delinquents: Some(keep_unstaked_delinquents),
delinquent_slot_distance,
..RpcGetVoteAccountsConfig::default()
})
.await?;
// progress_bar.set_message("Fetching block production...");
let skip_rate: HashMap<_, _> = rpc_client
.get_block_production()
.await
.ok()
.map(|result| {
result
.by_identity
.into_iter()
.map(|(identity, (leader_slots, blocks_produced))| {
(
identity,
100. * (leader_slots.saturating_sub(blocks_produced)) as f64
/ leader_slots as f64,
)
})
.collect()
})
.unwrap_or_default();
// progress_bar.set_message("Fetching version information...");
let mut node_version = HashMap::new();
for contact_info in rpc_client.get_cluster_nodes().await? {
node_version.insert(
contact_info.pubkey,
contact_info
.version
.and_then(|version| CliVersion::from_str(&version).ok())
.unwrap_or_else(CliVersion::unknown_version),
);
}
// progress_bar.finish_and_clear();
let total_active_stake = vote_accounts
.current
.iter()
.chain(vote_accounts.delinquent.iter())
.map(|vote_account| vote_account.activated_stake)
.sum();
let total_delinquent_stake = vote_accounts
.delinquent
.iter()
.map(|vote_account| vote_account.activated_stake)
.sum();
let total_current_stake = total_active_stake - total_delinquent_stake;
let current_validators: Vec<CliValidator> = vote_accounts
.current
.iter()
.map(|vote_account| {
CliValidator::new(
vote_account,
epoch_info.epoch,
node_version
.get(&vote_account.node_pubkey)
.cloned()
.unwrap_or_else(CliVersion::unknown_version),
skip_rate.get(&vote_account.node_pubkey).cloned(),
&config.address_labels,
)
})
.collect();
let delinquent_validators: Vec<CliValidator> = vote_accounts
.delinquent
.iter()
.map(|vote_account| {
CliValidator::new_delinquent(
vote_account,
epoch_info.epoch,
node_version
.get(&vote_account.node_pubkey)
.cloned()
.unwrap_or_else(CliVersion::unknown_version),
skip_rate.get(&vote_account.node_pubkey).cloned(),
&config.address_labels,
)
})
.collect();
let mut stake_by_version: BTreeMap<CliVersion, CliValidatorsStakeByVersion> = BTreeMap::new();
for validator in current_validators.iter() {
let entry = stake_by_version
.entry(validator.version.clone())
.or_default();
entry.current_validators += 1;
entry.current_active_stake += validator.activated_stake;
}
for validator in delinquent_validators.iter() {
let entry = stake_by_version
.entry(validator.version.clone())
.or_default();
entry.delinquent_validators += 1;
entry.delinquent_active_stake += validator.activated_stake;
}
let validators: Vec<_> = current_validators
.into_iter()
.chain(delinquent_validators.into_iter())
.collect();
let (average_skip_rate, average_stake_weighted_skip_rate) = {
let mut skip_rate_len = 0;
let mut skip_rate_sum = 0.;
let mut skip_rate_weighted_sum = 0.;
for validator in validators.iter() {
if let Some(skip_rate) = validator.skip_rate {
skip_rate_sum += skip_rate;
skip_rate_len += 1;
skip_rate_weighted_sum += skip_rate * validator.activated_stake as f64;
}
}
if skip_rate_len > 0 && total_active_stake > 0 {
(
skip_rate_sum / skip_rate_len as f64,
skip_rate_weighted_sum / total_active_stake as f64,
)
} else {
(100., 100.) // Impossible?
}
};
let cli_validators = CliValidators {
total_active_stake,
total_current_stake,
total_delinquent_stake,
validators,
average_skip_rate,
average_stake_weighted_skip_rate,
validators_sort_order,
validators_reverse_sort,
number_validators,
stake_by_version,
use_lamports_unit,
};
Ok(config.output_format.formatted_string(&cli_validators))
}
pub async fn process_transaction_history(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
address: &Pubkey,
before: Option<Signature>,
until: Option<Signature>,
limit: usize,
show_transactions: bool,
) -> ProcessResult {
let results = rpc_client
.get_signatures_for_address_with_config(
address,
GetConfirmedSignaturesForAddress2Config {
before,
until,
limit: Some(limit),
commitment: Some(CommitmentConfig::confirmed()),
},
)
.await?;
let transactions_found = format!("{} transactions found", results.len());
for result in results {
if config.verbose {
PgTerminal::log_wasm(&format!(
"{} [slot={} {}status={}] {}",
result.signature,
result.slot,
match result.block_time {
None => "".to_string(),
Some(block_time) => {
format!("timestamp={} ", unix_timestamp_to_string(block_time))
}
},
if let Some(err) = result.err {
format!("Failed: {:?}", err)
} else {
match result.confirmation_status {
None => "Finalized".to_string(),
Some(status) => format!("{:?}", status),
}
},
result.memo.unwrap_or_default(),
));
} else {
PgTerminal::log_wasm(&result.signature.to_string());
}
if show_transactions {
if let Ok(signature) = result.signature.parse::<Signature>() {
match rpc_client
.get_transaction_with_config(
&signature,
RpcTransactionConfig {
encoding: Some(UiTransactionEncoding::Base64),
commitment: Some(CommitmentConfig::confirmed()),
max_supported_transaction_version: Some(0),
},
)
.await
{
Ok(confirmed_transaction) => {
println_transaction(
&confirmed_transaction
.transaction
.transaction
.decode()
.expect("Successful decode"),
confirmed_transaction.transaction.meta.as_ref(),
" ",
None,
None,
);
}
Err(err) => PgTerminal::log_wasm(&format!(
" Unable to get confirmed transaction details: {}",
err
)),
}
}
PgTerminal::log_wasm("");
}
}
Ok(transactions_found)
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct CliRentCalculation {
pub lamports_per_byte_year: u64,
pub lamports_per_epoch: u64,
pub rent_exempt_minimum_lamports: u64,
#[serde(skip)]
pub use_lamports_unit: bool,
}
impl CliRentCalculation {
fn build_balance_message(&self, lamports: u64) -> String {
build_balance_message(lamports, self.use_lamports_unit, true)
}
}
impl fmt::Display for CliRentCalculation {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let per_byte_year = self.build_balance_message(self.lamports_per_byte_year);
let per_epoch = self.build_balance_message(self.lamports_per_epoch);
let exempt_minimum = self.build_balance_message(self.rent_exempt_minimum_lamports);
writeln_name_value(f, "Rent per byte-year:", &per_byte_year)?;
writeln_name_value(f, "Rent per epoch:", &per_epoch)?;
writeln_name_value(f, "Rent-exempt minimum:", &exempt_minimum)
}
}
impl QuietDisplay for CliRentCalculation {}
impl VerboseDisplay for CliRentCalculation {}
#[derive(Debug, PartialEq, Eq)]
pub enum RentLengthValue {
Nonce,
Stake,
System,
Vote,
Bytes(usize),
}
impl RentLengthValue {
pub fn length(&self) -> usize {
match self {
Self::Nonce => NonceState::size(),
Self::Stake => StakeStateV2::size_of(),
Self::System => 0,
Self::Vote => VoteState::size_of(),
Self::Bytes(l) => *l,
}
}
}
#[derive(Debug, Error)]
#[error("expected number or moniker, got \"{0}\"")]
pub struct RentLengthValueError(pub String);
impl FromStr for RentLengthValue {
type Err = RentLengthValueError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s.to_ascii_lowercase();
match s.as_str() {
"nonce" => Ok(Self::Nonce),
"stake" => Ok(Self::Stake),
"system" => Ok(Self::System),
"vote" => Ok(Self::Vote),
_ => usize::from_str(&s)
.map(Self::Bytes)
.map_err(|_| RentLengthValueError(s)),
}
}
}
pub async fn process_calculate_rent(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
data_length: usize,
use_lamports_unit: bool,
) -> ProcessResult {
let epoch_schedule = rpc_client.get_epoch_schedule().await?;
let rent_account = rpc_client.get_account(&sysvar::rent::id()).await?;
let rent: Rent = rent_account.deserialize_data()?;
let rent_exempt_minimum_lamports = rent.minimum_balance(data_length);
let seconds_per_tick = Duration::from_secs_f64(1.0 / clock::DEFAULT_TICKS_PER_SECOND as f64);
let slots_per_year =
timing::years_as_slots(1.0, &seconds_per_tick, clock::DEFAULT_TICKS_PER_SLOT);
let slots_per_epoch = epoch_schedule.slots_per_epoch as f64;
let years_per_epoch = slots_per_epoch / slots_per_year;
let lamports_per_epoch = rent.due(0, data_length, years_per_epoch).lamports();
let cli_rent_calculation = CliRentCalculation {
lamports_per_byte_year: rent.lamports_per_byte_year,
lamports_per_epoch,
rent_exempt_minimum_lamports,
use_lamports_unit,
};
Ok(config.output_format.formatted_string(&cli_rent_calculation))
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/validator_info.rs
|
// use {
// crate::{
// cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
// spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
// },
// bincode::deserialize,
// clap::{App, AppSettings, Arg, ArgMatches, SubCommand},
// reqwest::blocking::Client,
// serde_json::{Map, Value},
// solana_account_decoder::validator_info::{
// self, ValidatorInfo, MAX_LONG_FIELD_LENGTH, MAX_SHORT_FIELD_LENGTH,
// },
// solana_clap_utils::{
// input_parsers::pubkey_of,
// input_validators::{is_pubkey, is_url},
// keypair::DefaultSigner,
// },
// solana_cli_output::{CliValidatorInfo, CliValidatorInfoVec},
// solana_client::rpc_client::WasmClient,
// solana_config_program::{config_instruction, get_config_data, ConfigKeys, ConfigState},
// solana_remote_wallet::remote_wallet::RemoteWalletManager,
// solana_sdk::{
// account::Account,
// message::Message,
// pubkey::Pubkey,
// signature::{Keypair, Signer},
// transaction::Transaction,
// },
// std::{error, sync::Arc},
// };
// // Return an error if a validator details are longer than the max length.
// pub fn check_details_length(string: String) -> Result<(), String> {
// if string.len() > MAX_LONG_FIELD_LENGTH {
// Err(format!(
// "validator details longer than {:?}-byte limit",
// MAX_LONG_FIELD_LENGTH
// ))
// } else {
// Ok(())
// }
// }
// // Return an error if url field is too long or cannot be parsed.
// pub fn check_url(string: String) -> Result<(), String> {
// is_url(string.clone())?;
// if string.len() > MAX_SHORT_FIELD_LENGTH {
// Err(format!(
// "url longer than {:?}-byte limit",
// MAX_SHORT_FIELD_LENGTH
// ))
// } else {
// Ok(())
// }
// }
// // Return an error if a validator field is longer than the max length.
// pub fn is_short_field(string: String) -> Result<(), String> {
// if string.len() > MAX_SHORT_FIELD_LENGTH {
// Err(format!(
// "validator field longer than {:?}-byte limit",
// MAX_SHORT_FIELD_LENGTH
// ))
// } else {
// Ok(())
// }
// }
// fn verify_keybase(
// validator_pubkey: &Pubkey,
// keybase_username: &Value,
// ) -> Result<(), Box<dyn error::Error>> {
// if let Some(keybase_username) = keybase_username.as_str() {
// let url = format!(
// "https://keybase.pub/{}/solana/validator-{:?}",
// keybase_username, validator_pubkey
// );
// let client = Client::new();
// if client.head(&url).send()?.status().is_success() {
// Ok(())
// } else {
// Err(format!("keybase_username could not be confirmed at: {}. Please add this pubkey file to your keybase profile to connect", url).into())
// }
// } else {
// Err(format!(
// "keybase_username could not be parsed as String: {}",
// keybase_username
// )
// .into())
// }
// }
// fn parse_args(matches: &ArgMatches<'_>) -> Value {
// let mut map = Map::new();
// map.insert(
// "name".to_string(),
// Value::String(matches.value_of("name").unwrap().to_string()),
// );
// if let Some(url) = matches.value_of("website") {
// map.insert("website".to_string(), Value::String(url.to_string()));
// }
// if let Some(details) = matches.value_of("details") {
// map.insert("details".to_string(), Value::String(details.to_string()));
// }
// if let Some(keybase_username) = matches.value_of("keybase_username") {
// map.insert(
// "keybaseUsername".to_string(),
// Value::String(keybase_username.to_string()),
// );
// }
// Value::Object(map)
// }
// fn parse_validator_info(
// pubkey: &Pubkey,
// account: &Account,
// ) -> Result<(Pubkey, Map<String, serde_json::value::Value>), Box<dyn error::Error>> {
// if account.owner != solana_config_program::id() {
// return Err(format!("{} is not a validator info account", pubkey).into());
// }
// let key_list: ConfigKeys = deserialize(&account.data)?;
// if !key_list.keys.is_empty() {
// let (validator_pubkey, _) = key_list.keys[1];
// let validator_info_string: String = deserialize(get_config_data(&account.data)?)?;
// let validator_info: Map<_, _> = serde_json::from_str(&validator_info_string)?;
// Ok((validator_pubkey, validator_info))
// } else {
// Err(format!("{} could not be parsed as a validator info account", pubkey).into())
// }
// }
// pub trait ValidatorInfoSubCommands {
// fn validator_info_subcommands(self) -> Self;
// }
// impl ValidatorInfoSubCommands for App<'_, '_> {
// fn validator_info_subcommands(self) -> Self {
// self.subcommand(
// SubCommand::with_name("validator-info")
// .about("Publish/get Validator info on Solana")
// .setting(AppSettings::SubcommandRequiredElseHelp)
// .subcommand(
// SubCommand::with_name("publish")
// .about("Publish Validator info on Solana")
// .arg(
// Arg::with_name("info_pubkey")
// .short("p")
// .long("info-pubkey")
// .value_name("PUBKEY")
// .takes_value(true)
// .validator(is_pubkey)
// .help("The pubkey of the Validator info account to update"),
// )
// .arg(
// Arg::with_name("name")
// .index(1)
// .value_name("NAME")
// .takes_value(true)
// .required(true)
// .validator(is_short_field)
// .help("Validator name"),
// )
// .arg(
// Arg::with_name("website")
// .short("w")
// .long("website")
// .value_name("URL")
// .takes_value(true)
// .validator(check_url)
// .help("Validator website url"),
// )
// .arg(
// Arg::with_name("keybase_username")
// .short("n")
// .long("keybase")
// .value_name("USERNAME")
// .takes_value(true)
// .validator(is_short_field)
// .help("Validator Keybase username"),
// )
// .arg(
// Arg::with_name("details")
// .short("d")
// .long("details")
// .value_name("DETAILS")
// .takes_value(true)
// .validator(check_details_length)
// .help("Validator description")
// )
// .arg(
// Arg::with_name("force")
// .long("force")
// .takes_value(false)
// .hidden(true) // Don't document this argument to discourage its use
// .help("Override keybase username validity check"),
// ),
// )
// .subcommand(
// SubCommand::with_name("get")
// .about("Get and parse Solana Validator info")
// .arg(
// Arg::with_name("info_pubkey")
// .index(1)
// .value_name("PUBKEY")
// .takes_value(true)
// .validator(is_pubkey)
// .help("The pubkey of the Validator info account; without this argument, returns all"),
// ),
// )
// )
// }
// }
// pub fn parse_validator_info_command(
// matches: &ArgMatches<'_>,
// default_signer: &DefaultSigner,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let info_pubkey = pubkey_of(matches, "info_pubkey");
// // Prepare validator info
// let validator_info = parse_args(matches);
// Ok(CliCommandInfo {
// command: CliCommand::SetValidatorInfo {
// validator_info,
// force_keybase: matches.is_present("force"),
// info_pubkey,
// },
// signers: vec![default_signer.signer_from_path(matches, wallet_manager)?],
// })
// }
// pub fn parse_get_validator_info_command(
// matches: &ArgMatches<'_>,
// ) -> Result<CliCommandInfo, CliError> {
// let info_pubkey = pubkey_of(matches, "info_pubkey");
// Ok(CliCommandInfo {
// command: CliCommand::GetValidatorInfo(info_pubkey),
// signers: vec![],
// })
// }
// pub fn process_set_validator_info(
// rpc_client: &WasmClient,
// config: &CliConfig,
// validator_info: &Value,
// force_keybase: bool,
// info_pubkey: Option<Pubkey>,
// ) -> ProcessResult {
// // Validate keybase username
// if let Some(string) = validator_info.get("keybaseUsername") {
// let result = verify_keybase(&config.signers[0].pubkey(), string);
// if result.is_err() {
// if force_keybase {
// println!("--force supplied, ignoring: {:?}", result);
// } else {
// result.map_err(|err| {
// CliError::BadParameter(format!("Invalid validator keybase username: {}", err))
// })?;
// }
// }
// }
// let validator_string = serde_json::to_string(&validator_info).unwrap();
// let validator_info = ValidatorInfo {
// info: validator_string,
// };
// // Check for existing validator-info account
// let all_config = rpc_client.get_program_accounts(&solana_config_program::id())?;
// let existing_account = all_config
// .iter()
// .filter(
// |(_, account)| match deserialize::<ConfigKeys>(&account.data) {
// Ok(key_list) => key_list.keys.contains(&(validator_info::id(), false)),
// Err(_) => false,
// },
// )
// .find(|(pubkey, account)| {
// let (validator_pubkey, _) = parse_validator_info(pubkey, account).unwrap();
// validator_pubkey == config.signers[0].pubkey()
// });
// // Create validator-info keypair to use if info_pubkey not provided or does not exist
// let info_keypair = Keypair::new();
// let mut info_pubkey = if let Some(pubkey) = info_pubkey {
// pubkey
// } else if let Some(validator_info) = existing_account {
// validator_info.0
// } else {
// info_keypair.pubkey()
// };
// // Check existence of validator-info account
// let balance = rpc_client.get_balance(&info_pubkey).unwrap_or(0);
// let keys = vec![
// (validator_info::id(), false),
// (config.signers[0].pubkey(), true),
// ];
// let data_len = ValidatorInfo::max_space() + ConfigKeys::serialized_size(keys.clone());
// let lamports = rpc_client.get_minimum_balance_for_rent_exemption(data_len as usize)?;
// let signers = if balance == 0 {
// if info_pubkey != info_keypair.pubkey() {
// println!(
// "Account {:?} does not exist. Generating new keypair...",
// info_pubkey
// );
// info_pubkey = info_keypair.pubkey();
// }
// vec![config.signers[0], &info_keypair]
// } else {
// vec![config.signers[0]]
// };
// let build_message = |lamports| {
// let keys = keys.clone();
// if balance == 0 {
// println!(
// "Publishing info for Validator {:?}",
// config.signers[0].pubkey()
// );
// let mut instructions = config_instruction::create_account::<ValidatorInfo>(
// &config.signers[0].pubkey(),
// &info_pubkey,
// lamports,
// keys.clone(),
// );
// instructions.extend_from_slice(&[config_instruction::store(
// &info_pubkey,
// true,
// keys,
// &validator_info,
// )]);
// Message::new(&instructions, Some(&config.signers[0].pubkey()))
// } else {
// println!(
// "Updating Validator {:?} info at: {:?}",
// config.signers[0].pubkey(),
// info_pubkey
// );
// let instructions = vec![config_instruction::store(
// &info_pubkey,
// false,
// keys,
// &validator_info,
// )];
// Message::new(&instructions, Some(&config.signers[0].pubkey()))
// }
// };
// // Submit transaction
// let latest_blockhash = rpc_client.get_latest_blockhash()?;
// let (message, _) = resolve_spend_tx_and_check_account_balance(
// rpc_client,
// false,
// SpendAmount::Some(lamports),
// &latest_blockhash,
// &config.signers[0].pubkey(),
// build_message,
// config.commitment,
// )?;
// let mut tx = Transaction::new_unsigned(message);
// tx.try_sign(&signers, latest_blockhash)?;
// let signature_str = rpc_client.send_and_confirm_transaction_with_spinner(&tx)?;
// println!("Success! Validator info published at: {:?}", info_pubkey);
// println!("{}", signature_str);
// Ok("".to_string())
// }
// pub fn process_get_validator_info(
// rpc_client: &WasmClient,
// config: &CliConfig,
// pubkey: Option<Pubkey>,
// ) -> ProcessResult {
// let validator_info: Vec<(Pubkey, Account)> = if let Some(validator_info_pubkey) = pubkey {
// vec![(
// validator_info_pubkey,
// rpc_client.get_account(&validator_info_pubkey)?,
// )]
// } else {
// let all_config = rpc_client.get_program_accounts(&solana_config_program::id())?;
// all_config
// .into_iter()
// .filter(|(_, validator_info_account)| {
// match deserialize::<ConfigKeys>(&validator_info_account.data) {
// Ok(key_list) => key_list.keys.contains(&(validator_info::id(), false)),
// Err(_) => false,
// }
// })
// .collect()
// };
// let mut validator_info_list: Vec<CliValidatorInfo> = vec![];
// if validator_info.is_empty() {
// println!("No validator info accounts found");
// }
// for (validator_info_pubkey, validator_info_account) in validator_info.iter() {
// let (validator_pubkey, validator_info) =
// parse_validator_info(validator_info_pubkey, validator_info_account)?;
// validator_info_list.push(CliValidatorInfo {
// identity_pubkey: validator_pubkey.to_string(),
// info_pubkey: validator_info_pubkey.to_string(),
// info: validator_info,
// });
// }
// Ok(config
// .output_format
// .formatted_string(&CliValidatorInfoVec::new(validator_info_list)))
// }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/nonce.rs
|
use clap::{Arg, ArgMatches, Command};
use solana_clap_v3_utils_wasm::{
input_parsers::*,
input_validators::*,
keypair::{generate_unique_signers, SignerIndex},
memo::{memo_arg, MEMO_ARG},
nonce::*,
};
use solana_cli_output_wasm::cli_output::CliNonceAccount;
use solana_client_wasm::{
utils::nonce_utils::{self, state_from_account, NonceError as ClientNonceError},
WasmClient,
};
use solana_playground_utils_wasm::js::PgTerminal;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
account::Account,
feature_set::merge_nonce_error_into_system_error,
hash::Hash,
message::Message,
native_token::lamports_to_sol,
nonce::{self, State},
pubkey::Pubkey,
signature::Keypair,
signer::Signer,
system_instruction::{
advance_nonce_account, authorize_nonce_account, create_nonce_account,
create_nonce_account_with_seed, withdraw_nonce_account, SystemError,
},
system_program,
transaction::Transaction,
};
use std::rc::Rc;
use crate::{
cli::{
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
ProcessResult,
},
utils::{
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
memo::WithMemo,
spend_utils::{resolve_spend_tx_and_check_account_balance, SpendAmount},
},
};
use super::feature::get_feature_is_active;
pub trait NonceSubCommands {
fn nonce_subcommands(self) -> Self;
}
impl NonceSubCommands for Command<'_> {
fn nonce_subcommands(self) -> Self {
self.subcommand(
Command::new("authorize-nonce-account")
.about("Assign account authority to a new entity")
.arg(pubkey!(
Arg::new("nonce_account_pubkey")
.index(1)
.value_name("NONCE_ACCOUNT_ADDRESS")
.required(true),
"Address of the nonce account. "
))
.arg(pubkey!(
Arg::new("new_authority")
.index(2)
.value_name("AUTHORITY_PUBKEY")
.required(true),
"Account to be granted authority of the nonce account. "
))
.arg(nonce_authority_arg())
.arg(memo_arg()),
)
.subcommand(
Command::new("create-nonce-account")
.about("Create a nonce account")
// NOTE: We generate a keypair randomly for WASM
// .arg(
// Arg::new("nonce_account_keypair")
// .index(1)
// .value_name("ACCOUNT_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Keypair of the nonce account to fund"),
// )
.arg(
Arg::new("amount")
.index(1)
.value_name("AMOUNT")
.takes_value(true)
.required(true)
.validator(is_amount_or_all)
.help("The amount to load the nonce account with, in SOL; accepts keyword ALL"),
)
.arg(
pubkey!(Arg::new(NONCE_AUTHORITY_ARG.name)
.long(NONCE_AUTHORITY_ARG.long)
.value_name("PUBKEY"),
"Assign noncing authority to another entity. "),
)
.arg(
Arg::new("seed")
.long("seed")
.value_name("STRING")
.takes_value(true)
.help("Seed for address generation; if specified, the resulting account will be at a derived address of the NONCE_ACCOUNT pubkey")
)
.arg(memo_arg()),
)
.subcommand(
Command::new("nonce")
.about("Get the current nonce value")
.alias("get-nonce")
.arg(pubkey!(
Arg::new("nonce_account_pubkey")
.index(1)
.value_name("NONCE_ACCOUNT_ADDRESS")
.required(true),
"Address of the nonce account to display. "
)),
)
.subcommand(
Command::new("new-nonce")
.about("Generate a new nonce, rendering the existing nonce useless")
.arg(pubkey!(
Arg::new("nonce_account_pubkey")
.index(1)
.value_name("NONCE_ACCOUNT_ADDRESS")
.required(true),
"Address of the nonce account. "
))
.arg(nonce_authority_arg())
.arg(memo_arg()),
)
.subcommand(
Command::new("nonce-account")
.about("Show the contents of a nonce account")
.alias("show-nonce-account")
.arg(pubkey!(
Arg::new("nonce_account_pubkey")
.index(1)
.value_name("NONCE_ACCOUNT_ADDRESS")
.required(true),
"Address of the nonce account to display. "
))
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
),
)
.subcommand(
Command::new("withdraw-from-nonce-account")
.about("Withdraw SOL from the nonce account")
.arg(pubkey!(
Arg::new("nonce_account_pubkey")
.index(1)
.value_name("NONCE_ACCOUNT_ADDRESS")
.required(true),
"Nonce account to withdraw from. "
))
.arg(pubkey!(
Arg::new("destination_account_pubkey")
.index(2)
.value_name("RECIPIENT_ADDRESS")
.required(true),
"The account to which the SOL should be transferred. "
))
.arg(
Arg::new("amount")
.index(3)
.value_name("AMOUNT")
.takes_value(true)
.required(true)
.validator(is_amount)
.help("The amount to withdraw from the nonce account, in SOL"),
)
.arg(nonce_authority_arg())
.arg(memo_arg()),
)
}
}
pub fn parse_authorize_nonce_account(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let nonce_account = pubkey_of_signer(matches, "nonce_account_pubkey", wallet_manager)?.unwrap();
let new_authority = pubkey_of_signer(matches, "new_authority", wallet_manager)?.unwrap();
let memo = matches.value_of(MEMO_ARG.name).map(String::from);
let (nonce_authority, nonce_authority_pubkey) =
signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
let payer_provided = None;
let signer_info =
generate_unique_signers(default_signer, vec![payer_provided, nonce_authority])?;
Ok(CliCommandInfo {
command: CliCommand::AuthorizeNonceAccount {
nonce_account,
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
memo,
new_authority,
},
signers: signer_info.signers,
})
}
pub fn parse_create_nonce_account(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
// NOTE: We generate a random keypair instead for WASM
// let (nonce_account, nonce_account_pubkey) =
// signer_of(matches, "nonce_account_keypair", wallet_manager)?;
let nonce_account = Keypair::new();
let nonce_account_pubkey = nonce_account.pubkey();
let seed = matches.value_of("seed").map(|s| s.to_string());
let amount = SpendAmount::new_from_matches(matches, "amount");
let nonce_authority = pubkey_of_signer(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
let memo = matches.value_of(MEMO_ARG.name).map(String::from);
let payer_provided = None;
let signer_info = generate_unique_signers(
default_signer,
vec![payer_provided, Some(Box::new(nonce_account))],
)?;
Ok(CliCommandInfo {
command: CliCommand::CreateNonceAccount {
nonce_account: signer_info.index_of(Some(nonce_account_pubkey)).unwrap(),
seed,
nonce_authority,
memo,
amount,
},
signers: signer_info.signers,
})
}
pub fn parse_get_nonce(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let nonce_account_pubkey =
pubkey_of_signer(matches, "nonce_account_pubkey", wallet_manager)?.unwrap();
Ok(CliCommandInfo {
command: CliCommand::GetNonce(nonce_account_pubkey),
signers: vec![],
})
}
pub fn parse_new_nonce(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let nonce_account = pubkey_of_signer(matches, "nonce_account_pubkey", wallet_manager)?.unwrap();
let memo = matches.value_of(MEMO_ARG.name).map(String::from);
let (nonce_authority, nonce_authority_pubkey) =
signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
let payer_provided = None;
let signer_info =
generate_unique_signers(default_signer, vec![payer_provided, nonce_authority])?;
Ok(CliCommandInfo {
command: CliCommand::NewNonce {
nonce_account,
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
memo,
},
signers: signer_info.signers,
})
}
pub fn parse_show_nonce_account(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let nonce_account_pubkey =
pubkey_of_signer(matches, "nonce_account_pubkey", wallet_manager)?.unwrap();
let use_lamports_unit = matches.is_present("lamports");
Ok(CliCommandInfo {
command: CliCommand::ShowNonceAccount {
nonce_account_pubkey,
use_lamports_unit,
},
signers: vec![],
})
}
pub fn parse_withdraw_from_nonce_account(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let nonce_account = pubkey_of_signer(matches, "nonce_account_pubkey", wallet_manager)?.unwrap();
let destination_account_pubkey =
pubkey_of_signer(matches, "destination_account_pubkey", wallet_manager)?.unwrap();
let lamports = lamports_of_sol(matches, "amount").unwrap();
let memo = matches.value_of(MEMO_ARG.name).map(String::from);
let (nonce_authority, nonce_authority_pubkey) =
signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
let payer_provided = None;
let signer_info =
generate_unique_signers(default_signer, vec![payer_provided, nonce_authority])?;
Ok(CliCommandInfo {
command: CliCommand::WithdrawFromNonceAccount {
nonce_account,
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
memo,
destination_account_pubkey,
lamports,
},
signers: signer_info.signers,
})
}
/// Check if a nonce account is initialized with the given authority and hash
pub fn check_nonce_account(
nonce_account: &Account,
nonce_authority: &Pubkey,
nonce_hash: &Hash,
) -> Result<(), CliError> {
match state_from_account(nonce_account)? {
State::Initialized(ref data) => {
if &data.blockhash() != nonce_hash {
Err(ClientNonceError::InvalidHash {
provided: *nonce_hash,
expected: data.blockhash(),
}
.into())
} else if nonce_authority != &data.authority {
Err(ClientNonceError::InvalidAuthority {
provided: *nonce_authority,
expected: data.authority,
}
.into())
} else {
Ok(())
}
}
State::Uninitialized => Err(ClientNonceError::InvalidStateForOperation.into()),
}
}
pub async fn process_authorize_nonce_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
nonce_account: &Pubkey,
nonce_authority: SignerIndex,
memo: Option<&String>,
new_authority: &Pubkey,
) -> ProcessResult {
let latest_blockhash = rpc_client.get_latest_blockhash().await?;
let nonce_authority = config.signers[nonce_authority];
let ixs = vec![authorize_nonce_account(
nonce_account,
&nonce_authority.pubkey(),
new_authority,
)]
.with_memo(memo);
let message = Message::new(&ixs, Some(&config.signers[0].pubkey()));
let mut tx = Transaction::new_unsigned(message);
tx.try_sign(&config.signers, latest_blockhash)?;
check_account_for_fee_with_commitment(
rpc_client,
&config.signers[0].pubkey(),
&tx.message,
config.commitment_config,
)
.await?;
// TODO:
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
let result = rpc_client.send_and_confirm_transaction(&tx).await;
log_instruction_custom_error::<SystemError>(result, config)
}
pub async fn process_create_nonce_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
nonce_account: SignerIndex,
seed: Option<String>,
nonce_authority: Option<Pubkey>,
memo: Option<&String>,
amount: SpendAmount,
) -> ProcessResult {
let nonce_account_pubkey = config.signers[nonce_account].pubkey();
let nonce_account_address = if let Some(ref seed) = seed {
Pubkey::create_with_seed(&nonce_account_pubkey, seed, &system_program::id())?
} else {
nonce_account_pubkey
};
check_unique_pubkeys(
(&config.signers[0].pubkey(), "cli keypair".to_string()),
(&nonce_account_address, "nonce_account".to_string()),
)?;
let nonce_authority = nonce_authority.unwrap_or_else(|| config.signers[0].pubkey());
let build_message = |lamports| {
let ixs = if let Some(seed) = seed.clone() {
create_nonce_account_with_seed(
&config.signers[0].pubkey(), // from
&nonce_account_address, // to
&nonce_account_pubkey, // base
&seed, // seed
&nonce_authority,
lamports,
)
.with_memo(memo)
} else {
create_nonce_account(
&config.signers[0].pubkey(),
&nonce_account_pubkey,
&nonce_authority,
lamports,
)
.with_memo(memo)
};
Message::new(&ixs, Some(&config.signers[0].pubkey()))
};
let latest_blockhash = rpc_client.get_latest_blockhash().await?;
let (message, lamports) = resolve_spend_tx_and_check_account_balance(
rpc_client,
false,
amount,
&latest_blockhash,
&config.signers[0].pubkey(),
build_message,
config.commitment_config,
)
.await?;
if let Ok(nonce_account) = nonce_utils::get_account(rpc_client, &nonce_account_address).await {
let err_msg = if state_from_account(&nonce_account).is_ok() {
format!("Nonce account {} already exists", nonce_account_address)
} else {
format!(
"Account {} already exists and is not a nonce account",
nonce_account_address
)
};
return Err(CliError::BadParameter(err_msg).into());
}
let minimum_balance = rpc_client
.get_minimum_balance_for_rent_exemption(State::size())
.await?;
if lamports < minimum_balance {
return Err(CliError::BadParameter(format!(
"need at least {} lamports for nonce account to be rent exempt, provided lamports: {}",
minimum_balance, lamports
))
.into());
}
let mut tx = Transaction::new_unsigned(message);
tx.try_sign(&config.signers, latest_blockhash)?;
let _merge_errors =
get_feature_is_active(rpc_client, &merge_nonce_error_into_system_error::id()).await?;
// TODO:
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
let result = rpc_client.send_and_confirm_transaction(&tx).await?;
PgTerminal::log_wasm(&format!(
"Created nonce account {} with {} SOL",
nonce_account_pubkey,
lamports_to_sol(lamports),
));
Ok(result.to_string())
// let err_ix_index = if let Err(err) = &result {
// err.get_transaction_error().and_then(|tx_err| {
// if let TransactionError::InstructionError(ix_index, _) = tx_err {
// Some(ix_index)
// } else {
// None
// }
// })
// } else {
// None
// };
// match err_ix_index {
// // SystemInstruction::InitializeNonceAccount failed
// Some(1) => {
// if merge_errors {
// log_instruction_custom_error::<SystemError>(result, config)
// } else {
// log_instruction_custom_error_ex::<NonceError, _>(result, config, |ix_error| {
// if let InstructionError::Custom(_) = ix_error {
// instruction_to_nonce_error(ix_error, merge_errors)
// } else {
// None
// }
// })
// }
// }
// // SystemInstruction::CreateAccount{,WithSeed} failed
// _ => log_instruction_custom_error::<SystemError>(result, config),
// }
}
pub async fn process_get_nonce(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
nonce_account_pubkey: &Pubkey,
) -> ProcessResult {
#[allow(clippy::redundant_closure)]
match nonce_utils::get_account_with_commitment(
rpc_client,
nonce_account_pubkey,
config.commitment_config,
)
.await
.and_then(|ref a| state_from_account(a))?
{
State::Uninitialized => Ok("Nonce account is uninitialized".to_string()),
State::Initialized(ref data) => Ok(format!("{:?}", data.blockhash())),
}
}
pub async fn process_new_nonce(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
nonce_account: &Pubkey,
nonce_authority: SignerIndex,
memo: Option<&String>,
) -> ProcessResult {
check_unique_pubkeys(
(&config.signers[0].pubkey(), "cli keypair".to_string()),
(nonce_account, "nonce_account_pubkey".to_string()),
)?;
if let Err(err) = rpc_client.get_account(nonce_account).await {
return Err(CliError::BadParameter(format!(
"Unable to advance nonce account {}. error: {}",
nonce_account, err
))
.into());
}
let nonce_authority = config.signers[nonce_authority];
let ixs = vec![advance_nonce_account(
nonce_account,
&nonce_authority.pubkey(),
)]
.with_memo(memo);
let latest_blockhash = rpc_client.get_latest_blockhash().await?;
let message = Message::new(&ixs, Some(&config.signers[0].pubkey()));
let mut tx = Transaction::new_unsigned(message);
tx.try_sign(&config.signers, latest_blockhash)?;
check_account_for_fee_with_commitment(
rpc_client,
&config.signers[0].pubkey(),
&tx.message,
config.commitment_config,
)
.await?;
// TODO:
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
let result = rpc_client.send_and_confirm_transaction(&tx).await;
log_instruction_custom_error::<SystemError>(result, config)
}
pub async fn process_show_nonce_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
nonce_account_pubkey: &Pubkey,
use_lamports_unit: bool,
) -> ProcessResult {
let nonce_account = nonce_utils::get_account_with_commitment(
rpc_client,
nonce_account_pubkey,
config.commitment_config,
)
.await?;
let minimum_balance_for_rent_exemption = rpc_client
.get_minimum_balance_for_rent_exemption(State::size())
.await?;
let print_account = |data: Option<&nonce::state::Data>| {
let mut nonce_account = CliNonceAccount {
balance: nonce_account.lamports,
minimum_balance_for_rent_exemption,
use_lamports_unit,
..CliNonceAccount::default()
};
if let Some(data) = data {
nonce_account.nonce = Some(data.blockhash().to_string());
nonce_account.lamports_per_signature = Some(data.fee_calculator.lamports_per_signature);
nonce_account.authority = Some(data.authority.to_string());
}
Ok(config.output_format.formatted_string(&nonce_account))
};
match state_from_account(&nonce_account)? {
State::Uninitialized => print_account(None),
State::Initialized(ref data) => print_account(Some(data)),
}
}
pub async fn process_withdraw_from_nonce_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
nonce_account: &Pubkey,
nonce_authority: SignerIndex,
memo: Option<&String>,
destination_account_pubkey: &Pubkey,
lamports: u64,
) -> ProcessResult {
let latest_blockhash = rpc_client.get_latest_blockhash().await?;
let nonce_authority = config.signers[nonce_authority];
let ixs = vec![withdraw_nonce_account(
nonce_account,
&nonce_authority.pubkey(),
destination_account_pubkey,
lamports,
)]
.with_memo(memo);
let message = Message::new(&ixs, Some(&config.signers[0].pubkey()));
let mut tx = Transaction::new_unsigned(message);
tx.try_sign(&config.signers, latest_blockhash)?;
check_account_for_fee_with_commitment(
rpc_client,
&config.signers[0].pubkey(),
&tx.message,
config.commitment_config,
)
.await?;
// TODO:
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&tx);
let result = rpc_client.send_and_confirm_transaction(&tx).await;
log_instruction_custom_error::<SystemError>(result, config)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/mod.rs
|
pub mod cluster_query;
pub mod config;
pub mod feature;
pub mod inflation;
pub mod nonce;
pub mod program;
pub mod stake;
pub mod validator_info;
pub mod vote;
pub mod wallet;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/wallet.rs
|
use std::rc::Rc;
use clap::{Arg, ArgMatches, Command};
use solana_clap_v3_utils_wasm::{
fee_payer::{fee_payer_arg, FEE_PAYER_ARG},
input_parsers::{lamports_of_sol, pubkey_of, pubkey_of_signer, signer_of},
input_validators::{is_amount_or_all, is_derived_address_seed},
keypair::{generate_unique_signers, SignerIndex},
memo::{memo_arg, MEMO_ARG},
nonce::{NonceArgs, NONCE_ARG, NONCE_AUTHORITY_ARG},
offline::{OfflineArgs, DUMP_TRANSACTION_MESSAGE, SIGN_ONLY_ARG},
};
use solana_cli_output_wasm::cli_output::{
build_balance_message, return_signers_with_config, CliAccount, CliSignatureVerificationStatus,
CliTransaction, CliTransactionConfirmation, ReturnSignersConfig, RpcKeyedAccount,
};
use solana_client_wasm::{
utils::{
nonce_utils,
rpc_config::{BlockhashQuery, RpcTransactionConfig},
},
WasmClient,
};
use solana_extra_wasm::{
account_decoder::{UiAccount, UiAccountEncoding},
transaction_status::{
EncodableWithMeta, EncodedConfirmedTransactionWithStatusMeta, EncodedTransaction,
TransactionBinaryEncoding, UiTransactionEncoding,
},
};
use solana_playground_utils_wasm::js::PgTerminal;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
message::Message,
pubkey::Pubkey,
signature::Signature,
signer::Signer,
stake,
system_instruction::{self, SystemError},
system_program,
transaction::{Transaction, VersionedTransaction},
vote,
};
use crate::{
cli::{
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
ProcessResult, SignatureResult,
},
utils::{
blockhash_query::blockhash_query_from_matches,
memo::WithMemo,
spend_utils::{resolve_spend_tx_and_check_account_balances, SpendAmount},
},
};
use super::nonce::check_nonce_account;
pub trait WalletSubCommands {
fn wallet_subcommands(self) -> Self;
}
impl WalletSubCommands for Command<'_> {
fn wallet_subcommands(self) -> Self {
self.subcommand(
Command::new("account")
.about("Show the contents of an account")
.alias("account")
.arg(
pubkey!(Arg::new("account_pubkey")
.index(1)
.value_name("ACCOUNT_ADDRESS")
.required(true),
"Account key URI. ")
)
.arg(
Arg::new("output_file")
.long("output-file")
.short('o')
.value_name("FILEPATH")
.takes_value(true)
.help("Write the account data to this file"),
)
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
),
)
.subcommand(
Command::new("address")
.about("Get your public key")
.arg(
Arg::new("confirm_key")
.long("confirm-key")
.takes_value(false)
.help("Confirm key on device; only relevant if using remote wallet"),
),
)
.subcommand(
Command::new("airdrop")
.about("Request SOL from a faucet")
.arg(
Arg::new("amount")
.index(1)
.value_name("AMOUNT")
.takes_value(true)
//TODO: .validator(is_amount)
.required(true)
.help("The airdrop amount to request, in SOL"),
)
.arg(pubkey!(
Arg::new("to").index(2).value_name("RECIPIENT_ADDRESS"),
"The account address of airdrop recipient. "
)),
)
.subcommand(
Command::new("balance")
.about("Get your balance")
.arg(pubkey!(
Arg::new("pubkey").index(1).value_name("ACCOUNT_ADDRESS"),
"The account address of the balance to check. "
))
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
),
)
.subcommand(
Command::new("confirm")
.about("Confirm transaction by signature")
.arg(
Arg::new("signature")
.index(1)
.value_name("TRANSACTION_SIGNATURE")
.takes_value(true)
.required(true)
.help("The transaction signature to confirm"),
)
.after_help(// Formatted specifically for the manually-indented heredoc string
"Note: This will show more detailed information for finalized transactions with verbose mode (-v/--verbose).\
\n\
\nAccount modes:\
\n |srwx|\
\n s: signed\
\n r: readable (always true)\
\n w: writable\
\n x: program account (inner instructions excluded)\
"
),
)
.subcommand(
Command::new("create-address-with-seed")
.about("Generate a derived account address with a seed")
.arg(
Arg::new("seed")
.index(1)
.value_name("SEED_STRING")
.takes_value(true)
.required(true)
.validator(is_derived_address_seed)
.help("The seed. Must not take more than 32 bytes to encode as utf-8"),
)
.arg(
Arg::new("program_id")
.index(2)
.value_name("PROGRAM_ID")
.takes_value(true)
.required(true)
.help(
"The program_id that the address will ultimately be used for, \n\
or one of NONCE, STAKE, and VOTE keywords",
),
)
.arg(
pubkey!(Arg::new("from")
.long("from")
.value_name("FROM_PUBKEY")
.required(false),
"From (base) key, [default: cli config keypair]. "),
),
)
.subcommand(
Command::new("decode-transaction")
.about("Decode a serialized transaction")
.arg(
Arg::new("transaction")
.index(1)
.value_name("TRANSACTION")
.takes_value(true)
.required(true)
.help("transaction to decode"),
)
.arg(
Arg::new("encoding")
.index(2)
.value_name("ENCODING")
.possible_values(["base58", "base64"]) // Variants of `TransactionBinaryEncoding` enum
.default_value("base58")
.takes_value(true)
.required(true)
.help("transaction encoding"),
),
)
// TODO:
// .subcommand(
// Command::new("resolve-signer")
// .about("Checks that a signer is valid, and returns its specific path; useful for signers that may be specified generally, eg. usb://ledger")
// .arg(
// Arg::new("signer")
// .index(1)
// .value_name("SIGNER_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("The signer path to resolve")
// )
// )
.subcommand(
Command::new("transfer")
.about("Transfer funds between system accounts")
.alias("pay")
.arg(
pubkey!(Arg::new("to")
.index(1)
.value_name("RECIPIENT_ADDRESS")
.required(true),
"The account address of recipient. "),
)
.arg(
Arg::new("amount")
.index(2)
.value_name("AMOUNT")
.takes_value(true)
.validator(is_amount_or_all)
.required(true)
.help("The amount to send, in SOL; accepts keyword ALL"),
)
.arg(
pubkey!(Arg::new("from")
.long("from")
.value_name("FROM_ADDRESS"),
"Source account of funds (if different from client local account). "),
)
.arg(
Arg::new("no_wait")
.long("no-wait")
.takes_value(false)
.help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
)
.arg(
Arg::new("derived_address_seed")
.long("derived-address-seed")
.takes_value(true)
.value_name("SEED_STRING")
.requires("derived_address_program_id")
.validator(is_derived_address_seed)
.hide(true)
)
.arg(
Arg::new("derived_address_program_id")
.long("derived-address-program-id")
.takes_value(true)
.value_name("PROGRAM_ID")
.requires("derived_address_seed")
.hide(true)
)
.arg(
Arg::new("allow_unfunded_recipient")
.long("allow-unfunded-recipient")
.takes_value(false)
.help("Complete the transfer even if the recipient address is not funded")
)
.offline_args()
.nonce_args(false)
.arg(memo_arg())
.arg(fee_payer_arg()),
)
}
}
fn resolve_derived_address_program_id(matches: &ArgMatches, arg_name: &str) -> Option<Pubkey> {
matches.value_of(arg_name).and_then(|v| {
let upper = v.to_ascii_uppercase();
match upper.as_str() {
"NONCE" | "SYSTEM" => Some(system_program::id()),
"STAKE" => Some(stake::program::id()),
"VOTE" => Some(vote::program::id()),
_ => pubkey_of(matches, arg_name),
}
})
}
pub fn parse_account(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let account_pubkey = pubkey_of_signer(matches, "account_pubkey", wallet_manager)?.unwrap();
let output_file = matches.value_of("output_file");
let use_lamports_unit = matches.is_present("lamports");
Ok(CliCommandInfo {
command: CliCommand::ShowAccount {
pubkey: account_pubkey,
output_file: output_file.map(ToString::to_string),
use_lamports_unit,
},
signers: vec![],
})
}
pub fn parse_airdrop(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let pubkey = pubkey_of_signer(matches, "to", wallet_manager)?;
let signers = if pubkey.is_some() {
vec![]
} else {
vec![default_signer]
};
let lamports = lamports_of_sol(matches, "amount").unwrap();
Ok(CliCommandInfo {
command: CliCommand::Airdrop { pubkey, lamports },
signers,
})
}
pub fn parse_balance(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let pubkey = pubkey_of_signer(matches, "pubkey", wallet_manager)?;
let signers = if pubkey.is_some() {
vec![]
} else {
// TODO:
vec![default_signer]
};
Ok(CliCommandInfo {
command: CliCommand::Balance {
pubkey,
use_lamports_unit: matches.is_present("lamports"),
},
signers,
})
}
pub fn parse_confirm(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
match matches.value_of("signature").unwrap().parse() {
Ok(signature) => Ok(CliCommandInfo {
command: CliCommand::Confirm(signature),
signers: vec![],
}),
_ => Err(CliError::BadParameter("Invalid signature".to_string())),
}
}
pub fn parse_decode_transaction(matches: &ArgMatches) -> Result<CliCommandInfo, CliError> {
let blob = matches.value_of_t_or_exit("transaction");
let binary_encoding = match matches.value_of("encoding").unwrap() {
"base58" => TransactionBinaryEncoding::Base58,
"base64" => TransactionBinaryEncoding::Base64,
_ => unreachable!(),
};
let encoded_transaction = EncodedTransaction::Binary(blob, binary_encoding);
if let Some(transaction) = encoded_transaction.decode() {
Ok(CliCommandInfo {
command: CliCommand::DecodeTransaction(transaction),
signers: vec![],
})
} else {
Err(CliError::BadParameter(
"Unable to decode transaction".to_string(),
))
}
}
pub fn parse_create_address_with_seed(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let from_pubkey = pubkey_of_signer(matches, "from", wallet_manager)?;
let signers = if from_pubkey.is_some() {
vec![]
} else {
vec![default_signer]
};
let program_id = resolve_derived_address_program_id(matches, "program_id").unwrap();
let seed = matches.value_of("seed").unwrap().to_string();
Ok(CliCommandInfo {
command: CliCommand::CreateAddressWithSeed {
from_pubkey,
seed,
program_id,
},
signers,
})
}
pub fn parse_transfer(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let amount = SpendAmount::new_from_matches(matches, "amount");
let to = pubkey_of_signer(matches, "to", wallet_manager)?.unwrap();
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
let no_wait = matches.is_present("no_wait");
let blockhash_query = blockhash_query_from_matches(matches);
let nonce_account = pubkey_of_signer(matches, NONCE_ARG.name, wallet_manager)?;
let (nonce_authority, nonce_authority_pubkey) =
signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
let memo = matches.value_of(MEMO_ARG.name).map(String::from);
let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
let (from, from_pubkey) = signer_of(matches, "from", wallet_manager)?;
let allow_unfunded_recipient = matches.is_present("allow_unfunded_recipient");
let mut bulk_signers = vec![fee_payer, from];
if nonce_account.is_some() {
bulk_signers.push(nonce_authority);
}
let signer_info = generate_unique_signers(default_signer, bulk_signers)?;
let derived_address_seed = matches
.value_of("derived_address_seed")
.map(|s| s.to_string());
let derived_address_program_id =
resolve_derived_address_program_id(matches, "derived_address_program_id");
Ok(CliCommandInfo {
command: CliCommand::Transfer {
amount,
to,
sign_only,
dump_transaction_message,
allow_unfunded_recipient,
no_wait,
blockhash_query,
nonce_account,
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
memo,
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
from: signer_info.index_of(from_pubkey).unwrap(),
derived_address_seed,
derived_address_program_id,
},
signers: signer_info.signers,
})
}
pub async fn process_show_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
account_pubkey: &Pubkey,
_output_file: &Option<String>,
use_lamports_unit: bool,
) -> ProcessResult {
let account = rpc_client.get_account(account_pubkey).await?;
// TODO:
// let data = account.data.clone();
let cli_account = CliAccount {
keyed_account: RpcKeyedAccount {
pubkey: account_pubkey.to_string(),
account: UiAccount::encode(
account_pubkey,
&account,
UiAccountEncoding::Base64,
None,
None,
),
},
use_lamports_unit,
};
let account_string = config.output_format.formatted_string(&cli_account);
// TODO:
// match config.output_format {
// OutputFormat::Json | OutputFormat::JsonCompact => {
// if let Some(output_file) = output_file {
// let mut f = File::create(output_file)?;
// f.write_all(account_string.as_bytes())?;
// writeln!(&mut account_string)?;
// writeln!(&mut account_string, "Wrote account to {}", output_file)?;
// }
// }
// OutputFormat::Display | OutputFormat::DisplayVerbose => {
// if let Some(output_file) = output_file {
// let mut f = File::create(output_file)?;
// f.write_all(&data)?;
// writeln!(&mut account_string)?;
// writeln!(&mut account_string, "Wrote account data to {}", output_file)?;
// } else if !data.is_empty() {
// use pretty_hex::*;
// writeln!(&mut account_string, "{:?}", data.hex_dump())?;
// }
// }
// OutputFormat::DisplayQuiet => (),
// }
Ok(account_string)
}
pub async fn process_airdrop(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
pubkey: &Option<Pubkey>,
lamports: u64,
) -> ProcessResult {
let pubkey = if let Some(pubkey) = pubkey {
*pubkey
} else {
config.pubkey()?
};
PgTerminal::log_wasm(&format!(
"Requesting airdrop of {}",
build_balance_message(lamports, false, true),
));
let pre_balance = rpc_client
.get_balance_with_commitment(&pubkey, config.commitment_config)
.await?;
let result = request_and_confirm_airdrop(rpc_client, config, &pubkey, lamports).await;
if let Ok(signature) = result {
let signature_cli_message = log_instruction_custom_error::<SystemError>(result, config)?;
PgTerminal::log_wasm(&signature_cli_message.to_string());
let current_balance = rpc_client
.get_balance_with_commitment(&pubkey, config.commitment_config)
.await?;
if current_balance < pre_balance.saturating_add(lamports) {
PgTerminal::log_wasm(&format!(
"Balance unchanged\nRun `solana confirm -v {:?}` for more info",
signature
));
Ok("".to_string())
} else {
Ok(build_balance_message(current_balance, false, true))
}
} else {
log_instruction_custom_error::<SystemError>(result, config)
}
}
pub async fn process_balance(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
pubkey: &Option<Pubkey>,
use_lamports_unit: bool,
) -> ProcessResult {
let pubkey = if let Some(pubkey) = pubkey {
*pubkey
} else {
config.pubkey()?
};
let balance = rpc_client
.get_balance_with_commitment(&pubkey, config.commitment_config)
.await?;
Ok(build_balance_message(balance, use_lamports_unit, true))
}
pub async fn process_confirm(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
signature: &Signature,
) -> ProcessResult {
match rpc_client.get_signature_statuses(&[*signature]).await {
Ok(status) => {
let cli_transaction = if let Some(transaction_status) = &status[0] {
let mut transaction = None;
let mut get_transaction_error = None;
if config.verbose {
match rpc_client
.get_transaction_with_config(
signature,
RpcTransactionConfig {
encoding: Some(UiTransactionEncoding::Base64),
commitment: Some(config.commitment_config),
max_supported_transaction_version: Some(0),
},
)
.await
{
Ok(confirmed_transaction) => {
let EncodedConfirmedTransactionWithStatusMeta {
block_time,
slot,
transaction: transaction_with_meta,
} = confirmed_transaction;
let decoded_transaction =
transaction_with_meta.transaction.decode().unwrap();
let json_transaction = decoded_transaction.json_encode();
transaction = Some(CliTransaction {
transaction: json_transaction,
meta: transaction_with_meta.meta,
block_time,
slot: Some(slot),
decoded_transaction,
prefix: " ".to_string(),
sigverify_status: vec![],
});
}
Err(err) => {
get_transaction_error = Some(format!("{:?}", err));
}
}
}
CliTransactionConfirmation {
confirmation_status: transaction_status.confirmation_status.clone(),
transaction,
get_transaction_error,
err: transaction_status.err.clone(),
}
} else {
CliTransactionConfirmation {
confirmation_status: None,
transaction: None,
get_transaction_error: None,
err: None,
}
};
Ok(config.output_format.formatted_string(&cli_transaction))
}
Err(err) => Err(CliError::RpcRequestError(format!("Unable to confirm: {}", err)).into()),
}
}
pub fn process_create_address_with_seed(
config: &CliConfig<'_>,
from_pubkey: Option<&Pubkey>,
seed: &str,
program_id: &Pubkey,
) -> ProcessResult {
let from_pubkey = if let Some(pubkey) = from_pubkey {
*pubkey
} else {
config.pubkey()?
};
let address = Pubkey::create_with_seed(&from_pubkey, seed, program_id)?;
Ok(address.to_string())
}
#[allow(clippy::unnecessary_wraps)]
pub fn process_decode_transaction(
config: &CliConfig<'_>,
transaction: &VersionedTransaction,
) -> ProcessResult {
let sigverify_status = CliSignatureVerificationStatus::verify_transaction(transaction);
let decode_transaction = CliTransaction {
decoded_transaction: transaction.clone(),
transaction: transaction.json_encode(),
meta: None,
block_time: None,
slot: None,
prefix: "".to_string(),
sigverify_status,
};
Ok(config.output_format.formatted_string(&decode_transaction))
}
#[allow(clippy::too_many_arguments)]
pub async fn process_transfer(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
amount: SpendAmount,
to: &Pubkey,
from: SignerIndex,
sign_only: bool,
dump_transaction_message: bool,
allow_unfunded_recipient: bool,
no_wait: bool,
blockhash_query: &BlockhashQuery,
nonce_account: Option<&Pubkey>,
nonce_authority: SignerIndex,
memo: Option<&String>,
fee_payer: SignerIndex,
derived_address_seed: Option<String>,
derived_address_program_id: Option<&Pubkey>,
) -> ProcessResult {
let from = config.signers[from];
let mut from_pubkey = from.pubkey();
let recent_blockhash = blockhash_query
.get_blockhash(rpc_client, config.commitment_config)
.await?;
if !sign_only && !allow_unfunded_recipient {
let recipient_balance = rpc_client
.get_balance_with_commitment(to, config.commitment_config)
.await?;
if recipient_balance == 0 {
return Err(format!(
"The recipient address ({}) is not funded. \
Add `--allow-unfunded-recipient` to complete the transfer \
",
to
)
.into());
}
}
let nonce_authority = config.signers[nonce_authority];
let fee_payer = config.signers[fee_payer];
let derived_parts = derived_address_seed.zip(derived_address_program_id);
let with_seed = if let Some((seed, program_id)) = derived_parts {
let base_pubkey = from_pubkey;
from_pubkey = Pubkey::create_with_seed(&base_pubkey, &seed, program_id)?;
Some((base_pubkey, seed, program_id, from_pubkey))
} else {
None
};
let build_message = |lamports| {
let ixs = if let Some((base_pubkey, seed, program_id, from_pubkey)) = with_seed.as_ref() {
vec![system_instruction::transfer_with_seed(
from_pubkey,
base_pubkey,
seed.clone(),
program_id,
to,
lamports,
)]
.with_memo(memo)
} else {
vec![system_instruction::transfer(&from_pubkey, to, lamports)].with_memo(memo)
};
if let Some(nonce_account) = &nonce_account {
Message::new_with_nonce(
ixs,
Some(&fee_payer.pubkey()),
nonce_account,
&nonce_authority.pubkey(),
)
} else {
Message::new(&ixs, Some(&fee_payer.pubkey()))
}
};
let (message, _) = resolve_spend_tx_and_check_account_balances(
rpc_client,
sign_only,
amount,
&recent_blockhash,
&from_pubkey,
&fee_payer.pubkey(),
build_message,
config.commitment_config,
)
.await?;
let mut tx = Transaction::new_unsigned(message);
if sign_only {
tx.try_partial_sign(&config.signers, recent_blockhash)?;
return_signers_with_config(
&tx,
&config.output_format,
&ReturnSignersConfig {
dump_transaction_message,
},
)
} else {
if let Some(nonce_account) = &nonce_account {
let nonce_account = nonce_utils::get_account_with_commitment(
rpc_client,
nonce_account,
config.commitment_config,
)
.await?;
check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
}
tx.try_sign(&config.signers, recent_blockhash)?;
let result = send_tx_wrapper(rpc_client, &tx, no_wait).await;
log_instruction_custom_error::<SystemError>(result, config)
}
}
async fn request_and_confirm_airdrop(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
to_pubkey: &Pubkey,
lamports: u64,
) -> SignatureResult {
let signature = rpc_client.request_airdrop(to_pubkey, lamports).await?;
let tx_success = rpc_client
.confirm_transaction_with_commitment(&signature, config.commitment_config)
.await?;
if !tx_success {
PgTerminal::log_wasm("Airdrop tx failed");
}
Ok(signature)
}
async fn send_tx_wrapper(
rpc_client: &WasmClient,
tx: &Transaction,
no_wait: bool,
) -> SignatureResult {
Ok(match no_wait {
true => rpc_client.send_transaction(tx).await?,
false => rpc_client.send_and_confirm_transaction(tx).await?,
})
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/vote.rs
|
use std::rc::Rc;
use clap::{Arg, ArgMatches, Command};
use solana_clap_v3_utils_wasm::{
fee_payer::{fee_payer_arg, FEE_PAYER_ARG},
input_parsers::*,
input_validators::*,
keypair::{generate_unique_signers, SignerIndex},
memo::{memo_arg, MEMO_ARG},
nonce::*,
offline::*,
};
use solana_cli_output_wasm::cli_output::{
return_signers_with_config, CliEpochVotingHistory, CliLockout, CliVoteAccount,
ReturnSignersConfig,
};
use solana_client_wasm::{
utils::{nonce_utils, rpc_config::BlockhashQuery},
WasmClient,
};
use solana_extra_wasm::program::vote::{
vote_error::VoteError,
vote_instruction,
vote_state::{VoteAuthorize, VoteState},
};
use solana_playground_utils_wasm::js::PgTerminal;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
account::Account, commitment_config::CommitmentConfig, message::Message, pubkey::Pubkey,
signer::Signer, transaction::Transaction,
};
use super::{
nonce::check_nonce_account,
stake::{check_current_authority, fetch_epoch_rewards},
};
use crate::{
cli::{
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
ProcessResult,
},
utils::{
blockhash_query::blockhash_query_from_matches,
checks::{check_account_for_fee_with_commitment, check_unique_pubkeys},
memo::WithMemo,
},
};
pub trait VoteSubCommands {
fn vote_subcommands(self) -> Self;
}
impl VoteSubCommands for Command<'_> {
fn vote_subcommands(self) -> Self {
// self.subcommand(
// Command::new("create-vote-account")
// .about("Create a vote account")
// .arg(
// Arg::new("vote_account")
// .index(1)
// .value_name("ACCOUNT_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Vote account keypair to create"),
// )
// .arg(
// Arg::new("identity_account")
// .index(2)
// .value_name("IDENTITY_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Keypair of validator that will vote with this account"),
// )
// .arg(
// pubkey!(Arg::new("authorized_withdrawer")
// .index(3)
// .value_name("WITHDRAWER_PUBKEY")
// .takes_value(true)
// .required(true)
// .long("authorized-withdrawer"),
// "Public key of the authorized withdrawer")
// )
// .arg(
// Arg::new("commission")
// .long("commission")
// .value_name("PERCENTAGE")
// .takes_value(true)
// .default_value("100")
// .help("The commission taken on reward redemption (0-100)"),
// )
// .arg(
// pubkey!(Arg::new("authorized_voter")
// .long("authorized-voter")
// .value_name("VOTER_PUBKEY"),
// "Public key of the authorized voter [default: validator identity pubkey]. "),
// )
// .arg(
// Arg::new("allow_unsafe_authorized_withdrawer")
// .long("allow-unsafe-authorized-withdrawer")
// .takes_value(false)
// .help("Allow an authorized withdrawer pubkey to be identical to the validator identity \
// account pubkey or vote account pubkey, which is normally an unsafe \
// configuration and should be avoided."),
// )
// .arg(
// Arg::new("seed")
// .long("seed")
// .value_name("STRING")
// .takes_value(true)
// .help("Seed for address generation; if specified, the resulting account will be at a derived address of the VOTE ACCOUNT pubkey")
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("vote-authorize-voter")
// .about("Authorize a new vote signing keypair for the given vote account")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account in which to set the authorized voter. "),
// )
// .arg(
// Arg::new("authorized")
// .index(2)
// .value_name("AUTHORIZED_KEYPAIR")
// .required(true)
// .validator(is_valid_signer)
// .help("Current authorized vote signer."),
// )
// .arg(
// pubkey!(Arg::new("new_authorized_pubkey")
// .index(3)
// .value_name("NEW_AUTHORIZED_PUBKEY")
// .required(true),
// "New authorized vote signer. "),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
self.subcommand(
Command::new("vote-authorize-withdrawer")
.about("Authorize a new withdraw signing keypair for the given vote account")
.arg(
pubkey!(Arg::new("vote_account_pubkey")
.index(1)
.value_name("VOTE_ACCOUNT_ADDRESS")
.required(true),
"Vote account in which to set the authorized withdrawer. "),
)
// TODO: We are using the default keypair in WASM
// .arg(
// Arg::new("authorized")
// .index(2)
// .value_name("AUTHORIZED_KEYPAIR")
// .required(true)
// .validator(is_valid_signer)
// .help("Current authorized withdrawer."),
// )
.arg(
pubkey!(Arg::new("new_authorized_pubkey")
.index(3)
.value_name("AUTHORIZED_PUBKEY")
.required(true),
"New authorized withdrawer. "),
)
.offline_args()
.nonce_args(false)
.arg(fee_payer_arg())
.arg(memo_arg())
)
// .subcommand(
// Command::new("vote-authorize-voter-checked")
// .about("Authorize a new vote signing keypair for the given vote account, \
// checking the new authority as a signer")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account in which to set the authorized voter. "),
// )
// .arg(
// Arg::new("authorized")
// .index(2)
// .value_name("AUTHORIZED_KEYPAIR")
// .required(true)
// .validator(is_valid_signer)
// .help("Current authorized vote signer."),
// )
// .arg(
// Arg::new("new_authorized")
// .index(3)
// .value_name("NEW_AUTHORIZED_KEYPAIR")
// .required(true)
// .validator(is_valid_signer)
// .help("New authorized vote signer."),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("vote-authorize-withdrawer-checked")
// .about("Authorize a new withdraw signing keypair for the given vote account, \
// checking the new authority as a signer")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account in which to set the authorized withdrawer. "),
// )
// .arg(
// Arg::new("authorized")
// .index(2)
// .value_name("AUTHORIZED_KEYPAIR")
// .required(true)
// .validator(is_valid_signer)
// .help("Current authorized withdrawer."),
// )
// .arg(
// Arg::new("new_authorized")
// .index(3)
// .value_name("NEW_AUTHORIZED_KEYPAIR")
// .required(true)
// .validator(is_valid_signer)
// .help("New authorized withdrawer."),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("vote-update-validator")
// .about("Update the vote account's validator identity")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account to update. "),
// )
// .arg(
// Arg::new("new_identity_account")
// .index(2)
// .value_name("IDENTITY_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Keypair of new validator that will vote with this account"),
// )
// .arg(
// Arg::new("authorized_withdrawer")
// .index(3)
// .value_name("AUTHORIZED_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Authorized withdrawer keypair"),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
// .subcommand(
// Command::new("vote-update-commission")
// .about("Update the vote account's commission")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account to update. "),
// )
// .arg(
// Arg::new("commission")
// .index(2)
// .value_name("PERCENTAGE")
// .takes_value(true)
// .required(true)
// .validator(is_valid_percentage)
// .help("The new commission")
// )
// .arg(
// Arg::new("authorized_withdrawer")
// .index(3)
// .value_name("AUTHORIZED_KEYPAIR")
// .takes_value(true)
// .required(true)
// .validator(is_valid_signer)
// .help("Authorized withdrawer keypair"),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg())
// )
.subcommand(
Command::new("vote-account")
.about("Show the contents of a vote account")
.alias("show-vote-account")
.arg(
pubkey!(Arg::new("vote_account_pubkey")
.index(1)
.value_name("VOTE_ACCOUNT_ADDRESS")
.required(true),
"Vote account pubkey. "),
)
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
)
.arg(
Arg::new("with_rewards")
.long("with-rewards")
.takes_value(false)
.help("Display inflation rewards"),
)
.arg(
Arg::new("num_rewards_epochs")
.long("num-rewards-epochs")
.takes_value(true)
.value_name("NUM")
.validator(|s| is_within_range(s, 1, 10))
.default_value_if("with_rewards", None, Some("1"))
.requires("with_rewards")
.help("Display rewards for NUM recent epochs, max 10 [default: latest epoch only]"),
),
)
// .subcommand(
// Command::new("withdraw-from-vote-account")
// .about("Withdraw lamports from a vote account into a specified account")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account from which to withdraw. "),
// )
// .arg(
// pubkey!(Arg::new("destination_account_pubkey")
// .index(2)
// .value_name("RECIPIENT_ADDRESS")
// .required(true),
// "The recipient of withdrawn SOL. "),
// )
// .arg(
// Arg::new("amount")
// .index(3)
// .value_name("AMOUNT")
// .takes_value(true)
// .required(true)
// .validator(is_amount_or_all)
// .help("The amount to withdraw, in SOL; accepts keyword ALL, which for this command means account balance minus rent-exempt minimum"),
// )
// .arg(
// Arg::new("authorized_withdrawer")
// .long("authorized-withdrawer")
// .value_name("AUTHORIZED_KEYPAIR")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Authorized withdrawer [default: cli config keypair]"),
// )
// .offline_args()
// .nonce_args(false)
// .arg(fee_payer_arg())
// .arg(memo_arg()
// )
// )
// .subcommand(
// Command::new("close-vote-account")
// .about("Close a vote account and withdraw all funds remaining")
// .arg(
// pubkey!(Arg::new("vote_account_pubkey")
// .index(1)
// .value_name("VOTE_ACCOUNT_ADDRESS")
// .required(true),
// "Vote account to be closed. "),
// )
// .arg(
// pubkey!(Arg::new("destination_account_pubkey")
// .index(2)
// .value_name("RECIPIENT_ADDRESS")
// .required(true),
// "The recipient of all withdrawn SOL. "),
// )
// .arg(
// Arg::new("authorized_withdrawer")
// .long("authorized-withdrawer")
// .value_name("AUTHORIZED_KEYPAIR")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Authorized withdrawer [default: cli config keypair]"),
// )
// .arg(fee_payer_arg())
// .arg(memo_arg()
// )
// )
}
}
// pub fn parse_create_vote_account(
// matches: &ArgMatches,
// default_signer: Box<dyn Signer>,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let (vote_account, vote_account_pubkey) = signer_of(matches, "vote_account", wallet_manager)?;
// let seed = matches.value_of("seed").map(|s| s.to_string());
// let (identity_account, identity_pubkey) =
// signer_of(matches, "identity_account", wallet_manager)?;
// let commission = value_t_or_exit!(matches, "commission", u8);
// let authorized_voter = pubkey_of_signer(matches, "authorized_voter", wallet_manager)?;
// let authorized_withdrawer =
// pubkey_of_signer(matches, "authorized_withdrawer", wallet_manager)?.unwrap();
// let allow_unsafe = matches.is_present("allow_unsafe_authorized_withdrawer");
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of_signer(matches, NONCE_ARG.name, wallet_manager)?;
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// if !allow_unsafe {
// if authorized_withdrawer == vote_account_pubkey.unwrap() {
// return Err(CliError::BadParameter(
// "Authorized withdrawer pubkey is identical to vote \
// account pubkey, an unsafe configuration"
// .to_owned(),
// ));
// }
// if authorized_withdrawer == identity_pubkey.unwrap() {
// return Err(CliError::BadParameter(
// "Authorized withdrawer pubkey is identical to identity \
// account pubkey, an unsafe configuration"
// .to_owned(),
// ));
// }
// }
// let mut bulk_signers = vec![fee_payer, vote_account, identity_account];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::CreateVoteAccount {
// vote_account: signer_info.index_of(vote_account_pubkey).unwrap(),
// seed,
// identity_account: signer_info.index_of(identity_pubkey).unwrap(),
// authorized_voter,
// authorized_withdrawer,
// commission,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
pub fn parse_vote_authorize(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
vote_authorize: VoteAuthorize,
checked: bool,
) -> Result<CliCommandInfo, CliError> {
let vote_account_pubkey =
pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
// TODO: We are using the default keypair in WASM
// let (authorized, authorized_pubkey) = signer_of(matches, "authorized", wallet_manager)?;
let authorized = default_signer;
let authorized_pubkey = authorized.pubkey();
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
let blockhash_query = blockhash_query_from_matches(matches);
let nonce_account = pubkey_of(matches, NONCE_ARG.name);
let memo = matches.value_of(MEMO_ARG.name).map(String::from);
let (nonce_authority, nonce_authority_pubkey) =
signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
let mut bulk_signers = vec![fee_payer];
let new_authorized_pubkey = if checked {
let (new_authorized_signer, new_authorized_pubkey) =
signer_of(matches, "new_authorized", wallet_manager)?;
bulk_signers.push(new_authorized_signer);
new_authorized_pubkey.unwrap()
} else {
pubkey_of_signer(matches, "new_authorized_pubkey", wallet_manager)?.unwrap()
};
if nonce_account.is_some() {
bulk_signers.push(nonce_authority);
}
let signer_info = generate_unique_signers(authorized, bulk_signers)?;
Ok(CliCommandInfo {
command: CliCommand::VoteAuthorize {
vote_account_pubkey,
new_authorized_pubkey,
vote_authorize,
sign_only,
dump_transaction_message,
blockhash_query,
nonce_account,
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
memo,
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
authorized: signer_info.index_of(Some(authorized_pubkey)).unwrap(),
new_authorized: if checked {
signer_info.index_of(Some(new_authorized_pubkey))
} else {
None
},
},
signers: signer_info.signers,
})
}
// pub fn parse_vote_update_validator(
// matches: &ArgMatches,
// default_signer: Box<dyn Signer>,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let vote_account_pubkey =
// pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
// let (new_identity_account, new_identity_pubkey) =
// signer_of(matches, "new_identity_account", wallet_manager)?;
// let (authorized_withdrawer, authorized_withdrawer_pubkey) =
// signer_of(matches, "authorized_withdrawer", wallet_manager)?;
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![fee_payer, authorized_withdrawer, new_identity_account];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::VoteUpdateValidator {
// vote_account_pubkey,
// new_identity_account: signer_info.index_of(new_identity_pubkey).unwrap(),
// withdraw_authority: signer_info.index_of(authorized_withdrawer_pubkey).unwrap(),
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_vote_update_commission(
// matches: &ArgMatches,
// default_signer: Box<dyn Signer>,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let vote_account_pubkey =
// pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
// let (authorized_withdrawer, authorized_withdrawer_pubkey) =
// signer_of(matches, "authorized_withdrawer", wallet_manager)?;
// let commission = value_t_or_exit!(matches, "commission", u8);
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![fee_payer, authorized_withdrawer];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::VoteUpdateCommission {
// vote_account_pubkey,
// commission,
// withdraw_authority: signer_info.index_of(authorized_withdrawer_pubkey).unwrap(),
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
pub fn parse_vote_get_account_command(
matches: &ArgMatches,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let vote_account_pubkey =
pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
let use_lamports_unit = matches.is_present("lamports");
let with_rewards = if matches.is_present("with_rewards") {
Some(value_of(matches, "num_rewards_epochs").unwrap())
} else {
None
};
Ok(CliCommandInfo {
command: CliCommand::ShowVoteAccount {
pubkey: vote_account_pubkey,
use_lamports_unit,
with_rewards,
},
signers: vec![],
})
}
// pub fn parse_withdraw_from_vote_account(
// matches: &ArgMatches,
// default_signer: Box<dyn Signer>,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let vote_account_pubkey =
// pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
// let destination_account_pubkey =
// pubkey_of_signer(matches, "destination_account_pubkey", wallet_manager)?.unwrap();
// let mut withdraw_amount = SpendAmount::new_from_matches(matches, "amount");
// // As a safeguard for vote accounts for running validators, `ALL` withdraws only the amount in
// // excess of the rent-exempt minimum. In order to close the account with this subcommand, a
// // validator must specify the withdrawal amount precisely.
// if withdraw_amount == SpendAmount::All {
// withdraw_amount = SpendAmount::RentExempt;
// }
// let (withdraw_authority, withdraw_authority_pubkey) =
// signer_of(matches, "authorized_withdrawer", wallet_manager)?;
// let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
// let dump_transaction_message = matches.is_present(DUMP_TRANSACTION_MESSAGE.name);
// let blockhash_query = BlockhashQuery::new_from_matches(matches);
// let nonce_account = pubkey_of(matches, NONCE_ARG.name);
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// let (nonce_authority, nonce_authority_pubkey) =
// signer_of(matches, NONCE_AUTHORITY_ARG.name, wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let mut bulk_signers = vec![fee_payer, withdraw_authority];
// if nonce_account.is_some() {
// bulk_signers.push(nonce_authority);
// }
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// Ok(CliCommandInfo {
// command: CliCommand::WithdrawFromVoteAccount {
// vote_account_pubkey,
// destination_account_pubkey,
// withdraw_authority: signer_info.index_of(withdraw_authority_pubkey).unwrap(),
// withdraw_amount,
// sign_only,
// dump_transaction_message,
// blockhash_query,
// nonce_account,
// nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// pub fn parse_close_vote_account(
// matches: &ArgMatches,
// default_signer: Box<dyn Signer>,
// wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
// ) -> Result<CliCommandInfo, CliError> {
// let vote_account_pubkey =
// pubkey_of_signer(matches, "vote_account_pubkey", wallet_manager)?.unwrap();
// let destination_account_pubkey =
// pubkey_of_signer(matches, "destination_account_pubkey", wallet_manager)?.unwrap();
// let (withdraw_authority, withdraw_authority_pubkey) =
// signer_of(matches, "authorized_withdrawer", wallet_manager)?;
// let (fee_payer, fee_payer_pubkey) = signer_of(matches, FEE_PAYER_ARG.name, wallet_manager)?;
// let signer_info = default_signer.generate_unique_signers(
// vec![fee_payer, withdraw_authority],
// matches,
// wallet_manager,
// )?;
// let memo = matches.value_of(MEMO_ARG.name).map(String::from);
// Ok(CliCommandInfo {
// command: CliCommand::CloseVoteAccount {
// vote_account_pubkey,
// destination_account_pubkey,
// withdraw_authority: signer_info.index_of(withdraw_authority_pubkey).unwrap(),
// memo,
// fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
// },
// signers: signer_info.signers,
// })
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_create_vote_account(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// vote_account: SignerIndex,
// seed: &Option<String>,
// identity_account: SignerIndex,
// authorized_voter: &Option<Pubkey>,
// authorized_withdrawer: Pubkey,
// commission: u8,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<&Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let vote_account = config.signers[vote_account];
// let vote_account_pubkey = vote_account.pubkey();
// let vote_account_address = if let Some(seed) = seed {
// Pubkey::create_with_seed(&vote_account_pubkey, seed, &solana_vote_program::id())?
// } else {
// vote_account_pubkey
// };
// check_unique_pubkeys(
// (&config.signers[0].pubkey(), "cli keypair".to_string()),
// (&vote_account_address, "vote_account".to_string()),
// )?;
// let identity_account = config.signers[identity_account];
// let identity_pubkey = identity_account.pubkey();
// check_unique_pubkeys(
// (&vote_account_address, "vote_account".to_string()),
// (&identity_pubkey, "identity_pubkey".to_string()),
// )?;
// let required_balance = rpc_client
// .get_minimum_balance_for_rent_exemption(VoteState::size_of())?
// .max(1);
// let amount = SpendAmount::Some(required_balance);
// let fee_payer = config.signers[fee_payer];
// let nonce_authority = config.signers[nonce_authority];
// let build_message = |lamports| {
// let vote_init = VoteInit {
// node_pubkey: identity_pubkey,
// authorized_voter: authorized_voter.unwrap_or(identity_pubkey),
// authorized_withdrawer,
// commission,
// };
// let ixs = if let Some(seed) = seed {
// vote_instruction::create_account_with_seed(
// &config.signers[0].pubkey(), // from
// &vote_account_address, // to
// &vote_account_pubkey, // base
// seed, // seed
// &vote_init,
// lamports,
// )
// .with_memo(memo)
// } else {
// vote_instruction::create_account(
// &config.signers[0].pubkey(),
// &vote_account_pubkey,
// &vote_init,
// lamports,
// )
// .with_memo(memo)
// };
// if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// }
// };
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment_config)?;
// let (message, _) = resolve_spend_tx_and_check_account_balances(
// rpc_client,
// sign_only,
// amount,
// &recent_blockhash,
// &config.signers[0].pubkey(),
// &fee_payer.pubkey(),
// build_message,
// config.commitment_config,
// )?;
// if !sign_only {
// if let Ok(response) =
// rpc_client.get_account_with_commitment(&vote_account_address, config.commitment_config)
// {
// if let Some(vote_account) = response.value {
// let err_msg = if vote_account.owner == solana_vote_program::id() {
// format!("Vote account {} already exists", vote_account_address)
// } else {
// format!(
// "Account {} already exists and is not a vote account",
// vote_account_address
// )
// };
// return Err(CliError::BadParameter(err_msg).into());
// }
// }
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment_config,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// }
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// let result = rpc_client.send_and_confirm_transaction(&tx).await;
// log_instruction_custom_error::<SystemError>(result, config)
// }
// }
#[allow(clippy::too_many_arguments)]
pub async fn process_vote_authorize(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
vote_account_pubkey: &Pubkey,
new_authorized_pubkey: &Pubkey,
vote_authorize: VoteAuthorize,
authorized: SignerIndex,
new_authorized: Option<SignerIndex>,
sign_only: bool,
dump_transaction_message: bool,
blockhash_query: &BlockhashQuery,
nonce_account: Option<Pubkey>,
nonce_authority: SignerIndex,
memo: Option<&String>,
fee_payer: SignerIndex,
) -> ProcessResult {
let authorized = config.signers[authorized];
let new_authorized_signer = new_authorized.map(|index| config.signers[index]);
let vote_state = if !sign_only {
Some(
get_vote_account(rpc_client, vote_account_pubkey, config.commitment_config)
.await?
.1,
)
} else {
None
};
match vote_authorize {
VoteAuthorize::Voter => {
if let Some(vote_state) = vote_state {
let current_epoch = rpc_client.get_epoch_info().await?.epoch;
let current_authorized_voter = vote_state
.authorized_voters()
.get_authorized_voter(current_epoch)
.ok_or_else(|| {
CliError::RpcRequestError(
"Invalid vote account state; no authorized voters found".to_string(),
)
})?;
check_current_authority(
&[current_authorized_voter, vote_state.authorized_withdrawer],
&authorized.pubkey(),
)?;
if let Some(signer) = new_authorized_signer {
if signer.is_interactive() {
return Err(CliError::BadParameter(format!(
"invalid new authorized vote signer {:?}. Interactive vote signers not supported",
new_authorized_pubkey
)).into());
}
}
}
}
VoteAuthorize::Withdrawer => {
check_unique_pubkeys(
(&authorized.pubkey(), "authorized_account".to_string()),
(new_authorized_pubkey, "new_authorized_pubkey".to_string()),
)?;
if let Some(vote_state) = vote_state {
check_current_authority(&[vote_state.authorized_withdrawer], &authorized.pubkey())?
}
}
}
let vote_ix = if new_authorized_signer.is_some() {
vote_instruction::authorize_checked(
vote_account_pubkey, // vote account to update
&authorized.pubkey(), // current authorized
new_authorized_pubkey, // new vote signer/withdrawer
vote_authorize, // vote or withdraw
)
} else {
vote_instruction::authorize(
vote_account_pubkey, // vote account to update
&authorized.pubkey(), // current authorized
new_authorized_pubkey, // new vote signer/withdrawer
vote_authorize, // vote or withdraw
)
};
let ixs = vec![vote_ix].with_memo(memo);
let recent_blockhash = blockhash_query
.get_blockhash(rpc_client, config.commitment_config)
.await?;
let nonce_authority = config.signers[nonce_authority];
let fee_payer = config.signers[fee_payer];
let message = if let Some(nonce_account) = &nonce_account {
Message::new_with_nonce(
ixs,
Some(&fee_payer.pubkey()),
nonce_account,
&nonce_authority.pubkey(),
)
} else {
Message::new(&ixs, Some(&fee_payer.pubkey()))
};
let mut tx = Transaction::new_unsigned(message);
if sign_only {
tx.try_partial_sign(&config.signers, recent_blockhash)?;
return_signers_with_config(
&tx,
&config.output_format,
&ReturnSignersConfig {
dump_transaction_message,
},
)
} else {
tx.try_sign(&config.signers, recent_blockhash)?;
if let Some(nonce_account) = &nonce_account {
let nonce_account = nonce_utils::get_account_with_commitment(
rpc_client,
nonce_account,
config.commitment_config,
)
.await?;
check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
}
check_account_for_fee_with_commitment(
rpc_client,
&config.signers[0].pubkey(),
&tx.message,
config.commitment_config,
)
.await?;
let result = rpc_client.send_and_confirm_transaction(&tx).await;
log_instruction_custom_error::<VoteError>(result, config)
}
}
// #[allow(clippy::too_many_arguments)]
// pub fn process_vote_update_validator(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// vote_account_pubkey: &Pubkey,
// new_identity_account: SignerIndex,
// withdraw_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let authorized_withdrawer = config.signers[withdraw_authority];
// let new_identity_account = config.signers[new_identity_account];
// let new_identity_pubkey = new_identity_account.pubkey();
// check_unique_pubkeys(
// (vote_account_pubkey, "vote_account_pubkey".to_string()),
// (&new_identity_pubkey, "new_identity_account".to_string()),
// )?;
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment_config)?;
// let ixs = vec![vote_instruction::update_validator_identity(
// vote_account_pubkey,
// &authorized_withdrawer.pubkey(),
// &new_identity_pubkey,
// )]
// .with_memo(memo);
// let nonce_authority = config.signers[nonce_authority];
// let fee_payer = config.signers[fee_payer];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment_config,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &config.signers[0].pubkey(),
// &tx.message,
// config.commitment_config,
// )?;
// let result = rpc_client.send_and_confirm_transaction(&tx).await;
// log_instruction_custom_error::<VoteError>(result, config)
// }
// }
// #[allow(clippy::too_many_arguments)]
// pub fn process_vote_update_commission(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// vote_account_pubkey: &Pubkey,
// commission: u8,
// withdraw_authority: SignerIndex,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let authorized_withdrawer = config.signers[withdraw_authority];
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment_config)?;
// let ixs = vec![vote_instruction::update_commission(
// vote_account_pubkey,
// &authorized_withdrawer.pubkey(),
// commission,
// )]
// .with_memo(memo);
// let nonce_authority = config.signers[nonce_authority];
// let fee_payer = config.signers[fee_payer];
// let message = if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// };
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment_config,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &config.signers[0].pubkey(),
// &tx.message,
// config.commitment_config,
// )?;
// let result = rpc_client.send_and_confirm_transaction(&tx).await;
// log_instruction_custom_error::<VoteError>(result, config)
// }
// }
pub(crate) async fn get_vote_account(
rpc_client: &WasmClient,
vote_account_pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<(Account, VoteState), Box<dyn std::error::Error>> {
let vote_account = rpc_client
.get_account_with_commitment(vote_account_pubkey, commitment_config)
.await?
.ok_or_else(|| {
CliError::RpcRequestError(format!("{:?} account does not exist", vote_account_pubkey))
})?;
if vote_account.owner != solana_extra_wasm::program::vote::id() {
return Err(CliError::RpcRequestError(format!(
"{:?} is not a vote account",
vote_account_pubkey
))
.into());
}
let vote_state = VoteState::deserialize(&vote_account.data).map_err(|_| {
CliError::RpcRequestError(
"Account data could not be deserialized to vote state".to_string(),
)
})?;
Ok((vote_account, vote_state))
}
pub async fn process_show_vote_account(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
vote_account_address: &Pubkey,
use_lamports_unit: bool,
with_rewards: Option<usize>,
) -> ProcessResult {
let (vote_account, vote_state) =
get_vote_account(rpc_client, vote_account_address, config.commitment_config).await?;
let epoch_schedule = rpc_client.get_epoch_schedule().await?;
let mut votes: Vec<CliLockout> = vec![];
let mut epoch_voting_history: Vec<CliEpochVotingHistory> = vec![];
if !vote_state.votes.is_empty() {
for vote in &vote_state.votes {
votes.push(vote.into());
}
for (epoch, credits, prev_credits) in vote_state.epoch_credits().iter().copied() {
let credits_earned = credits - prev_credits;
let slots_in_epoch = epoch_schedule.get_slots_in_epoch(epoch);
epoch_voting_history.push(CliEpochVotingHistory {
epoch,
slots_in_epoch,
credits_earned,
credits,
prev_credits,
});
}
}
// NOTE: async closures are unstable
// let epoch_rewards = with_rewards.and_then(|num_epochs| {
// match fetch_epoch_rewards(rpc_client, vote_account_address, num_epochs).await {
// Ok(rewards) => Some(rewards),
// Err(error) => {
// PgTerminal::log_wasm("Failed to fetch epoch rewards: {:?}", error);
// None
// }
// }
// });
let epoch_rewards = if with_rewards.is_some() {
match fetch_epoch_rewards(rpc_client, vote_account_address, with_rewards.unwrap()).await {
Ok(rewards) => Some(rewards),
Err(error) => {
PgTerminal::log_wasm(&format!("Failed to fetch epoch rewards: {:?}", error));
None
}
}
} else {
None
};
let vote_account_data = CliVoteAccount {
account_balance: vote_account.lamports,
validator_identity: vote_state.node_pubkey.to_string(),
authorized_voters: vote_state.authorized_voters().into(),
authorized_withdrawer: vote_state.authorized_withdrawer.to_string(),
credits: vote_state.credits(),
commission: vote_state.commission,
root_slot: vote_state.root_slot,
recent_timestamp: vote_state.last_timestamp.clone(),
votes,
epoch_voting_history,
use_lamports_unit,
epoch_rewards,
};
Ok(config.output_format.formatted_string(&vote_account_data))
}
// #[allow(clippy::too_many_arguments)]
// pub fn process_withdraw_from_vote_account(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// vote_account_pubkey: &Pubkey,
// withdraw_authority: SignerIndex,
// withdraw_amount: SpendAmount,
// destination_account_pubkey: &Pubkey,
// sign_only: bool,
// dump_transaction_message: bool,
// blockhash_query: &BlockhashQuery,
// nonce_account: Option<&Pubkey>,
// nonce_authority: SignerIndex,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let withdraw_authority = config.signers[withdraw_authority];
// let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment_config)?;
// let fee_payer = config.signers[fee_payer];
// let nonce_authority = config.signers[nonce_authority];
// let build_message = |lamports| {
// let ixs = vec![withdraw(
// vote_account_pubkey,
// &withdraw_authority.pubkey(),
// lamports,
// destination_account_pubkey,
// )]
// .with_memo(memo);
// if let Some(nonce_account) = &nonce_account {
// Message::new_with_nonce(
// ixs,
// Some(&fee_payer.pubkey()),
// nonce_account,
// &nonce_authority.pubkey(),
// )
// } else {
// Message::new(&ixs, Some(&fee_payer.pubkey()))
// }
// };
// let (message, _) = resolve_spend_tx_and_check_account_balances(
// rpc_client,
// sign_only,
// withdraw_amount,
// &recent_blockhash,
// vote_account_pubkey,
// &fee_payer.pubkey(),
// build_message,
// config.commitment_config,
// )?;
// if !sign_only {
// let current_balance = rpc_client.get_balance(vote_account_pubkey)?;
// let minimum_balance =
// rpc_client.get_minimum_balance_for_rent_exemption(VoteState::size_of())?;
// if let SpendAmount::Some(withdraw_amount) = withdraw_amount {
// let balance_remaining = current_balance.saturating_sub(withdraw_amount);
// if balance_remaining < minimum_balance && balance_remaining != 0 {
// return Err(CliError::BadParameter(format!(
// "Withdraw amount too large. The vote account balance must be at least {} SOL to remain rent exempt", lamports_to_sol(minimum_balance)
// ))
// .into());
// }
// }
// }
// let mut tx = Transaction::new_unsigned(message);
// if sign_only {
// tx.try_partial_sign(&config.signers, recent_blockhash)?;
// return_signers_with_config(
// &tx,
// &config.output_format,
// &ReturnSignersConfig {
// dump_transaction_message,
// },
// )
// } else {
// tx.try_sign(&config.signers, recent_blockhash)?;
// if let Some(nonce_account) = &nonce_account {
// let nonce_account = nonce_utils::get_account_with_commitment(
// rpc_client,
// nonce_account,
// config.commitment_config,
// )?;
// check_nonce_account(&nonce_account, &nonce_authority.pubkey(), &recent_blockhash)?;
// }
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment_config,
// )?;
// let result = rpc_client.send_and_confirm_transaction(&tx).await;
// log_instruction_custom_error::<VoteError>(result, config)
// }
// }
// pub fn process_close_vote_account(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// vote_account_pubkey: &Pubkey,
// withdraw_authority: SignerIndex,
// destination_account_pubkey: &Pubkey,
// memo: Option<&String>,
// fee_payer: SignerIndex,
// ) -> ProcessResult {
// let vote_account_status =
// rpc_client.get_vote_accounts_with_config(RpcGetVoteAccountsConfig {
// vote_pubkey: Some(vote_account_pubkey.to_string()),
// ..RpcGetVoteAccountsConfig::default()
// })?;
// if let Some(vote_account) = vote_account_status
// .current
// .into_iter()
// .chain(vote_account_status.delinquent.into_iter())
// .next()
// {
// if vote_account.activated_stake != 0 {
// return Err(format!(
// "Cannot close a vote account with active stake: {}",
// vote_account_pubkey
// )
// .into());
// }
// }
// let latest_blockhash = rpc_client.get_latest_blockhash()?;
// let withdraw_authority = config.signers[withdraw_authority];
// let fee_payer = config.signers[fee_payer];
// let current_balance = rpc_client.get_balance(vote_account_pubkey)?;
// let ixs = vec![withdraw(
// vote_account_pubkey,
// &withdraw_authority.pubkey(),
// current_balance,
// destination_account_pubkey,
// )]
// .with_memo(memo);
// let message = Message::new(&ixs, Some(&fee_payer.pubkey()));
// let mut tx = Transaction::new_unsigned(message);
// tx.try_sign(&config.signers, latest_blockhash)?;
// check_account_for_fee_with_commitment(
// rpc_client,
// &tx.message.account_keys[0],
// &tx.message,
// config.commitment_config,
// )?;
// let result = rpc_client.send_and_confirm_transaction(&tx).await;
// log_instruction_custom_error::<VoteError>(result, config)
// }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src
|
solana_public_repos/solana-playground/solana-playground/wasm/solana-cli/src/commands/program.rs
|
use std::{mem::size_of, rc::Rc, str::FromStr};
use clap::{Arg, ArgMatches, Command};
use solana_clap_v3_utils_wasm::{
input_parsers::{pubkey_of, pubkey_of_signer, signer_of},
input_validators::is_valid_signer,
keypair::{generate_unique_signers, SignerIndex},
};
use solana_cli_output_wasm::cli_output::{
CliProgram, CliProgramAccountType, CliProgramAuthority, CliUpgradeableBuffer,
CliUpgradeableBuffers, CliUpgradeableProgram, CliUpgradeableProgramClosed,
CliUpgradeablePrograms,
};
use solana_client_wasm::{
utils::{
rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, RpcSendTransactionConfig},
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
},
WasmClient,
};
use solana_extra_wasm::account_decoder::{UiAccountEncoding, UiDataSliceConfig};
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
account::Account,
account_utils::StateMut,
bpf_loader, bpf_loader_deprecated,
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
message::Message,
pubkey::Pubkey,
signature::Signer,
transaction::Transaction,
};
use crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult};
#[derive(Debug, PartialEq, Eq)]
pub enum ProgramCliCommand {
// Deploy {
// program_location: Option<String>,
// program_signer_index: Option<SignerIndex>,
// program_pubkey: Option<Pubkey>,
// buffer_signer_index: Option<SignerIndex>,
// buffer_pubkey: Option<Pubkey>,
// upgrade_authority_signer_index: SignerIndex,
// is_final: bool,
// max_len: Option<usize>,
// allow_excessive_balance: bool,
// skip_fee_check: bool,
// },
// WriteBuffer {
// program_location: String,
// buffer_signer_index: Option<SignerIndex>,
// buffer_pubkey: Option<Pubkey>,
// buffer_authority_signer_index: Option<SignerIndex>,
// max_len: Option<usize>,
// skip_fee_check: bool,
// },
SetBufferAuthority {
buffer_pubkey: Pubkey,
buffer_authority_index: Option<SignerIndex>,
new_buffer_authority: Pubkey,
},
SetUpgradeAuthority {
program_pubkey: Pubkey,
upgrade_authority_index: Option<SignerIndex>,
new_upgrade_authority: Option<Pubkey>,
},
Show {
account_pubkey: Option<Pubkey>,
authority_pubkey: Pubkey,
get_programs: bool,
get_buffers: bool,
all: bool,
use_lamports_unit: bool,
},
// Dump {
// account_pubkey: Option<Pubkey>,
// output_location: String,
// },
Close {
account_pubkey: Option<Pubkey>,
recipient_pubkey: Pubkey,
authority_index: SignerIndex,
use_lamports_unit: bool,
},
}
pub trait ProgramSubCommands {
fn program_subcommands(self) -> Self;
}
impl ProgramSubCommands for Command<'_> {
fn program_subcommands(self) -> Self {
self.subcommand(
Command::new("program")
.about("Program management")
.subcommand_required(true)
.arg_required_else_help(true)
.arg(
Arg::new("skip_fee_check")
.long("skip-fee-check")
.hide(true)
.takes_value(false)
.global(true),
)
// .subcommand(
// Command::new("deploy")
// .about("Deploy a program")
// .arg(
// Arg::new("program_location")
// .index(1)
// .value_name("PROGRAM_FILEPATH")
// .takes_value(true)
// .help("/path/to/program.so"),
// )
// .arg(
// Arg::new("buffer")
// .long("buffer")
// .value_name("BUFFER_SIGNER")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Intermediate buffer account to write data to, which can be used to resume a failed deploy \
// [default: random address]")
// )
// .arg(
// Arg::new("upgrade_authority")
// .long("upgrade-authority")
// .value_name("UPGRADE_AUTHORITY_SIGNER")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Upgrade authority [default: the default configured keypair]")
// )
// .arg(
// pubkey!(Arg::new("program_id")
// .long("program-id")
// .value_name("PROGRAM_ID"),
// "Executable program's address, must be a keypair for initial deploys, can be a pubkey for upgrades \
// [default: address of keypair at /path/to/program-keypair.json if present, otherwise a random address]"),
// )
// .arg(
// Arg::new("final")
// .long("final")
// .help("The program will not be upgradeable")
// )
// .arg(
// Arg::new("max_len")
// .long("max-len")
// .value_name("max_len")
// .takes_value(true)
// .required(false)
// .help("Maximum length of the upgradeable program \
// [default: twice the length of the original deployed program]")
// )
// .arg(
// Arg::new("allow_excessive_balance")
// .long("allow-excessive-deploy-account-balance")
// .takes_value(false)
// .help("Use the designated program id even if the account already holds a large balance of SOL")
// ),
// )
// .subcommand(
// Command::new("write-buffer")
// .about("Writes a program into a buffer account")
// .arg(
// Arg::new("program_location")
// .index(1)
// .value_name("PROGRAM_FILEPATH")
// .takes_value(true)
// .required(true)
// .help("/path/to/program.so"),
// )
// .arg(
// Arg::new("buffer")
// .long("buffer")
// .value_name("BUFFER_SIGNER")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Buffer account to write data into [default: random address]")
// )
// .arg(
// Arg::new("buffer_authority")
// .long("buffer-authority")
// .value_name("BUFFER_AUTHORITY_SIGNER")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("Buffer authority [default: the default configured keypair]")
// )
// .arg(
// Arg::new("max_len")
// .long("max-len")
// .value_name("max_len")
// .takes_value(true)
// .required(false)
// .help("Maximum length of the upgradeable program \
// [default: twice the length of the original deployed program]")
// ),
// )
.subcommand(
Command::new("set-buffer-authority")
.about("Set a new buffer authority")
.arg(
Arg::new("buffer")
.index(1)
.value_name("BUFFER_PUBKEY")
.takes_value(true)
.required(true)
.help("Public key of the buffer")
)
.arg(
Arg::new("buffer_authority")
.long("buffer-authority")
.value_name("BUFFER_AUTHORITY_SIGNER")
.takes_value(true)
.validator(is_valid_signer)
.help("Buffer authority [default: the default configured keypair]")
)
.arg(
pubkey!(Arg::new("new_buffer_authority")
.long("new-buffer-authority")
.value_name("NEW_BUFFER_AUTHORITY")
.required(true),
"Address of the new buffer authority"),
)
)
.subcommand(
Command::new("set-upgrade-authority")
.about("Set a new program authority")
.arg(
Arg::new("program_id")
.index(1)
.value_name("PROGRAM_ADDRESS")
.takes_value(true)
.required(true)
.help("Address of the program to upgrade")
)
.arg(
Arg::new("upgrade_authority")
.long("upgrade-authority")
.value_name("UPGRADE_AUTHORITY_SIGNER")
.takes_value(true)
.validator(is_valid_signer)
.help("Upgrade authority [default: the default configured keypair]")
)
.arg(
pubkey!(Arg::new("new_upgrade_authority")
.long("new-upgrade-authority")
.required_unless_present("final")
.value_name("NEW_UPGRADE_AUTHORITY"),
"Address of the new upgrade authority"),
)
.arg(
Arg::new("final")
.long("final")
.conflicts_with("new_upgrade_authority")
.help("The program will not be upgradeable")
)
)
.subcommand(
Command::new("show")
.about("Display information about a buffer or program")
.arg(
Arg::new("account")
.index(1)
.value_name("ACCOUNT_ADDRESS")
.takes_value(true)
.help("Address of the buffer or program to show"),
)
.arg(
Arg::new("programs")
.long("programs")
.conflicts_with("account")
.conflicts_with("buffers")
.required_unless_present_any(["account", "buffers"])
.help("Show every upgradeable program that matches the authority"),
)
.arg(
Arg::new("buffers")
.long("buffers")
.conflicts_with("account")
.conflicts_with("programs")
.required_unless_present_any(["account", "programs"])
.help("Show every upgradeable buffer that matches the authority"),
)
.arg(
Arg::new("all")
.long("all")
.conflicts_with("account")
.conflicts_with("buffer_authority")
.help("Show accounts for all authorities"),
)
.arg(pubkey!(
Arg::new("buffer_authority")
.long("buffer-authority")
.value_name("AUTHORITY")
.conflicts_with("all"),
"Authority [default: the default configured keypair]"
))
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
),
) // .subcommand(
// Command::new("dump")
// .about("Write the program data to a file")
// .arg(
// Arg::new("account")
// .index(1)
// .value_name("ACCOUNT_ADDRESS")
// .takes_value(true)
// .required(true)
// .help("Address of the buffer or program")
// )
// .arg(
// Arg::new("output_location")
// .index(2)
// .value_name("OUTPUT_FILEPATH")
// .takes_value(true)
// .required(true)
// .help("/path/to/program.so"),
// ),
// )
.subcommand(
Command::new("close")
.about("Close a program or buffer account and withdraw all lamports")
.arg(
Arg::new("account")
.index(1)
.value_name("ACCOUNT_ADDRESS")
.takes_value(true)
.help("Address of the program or buffer account to close"),
)
.arg(
Arg::new("buffers")
.long("buffers")
.conflicts_with("account")
.required_unless_present("account")
.help("Close all buffer accounts that match the authority")
)
.arg(
Arg::new("authority")
.long("authority")
.alias("buffer-authority")
.value_name("AUTHORITY_SIGNER")
.takes_value(true)
.validator(is_valid_signer)
.help("Upgrade or buffer authority [default: the default configured keypair]")
)
.arg(
pubkey!(Arg::new("recipient_account")
.long("recipient")
.value_name("RECIPIENT_ADDRESS"),
"Address of the account to deposit the closed account's lamports [default: the default configured keypair]"),
)
.arg(
Arg::new("lamports")
.long("lamports")
.takes_value(false)
.help("Display balance in lamports instead of SOL"),
),
)
// .subcommand(
// Command::new("deploy")
// .about("Deploy a program")
// .setting(AppSettings::Hidden)
// .arg(
// Arg::new("program_location")
// .index(1)
// .value_name("PROGRAM_FILEPATH")
// .takes_value(true)
// .required(true)
// .help("/path/to/program.o"),
// )
// .arg(
// Arg::new("address_signer")
// .index(2)
// .value_name("PROGRAM_ADDRESS_SIGNER")
// .takes_value(true)
// .validator(is_valid_signer)
// .help("The signer for the desired address of the program [default: new random address]")
// )
// .arg(
// Arg::new("use_deprecated_loader")
// .long("use-deprecated-loader")
// .takes_value(false)
// .hide(true) // Don't document this argument to discourage its use
// .help("Use the deprecated BPF loader")
// )
// .arg(
// Arg::new("allow_excessive_balance")
// .long("allow-excessive-deploy-account-balance")
// .takes_value(false)
// .help("Use the designated program id, even if the account already holds a large balance of SOL")
// )
// .arg(
// Arg::new("skip_fee_check")
// .long("skip-fee-check")
// .hide(true)
// .takes_value(false)
// ),
)
}
}
pub fn parse_program_subcommand(
matches: &ArgMatches,
default_signer: Box<dyn Signer>,
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
) -> Result<CliCommandInfo, CliError> {
let (subcommand, sub_matches) = matches.subcommand().unwrap();
let matches_skip_fee_check = matches.is_present("skip_fee_check");
let sub_matches_skip_fee_check = sub_matches.is_present("skip_fee_check");
let _skip_fee_check = matches_skip_fee_check || sub_matches_skip_fee_check;
let response = match (subcommand, sub_matches) {
// ("deploy", Some(matches)) => {
// let mut bulk_signers = vec![Some(
// default_signer.signer_from_path(matches, wallet_manager)?,
// )];
// let program_location = matches
// .value_of("program_location")
// .map(|location| location.to_string());
// let buffer_pubkey = if let Ok((buffer_signer, Some(buffer_pubkey))) =
// signer_of(matches, "buffer", wallet_manager)
// {
// bulk_signers.push(buffer_signer);
// Some(buffer_pubkey)
// } else {
// pubkey_of_signer(matches, "buffer", wallet_manager)?
// };
// let program_pubkey = if let Ok((program_signer, Some(program_pubkey))) =
// signer_of(matches, "program_id", wallet_manager)
// {
// bulk_signers.push(program_signer);
// Some(program_pubkey)
// } else {
// pubkey_of_signer(matches, "program_id", wallet_manager)?
// };
// let upgrade_authority_pubkey =
// if let Ok((upgrade_authority_signer, Some(upgrade_authority_pubkey))) =
// signer_of(matches, "upgrade_authority", wallet_manager)
// {
// bulk_signers.push(upgrade_authority_signer);
// Some(upgrade_authority_pubkey)
// } else {
// Some(
// default_signer
// .signer_from_path(matches, wallet_manager)?
// .pubkey(),
// )
// };
// let max_len = value_of(matches, "max_len");
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// CliCommandInfo {
// command: CliCommand::Program(ProgramCliCommand::Deploy {
// program_location,
// program_signer_index: signer_info.index_of_or_none(program_pubkey),
// program_pubkey,
// buffer_signer_index: signer_info.index_of_or_none(buffer_pubkey),
// buffer_pubkey,
// upgrade_authority_signer_index: signer_info
// .index_of(upgrade_authority_pubkey)
// .unwrap(),
// is_final: matches.is_present("final"),
// max_len,
// allow_excessive_balance: matches.is_present("allow_excessive_balance"),
// skip_fee_check,
// }),
// signers: signer_info.signers,
// }
// }
// ("write-buffer", Some(matches)) => {
// let mut bulk_signers = vec![Some(
// default_signer.signer_from_path(matches, wallet_manager)?,
// )];
// let buffer_pubkey = if let Ok((buffer_signer, Some(buffer_pubkey))) =
// signer_of(matches, "buffer", wallet_manager)
// {
// bulk_signers.push(buffer_signer);
// Some(buffer_pubkey)
// } else {
// pubkey_of_signer(matches, "buffer", wallet_manager)?
// };
// let buffer_authority_pubkey =
// if let Ok((buffer_authority_signer, Some(buffer_authority_pubkey))) =
// signer_of(matches, "buffer_authority", wallet_manager)
// {
// bulk_signers.push(buffer_authority_signer);
// Some(buffer_authority_pubkey)
// } else {
// Some(
// default_signer
// .signer_from_path(matches, wallet_manager)?
// .pubkey(),
// )
// };
// let max_len = value_of(matches, "max_len");
// let signer_info =
// default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
// CliCommandInfo {
// command: CliCommand::Program(ProgramCliCommand::WriteBuffer {
// program_location: matches.value_of("program_location").unwrap().to_string(),
// buffer_signer_index: signer_info.index_of_or_none(buffer_pubkey),
// buffer_pubkey,
// buffer_authority_signer_index: signer_info
// .index_of_or_none(buffer_authority_pubkey),
// max_len,
// skip_fee_check,
// }),
// signers: signer_info.signers,
// }
// }
("set-buffer-authority", matches) => {
let buffer_pubkey = pubkey_of(matches, "buffer").unwrap();
let (buffer_authority_signer, buffer_authority_pubkey) =
signer_of(matches, "buffer_authority", wallet_manager)?;
let new_buffer_authority =
pubkey_of_signer(matches, "new_buffer_authority", wallet_manager)?.unwrap();
let signer_info =
generate_unique_signers(default_signer, vec![buffer_authority_signer])?;
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::SetBufferAuthority {
buffer_pubkey,
buffer_authority_index: signer_info.index_of(buffer_authority_pubkey),
new_buffer_authority,
}),
signers: signer_info.signers,
}
}
("set-upgrade-authority", matches) => {
let (upgrade_authority_signer, upgrade_authority_pubkey) =
signer_of(matches, "upgrade_authority", wallet_manager)?;
let program_pubkey = pubkey_of(matches, "program_id").unwrap();
let new_upgrade_authority = if matches.is_present("final") {
None
} else {
pubkey_of_signer(matches, "new_upgrade_authority", wallet_manager)?
};
let signer_info =
generate_unique_signers(default_signer, vec![upgrade_authority_signer])?;
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::SetUpgradeAuthority {
program_pubkey,
upgrade_authority_index: signer_info.index_of(upgrade_authority_pubkey),
new_upgrade_authority,
}),
signers: signer_info.signers,
}
}
("show", matches) => {
let authority_pubkey = if let Some(authority_pubkey) =
pubkey_of_signer(matches, "buffer_authority", wallet_manager)?
{
authority_pubkey
} else {
default_signer.pubkey()
};
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Show {
account_pubkey: pubkey_of(matches, "account"),
authority_pubkey,
get_programs: matches.is_present("programs"),
get_buffers: matches.is_present("buffers"),
all: matches.is_present("all"),
use_lamports_unit: matches.is_present("lamports"),
}),
signers: vec![],
}
}
// ("dump", Some(matches)) => CliCommandInfo {
// command: CliCommand::Program(ProgramCliCommand::Dump {
// account_pubkey: pubkey_of(matches, "account"),
// output_location: matches.value_of("output_location").unwrap().to_string(),
// }),
// signers: vec![],
// },
("close", matches) => {
let account_pubkey = if matches.is_present("buffers") {
None
} else {
pubkey_of(matches, "account")
};
let recipient_pubkey = if let Some(recipient_pubkey) =
pubkey_of_signer(matches, "recipient_account", wallet_manager)?
{
recipient_pubkey
} else {
default_signer.pubkey()
};
let (authority_signer, authority_pubkey) =
signer_of(matches, "authority", wallet_manager)?;
let signer_info = generate_unique_signers(default_signer, vec![authority_signer])?;
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Close {
account_pubkey,
recipient_pubkey,
authority_index: signer_info.index_of(authority_pubkey).unwrap(),
use_lamports_unit: matches.is_present("lamports"),
}),
signers: signer_info.signers,
}
}
_ => unreachable!(),
};
Ok(response)
}
pub async fn process_program_subcommand(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
program_subcommand: &ProgramCliCommand,
) -> ProcessResult {
match program_subcommand {
// ProgramCliCommand::Deploy {
// program_location,
// program_signer_index,
// program_pubkey,
// buffer_signer_index,
// buffer_pubkey,
// upgrade_authority_signer_index,
// is_final,
// max_len,
// allow_excessive_balance,
// skip_fee_check,
// } => process_program_deploy(
// rpc_client,
// config,
// program_location,
// *program_signer_index,
// *program_pubkey,
// *buffer_signer_index,
// *buffer_pubkey,
// *upgrade_authority_signer_index,
// *is_final,
// *max_len,
// *allow_excessive_balance,
// *skip_fee_check,
// ),
// ProgramCliCommand::WriteBuffer {
// program_location,
// buffer_signer_index,
// buffer_pubkey,
// buffer_authority_signer_index,
// max_len,
// skip_fee_check,
// } => process_write_buffer(
// rpc_client,
// config,
// program_location,
// *buffer_signer_index,
// *buffer_pubkey,
// *buffer_authority_signer_index,
// *max_len,
// *skip_fee_check,
// ),
ProgramCliCommand::SetBufferAuthority {
buffer_pubkey,
buffer_authority_index,
new_buffer_authority,
} => {
process_set_authority(
rpc_client,
config,
None,
Some(*buffer_pubkey),
*buffer_authority_index,
Some(*new_buffer_authority),
)
.await
}
ProgramCliCommand::SetUpgradeAuthority {
program_pubkey,
upgrade_authority_index,
new_upgrade_authority,
} => {
process_set_authority(
rpc_client,
config,
Some(*program_pubkey),
None,
*upgrade_authority_index,
*new_upgrade_authority,
)
.await
}
ProgramCliCommand::Show {
account_pubkey,
authority_pubkey,
get_programs,
get_buffers,
all,
use_lamports_unit,
} => {
process_show(
rpc_client,
config,
*account_pubkey,
*authority_pubkey,
*get_programs,
*get_buffers,
*all,
*use_lamports_unit,
)
.await
}
// ProgramCliCommand::Dump {
// account_pubkey,
// output_location,
// } => process_dump(&rpc_client, config, *account_pubkey, output_location),
ProgramCliCommand::Close {
account_pubkey,
recipient_pubkey,
authority_index,
use_lamports_unit,
} => {
process_close(
rpc_client,
config,
*account_pubkey,
*recipient_pubkey,
*authority_index,
*use_lamports_unit,
)
.await
}
}
}
// fn get_default_program_keypair(program_location: &Option<String>) -> Keypair {
// let program_keypair = {
// if let Some(program_location) = program_location {
// let mut keypair_file = PathBuf::new();
// keypair_file.push(program_location);
// let mut filename = keypair_file.file_stem().unwrap().to_os_string();
// filename.push("-keypair");
// keypair_file.set_file_name(filename);
// keypair_file.set_extension("json");
// if let Ok(keypair) = read_keypair_file(&keypair_file.to_str().unwrap()) {
// keypair
// } else {
// Keypair::new()
// }
// } else {
// Keypair::new()
// }
// };
// program_keypair
// }
// /// Deploy using upgradeable loader
// #[allow(clippy::too_many_arguments)]
// fn process_program_deploy(
// rpc_client: Arc<WasmClient>,
// config: &CliConfig<'_>,
// program_location: &Option<String>,
// program_signer_index: Option<SignerIndex>,
// program_pubkey: Option<Pubkey>,
// buffer_signer_index: Option<SignerIndex>,
// buffer_pubkey: Option<Pubkey>,
// upgrade_authority_signer_index: SignerIndex,
// is_final: bool,
// max_len: Option<usize>,
// allow_excessive_balance: bool,
// skip_fee_check: bool,
// ) -> ProcessResult {
// let (words, mnemonic, buffer_keypair) = create_ephemeral_keypair()?;
// let (buffer_provided, buffer_signer, buffer_pubkey) = if let Some(i) = buffer_signer_index {
// (true, Some(config.signers[i]), config.signers[i].pubkey())
// } else if let Some(pubkey) = buffer_pubkey {
// (true, None, pubkey)
// } else {
// (
// false,
// Some(&buffer_keypair as &dyn Signer),
// buffer_keypair.pubkey(),
// )
// };
// let upgrade_authority_signer = config.signers[upgrade_authority_signer_index];
// let default_program_keypair = get_default_program_keypair(program_location);
// let (program_signer, program_pubkey) = if let Some(i) = program_signer_index {
// (Some(config.signers[i]), config.signers[i].pubkey())
// } else if let Some(program_pubkey) = program_pubkey {
// (None, program_pubkey)
// } else {
// (
// Some(&default_program_keypair as &dyn Signer),
// default_program_keypair.pubkey(),
// )
// };
// let do_deploy = if let Some(account) = rpc_client
// .get_account_with_commitment(&program_pubkey, config.commitment_config)?
// .value
// {
// if account.owner != bpf_loader_upgradeable::id() {
// return Err(format!(
// "Account {} is not an upgradeable program or already in use",
// program_pubkey
// )
// .into());
// }
// if !account.executable {
// // Continue an initial deploy
// true
// } else if let Ok(UpgradeableLoaderState::Program {
// programdata_address,
// }) = account.state()
// {
// if let Some(account) = rpc_client
// .get_account_with_commitment(&programdata_address, config.commitment_config)?
// .value
// {
// if let Ok(UpgradeableLoaderState::ProgramData {
// slot: _,
// upgrade_authority_address: program_authority_pubkey,
// }) = account.state()
// {
// if program_authority_pubkey.is_none() {
// return Err(
// format!("Program {} is no longer upgradeable", program_pubkey).into(),
// );
// }
// if program_authority_pubkey != Some(upgrade_authority_signer.pubkey()) {
// return Err(format!(
// "Program's authority {:?} does not match authority provided {:?}",
// program_authority_pubkey,
// upgrade_authority_signer.pubkey(),
// )
// .into());
// }
// // Do upgrade
// false
// } else {
// return Err(format!(
// "Program {} has been closed, use a new Program Id",
// program_pubkey
// )
// .into());
// }
// } else {
// return Err(format!(
// "Program {} has been closed, use a new Program Id",
// program_pubkey
// )
// .into());
// }
// } else {
// return Err(format!("{} is not an upgradeable program", program_pubkey).into());
// }
// } else {
// // do new deploy
// true
// };
// let (program_data, program_len) = if let Some(program_location) = program_location {
// let program_data = read_and_verify_elf(program_location)?;
// let program_len = program_data.len();
// (program_data, program_len)
// } else if buffer_provided {
// // Check supplied buffer account
// if let Some(account) = rpc_client
// .get_account_with_commitment(&buffer_pubkey, config.commitment_config)?
// .value
// {
// if !bpf_loader_upgradeable::check_id(&account.owner) {
// return Err(format!(
// "Buffer account {buffer_pubkey} is not owned by the BPF Upgradeable Loader",
// )
// .into());
// }
// match account.state() {
// Ok(UpgradeableLoaderState::Buffer { .. }) => {
// // continue if buffer is initialized
// }
// Ok(UpgradeableLoaderState::Program { .. }) => {
// return Err(
// format!("Cannot use program account {buffer_pubkey} as buffer").into(),
// );
// }
// Ok(UpgradeableLoaderState::ProgramData { .. }) => {
// return Err(format!(
// "Cannot use program data account {buffer_pubkey} as buffer",
// )
// .into())
// }
// Ok(UpgradeableLoaderState::Uninitialized) => {
// return Err(format!("Buffer account {buffer_pubkey} is not initialized").into());
// }
// Err(_) => {
// return Err(
// format!("Buffer account {buffer_pubkey} could not be deserialized").into(),
// )
// }
// };
// let program_len = account
// .data
// .len()
// .saturating_sub(UpgradeableLoaderState::size_of_buffer_metadata());
// (vec![], program_len)
// } else {
// return Err(format!(
// "Buffer account {buffer_pubkey} not found, was it already consumed?",
// )
// .into());
// }
// } else {
// return Err("Program location required if buffer not supplied".into());
// };
// let programdata_len = if let Some(len) = max_len {
// if program_len > len {
// return Err("Max length specified not large enough".into());
// }
// len
// } else if is_final {
// program_len
// } else {
// program_len * 2
// };
// let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(
// UpgradeableLoaderState::size_of_programdata(program_len),
// )?;
// let result = if do_deploy {
// if program_signer.is_none() {
// return Err(
// "Initial deployments require a keypair be provided for the program id".into(),
// );
// }
// do_process_program_write_and_deploy(
// rpc_client.clone(),
// config,
// &program_data,
// program_len,
// programdata_len,
// minimum_balance,
// &bpf_loader_upgradeable::id(),
// Some(&[program_signer.unwrap(), upgrade_authority_signer]),
// buffer_signer,
// &buffer_pubkey,
// Some(upgrade_authority_signer),
// allow_excessive_balance,
// skip_fee_check,
// )
// } else {
// do_process_program_upgrade(
// rpc_client.clone(),
// config,
// &program_data,
// &program_pubkey,
// config.signers[upgrade_authority_signer_index],
// &buffer_pubkey,
// buffer_signer,
// skip_fee_check,
// )
// };
// if result.is_ok() && is_final {
// process_set_authority(
// &rpc_client,
// config,
// Some(program_pubkey),
// None,
// Some(upgrade_authority_signer_index),
// None,
// )?;
// }
// if result.is_err() && buffer_signer_index.is_none() {
// report_ephemeral_mnemonic(words, mnemonic);
// }
// result
// }
// fn process_write_buffer(
// rpc_client: Arc<WasmClient>,
// config: &CliConfig<'_>,
// program_location: &str,
// buffer_signer_index: Option<SignerIndex>,
// buffer_pubkey: Option<Pubkey>,
// buffer_authority_signer_index: Option<SignerIndex>,
// max_len: Option<usize>,
// skip_fee_check: bool,
// ) -> ProcessResult {
// // Create ephemeral keypair to use for Buffer account, if not provided
// let (words, mnemonic, buffer_keypair) = create_ephemeral_keypair()?;
// let (buffer_signer, buffer_pubkey) = if let Some(i) = buffer_signer_index {
// (Some(config.signers[i]), config.signers[i].pubkey())
// } else if let Some(pubkey) = buffer_pubkey {
// (None, pubkey)
// } else {
// (
// Some(&buffer_keypair as &dyn Signer),
// buffer_keypair.pubkey(),
// )
// };
// let buffer_authority = if let Some(i) = buffer_authority_signer_index {
// config.signers[i]
// } else {
// config.signers[0]
// };
// if let Some(account) = rpc_client
// .get_account_with_commitment(&buffer_pubkey, config.commitment_config)?
// .value
// {
// if let Ok(UpgradeableLoaderState::Buffer { authority_address }) = account.state() {
// if authority_address.is_none() {
// return Err(format!("Buffer {} is immutable", buffer_pubkey).into());
// }
// if authority_address != Some(buffer_authority.pubkey()) {
// return Err(format!(
// "Buffer's authority {:?} does not match authority provided {}",
// authority_address,
// buffer_authority.pubkey()
// )
// .into());
// }
// } else {
// return Err(format!(
// "{} is not an upgradeable loader buffer account",
// buffer_pubkey
// )
// .into());
// }
// }
// let program_data = read_and_verify_elf(program_location)?;
// let buffer_data_len = if let Some(len) = max_len {
// len
// } else {
// program_data.len()
// };
// let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(
// UpgradeableLoaderState::size_of_programdata(buffer_data_len),
// )?;
// let result = do_process_program_write_and_deploy(
// rpc_client,
// config,
// &program_data,
// program_data.len(),
// program_data.len(),
// minimum_balance,
// &bpf_loader_upgradeable::id(),
// None,
// buffer_signer,
// &buffer_pubkey,
// Some(buffer_authority),
// true,
// skip_fee_check,
// );
// if result.is_err() && buffer_signer_index.is_none() && buffer_signer.is_some() {
// report_ephemeral_mnemonic(words, mnemonic);
// }
// result
// }
async fn process_set_authority(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
program_pubkey: Option<Pubkey>,
buffer_pubkey: Option<Pubkey>,
authority: Option<SignerIndex>,
new_authority: Option<Pubkey>,
) -> ProcessResult {
let authority_signer = if let Some(index) = authority {
config.signers[index]
} else {
return Err("Set authority requires the current authority".into());
};
let blockhash = rpc_client.get_latest_blockhash().await?;
let mut tx = if let Some(ref pubkey) = program_pubkey {
Transaction::new_unsigned(Message::new(
&[bpf_loader_upgradeable::set_upgrade_authority(
pubkey,
&authority_signer.pubkey(),
new_authority.as_ref(),
)],
Some(&config.signers[0].pubkey()),
))
} else if let Some(pubkey) = buffer_pubkey {
if let Some(ref new_authority) = new_authority {
Transaction::new_unsigned(Message::new(
&[bpf_loader_upgradeable::set_buffer_authority(
&pubkey,
&authority_signer.pubkey(),
new_authority,
)],
Some(&config.signers[0].pubkey()),
))
} else {
return Err("Buffer authority cannot be None".into());
}
} else {
return Err("Program or Buffer not provided".into());
};
tx.try_sign(&[config.signers[0], authority_signer], blockhash)?;
rpc_client
.send_and_confirm_transaction_with_config(
&tx,
config.commitment_config,
RpcSendTransactionConfig {
skip_preflight: true,
encoding: config.send_transaction_config.encoding,
preflight_commitment: Some(config.commitment()),
..RpcSendTransactionConfig::default()
},
)
.await
.map_err(|e| format!("Setting authority failed: {}", e))?;
let authority = CliProgramAuthority {
authority: new_authority
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
account_type: if program_pubkey.is_some() {
CliProgramAccountType::Program
} else {
CliProgramAccountType::Buffer
},
};
Ok(config.output_format.formatted_string(&authority))
}
const ACCOUNT_TYPE_SIZE: usize = 4;
const SLOT_SIZE: usize = size_of::<u64>();
const OPTION_SIZE: usize = 1;
const PUBKEY_LEN: usize = 32;
async fn get_buffers(
rpc_client: &WasmClient,
authority_pubkey: Option<Pubkey>,
use_lamports_unit: bool,
) -> Result<CliUpgradeableBuffers, Box<dyn std::error::Error>> {
let mut filters = vec![RpcFilterType::Memcmp(Memcmp {
offset: 0,
bytes: MemcmpEncodedBytes::Base58(bs58::encode(vec![1, 0, 0, 0]).into_string()),
encoding: None,
})];
if let Some(authority_pubkey) = authority_pubkey {
filters.push(RpcFilterType::Memcmp(Memcmp {
offset: ACCOUNT_TYPE_SIZE,
bytes: MemcmpEncodedBytes::Base58(bs58::encode(vec![1]).into_string()),
encoding: None,
}));
filters.push(RpcFilterType::Memcmp(Memcmp {
offset: ACCOUNT_TYPE_SIZE + OPTION_SIZE,
bytes: MemcmpEncodedBytes::Base58(
bs58::encode(authority_pubkey.as_ref()).into_string(),
),
encoding: None,
}));
}
let results = get_accounts_with_filter(
rpc_client,
filters,
ACCOUNT_TYPE_SIZE + OPTION_SIZE + PUBKEY_LEN,
)
.await?;
let mut buffers = vec![];
for (address, account) in results.iter() {
if let Ok(UpgradeableLoaderState::Buffer { authority_address }) = account.state() {
buffers.push(CliUpgradeableBuffer {
address: address.to_string(),
authority: authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
data_len: 0,
lamports: account.lamports,
use_lamports_unit,
});
} else {
return Err(format!("Error parsing Buffer account {}", address).into());
}
}
Ok(CliUpgradeableBuffers {
buffers,
use_lamports_unit,
})
}
async fn get_programs(
rpc_client: &WasmClient,
authority_pubkey: Option<Pubkey>,
use_lamports_unit: bool,
) -> Result<CliUpgradeablePrograms, Box<dyn std::error::Error>> {
let mut filters = vec![RpcFilterType::Memcmp(Memcmp {
offset: 0,
bytes: MemcmpEncodedBytes::Base58(bs58::encode(vec![3, 0, 0, 0]).into_string()),
encoding: None,
})];
if let Some(authority_pubkey) = authority_pubkey {
filters.push(RpcFilterType::Memcmp(Memcmp {
offset: ACCOUNT_TYPE_SIZE + SLOT_SIZE,
bytes: MemcmpEncodedBytes::Base58(bs58::encode(vec![1]).into_string()),
encoding: None,
}));
filters.push(RpcFilterType::Memcmp(Memcmp {
offset: ACCOUNT_TYPE_SIZE + SLOT_SIZE + OPTION_SIZE,
bytes: MemcmpEncodedBytes::Base58(
bs58::encode(authority_pubkey.as_ref()).into_string(),
),
encoding: None,
}));
}
let results = get_accounts_with_filter(
rpc_client,
filters,
ACCOUNT_TYPE_SIZE + SLOT_SIZE + OPTION_SIZE + PUBKEY_LEN,
)
.await?;
let mut programs = vec![];
for (programdata_address, programdata_account) in results.iter() {
if let Ok(UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address,
}) = programdata_account.state()
{
let mut bytes = vec![2, 0, 0, 0];
bytes.extend_from_slice(programdata_address.as_ref());
let filters = vec![RpcFilterType::Memcmp(Memcmp {
offset: 0,
bytes: MemcmpEncodedBytes::Base58(bs58::encode(bytes).into_string()),
encoding: None,
})];
let results = get_accounts_with_filter(rpc_client, filters, 0).await?;
if results.len() != 1 {
return Err(format!(
"Error: More than one Program associated with ProgramData account {}",
programdata_address
)
.into());
}
programs.push(CliUpgradeableProgram {
program_id: results[0].0.to_string(),
owner: programdata_account.owner.to_string(),
programdata_address: programdata_address.to_string(),
authority: upgrade_authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
last_deploy_slot: slot,
data_len: programdata_account.data.len()
- UpgradeableLoaderState::size_of_programdata_metadata(),
lamports: programdata_account.lamports,
use_lamports_unit,
});
} else {
return Err(
format!("Error parsing ProgramData account {}", programdata_address).into(),
);
}
}
Ok(CliUpgradeablePrograms {
programs,
use_lamports_unit,
})
}
async fn get_accounts_with_filter(
rpc_client: &WasmClient,
filters: Vec<RpcFilterType>,
length: usize,
) -> Result<Vec<(Pubkey, Account)>, Box<dyn std::error::Error>> {
let results = rpc_client
.get_program_accounts_with_config(
&bpf_loader_upgradeable::id(),
RpcProgramAccountsConfig {
filters: Some(filters),
account_config: RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
data_slice: Some(UiDataSliceConfig { offset: 0, length }),
..RpcAccountInfoConfig::default()
},
..RpcProgramAccountsConfig::default()
},
)
.await?;
Ok(results)
}
#[allow(clippy::too_many_arguments)]
async fn process_show(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
account_pubkey: Option<Pubkey>,
authority_pubkey: Pubkey,
programs: bool,
buffers: bool,
all: bool,
use_lamports_unit: bool,
) -> ProcessResult {
if let Some(account_pubkey) = account_pubkey {
let account = rpc_client.get_account(&account_pubkey).await?;
if account.owner == bpf_loader::id() || account.owner == bpf_loader_deprecated::id() {
Ok(config.output_format.formatted_string(&CliProgram {
program_id: account_pubkey.to_string(),
owner: account.owner.to_string(),
data_len: account.data.len(),
}))
} else if account.owner == bpf_loader_upgradeable::id() {
if let Ok(UpgradeableLoaderState::Program {
programdata_address,
}) = account.state()
{
if let Some(programdata_account) = rpc_client
.get_account_with_commitment(&programdata_address, config.commitment_config)
.await?
{
if let Ok(UpgradeableLoaderState::ProgramData {
upgrade_authority_address,
slot,
}) = programdata_account.state()
{
Ok(config
.output_format
.formatted_string(&CliUpgradeableProgram {
program_id: account_pubkey.to_string(),
owner: account.owner.to_string(),
programdata_address: programdata_address.to_string(),
authority: upgrade_authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
last_deploy_slot: slot,
data_len: programdata_account.data.len()
- UpgradeableLoaderState::size_of_programdata_metadata(),
lamports: programdata_account.lamports,
use_lamports_unit,
}))
} else {
Err(format!("Program {} has been closed", account_pubkey).into())
}
} else {
Err(format!("Program {} has been closed", account_pubkey).into())
}
} else if let Ok(UpgradeableLoaderState::Buffer { authority_address }) = account.state()
{
Ok(config
.output_format
.formatted_string(&CliUpgradeableBuffer {
address: account_pubkey.to_string(),
authority: authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
data_len: account.data.len()
- UpgradeableLoaderState::size_of_buffer_metadata(),
lamports: account.lamports,
use_lamports_unit,
}))
} else {
Err(format!(
"{} is not an upgradeable loader Buffer or Program account",
account_pubkey
)
.into())
}
} else {
Err(format!("{} is not a BPF program", account_pubkey).into())
}
} else if programs {
let authority_pubkey = if all { None } else { Some(authority_pubkey) };
let programs = get_programs(rpc_client, authority_pubkey, use_lamports_unit).await?;
Ok(config.output_format.formatted_string(&programs))
} else if buffers {
let authority_pubkey = if all { None } else { Some(authority_pubkey) };
let buffers = get_buffers(rpc_client, authority_pubkey, use_lamports_unit).await?;
Ok(config.output_format.formatted_string(&buffers))
} else {
Err("Invalid parameters".to_string().into())
}
}
// fn process_dump(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// account_pubkey: Option<Pubkey>,
// output_location: &str,
// ) -> ProcessResult {
// if let Some(account_pubkey) = account_pubkey {
// if let Some(account) = rpc_client
// .get_account_with_commitment(&account_pubkey, config.commitment_config)?
// .value
// {
// if account.owner == bpf_loader::id() || account.owner == bpf_loader_deprecated::id() {
// let mut f = File::create(output_location)?;
// f.write_all(&account.data)?;
// Ok(format!("Wrote program to {}", output_location))
// } else if account.owner == bpf_loader_upgradeable::id() {
// if let Ok(UpgradeableLoaderState::Program {
// programdata_address,
// }) = account.state()
// {
// if let Some(programdata_account) = rpc_client
// .get_account_with_commitment(&programdata_address, config.commitment_config)?
// .value
// {
// if let Ok(UpgradeableLoaderState::ProgramData { .. }) =
// programdata_account.state()
// {
// let offset = UpgradeableLoaderState::size_of_programdata_metadata();
// let program_data = &programdata_account.data[offset..];
// let mut f = File::create(output_location)?;
// f.write_all(program_data)?;
// Ok(format!("Wrote program to {}", output_location))
// } else {
// Err(format!("Program {} has been closed", account_pubkey).into())
// }
// } else {
// Err(format!("Program {} has been closed", account_pubkey).into())
// }
// } else if let Ok(UpgradeableLoaderState::Buffer { .. }) = account.state() {
// let offset = UpgradeableLoaderState::size_of_buffer_metadata();
// let program_data = &account.data[offset..];
// let mut f = File::create(output_location)?;
// f.write_all(program_data)?;
// Ok(format!("Wrote program to {}", output_location))
// } else {
// Err(format!(
// "{} is not an upgradeable loader buffer or program account",
// account_pubkey
// )
// .into())
// }
// } else {
// Err(format!("{} is not a BPF program", account_pubkey).into())
// }
// } else {
// Err(format!("Unable to find the account {}", account_pubkey).into())
// }
// } else {
// Err("No account specified".into())
// }
// }
async fn close(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
account_pubkey: &Pubkey,
recipient_pubkey: &Pubkey,
authority_signer: &dyn Signer,
program_pubkey: Option<&Pubkey>,
) -> Result<(), Box<dyn std::error::Error>> {
let blockhash = rpc_client.get_latest_blockhash().await?;
let mut tx = Transaction::new_unsigned(Message::new(
&[bpf_loader_upgradeable::close_any(
account_pubkey,
recipient_pubkey,
Some(&authority_signer.pubkey()),
program_pubkey,
)],
Some(&config.signers[0].pubkey()),
));
tx.try_sign(&[config.signers[0], authority_signer], blockhash)?;
let result = rpc_client
.send_and_confirm_transaction_with_config(
&tx,
config.commitment_config,
RpcSendTransactionConfig {
skip_preflight: true,
preflight_commitment: Some(config.commitment()),
encoding: config.send_transaction_config.encoding,
..RpcSendTransactionConfig::default()
},
)
.await;
if let Err(e) = result {
return Err(format!("Close failed: {e}").into());
}
Ok(())
}
async fn process_close(
rpc_client: &WasmClient,
config: &CliConfig<'_>,
account_pubkey: Option<Pubkey>,
recipient_pubkey: Pubkey,
authority_index: SignerIndex,
use_lamports_unit: bool,
) -> ProcessResult {
let authority_signer = config.signers[authority_index];
if let Some(account_pubkey) = account_pubkey {
if let Some(account) = rpc_client
.get_account_with_commitment(&account_pubkey, config.commitment_config)
.await?
{
match account.state() {
Ok(UpgradeableLoaderState::Buffer { authority_address }) => {
if authority_address != Some(authority_signer.pubkey()) {
return Err(format!(
"Buffer account authority {:?} does not match {:?}",
authority_address,
Some(authority_signer.pubkey())
)
.into());
} else {
close(
rpc_client,
config,
&account_pubkey,
&recipient_pubkey,
authority_signer,
None,
)
.await?;
}
Ok(config
.output_format
.formatted_string(&CliUpgradeableBuffers {
buffers: vec![CliUpgradeableBuffer {
address: account_pubkey.to_string(),
authority: authority_address
.map(|pubkey| pubkey.to_string())
.unwrap_or_else(|| "none".to_string()),
data_len: 0,
lamports: account.lamports,
use_lamports_unit,
}],
use_lamports_unit,
}))
}
Ok(UpgradeableLoaderState::Program {
programdata_address: programdata_pubkey,
}) => {
if let Some(account) = rpc_client
.get_account_with_commitment(&programdata_pubkey, config.commitment_config)
.await?
{
if let Ok(UpgradeableLoaderState::ProgramData {
slot: _,
upgrade_authority_address: authority_pubkey,
}) = account.state()
{
if authority_pubkey != Some(authority_signer.pubkey()) {
Err(format!(
"Program authority {:?} does not match {:?}",
authority_pubkey,
Some(authority_signer.pubkey())
)
.into())
} else {
close(
rpc_client,
config,
&programdata_pubkey,
&recipient_pubkey,
authority_signer,
Some(&account_pubkey),
)
.await?;
Ok(config.output_format.formatted_string(
&CliUpgradeableProgramClosed {
program_id: account_pubkey.to_string(),
lamports: account.lamports,
use_lamports_unit,
},
))
}
} else {
Err(format!("Program {} has been closed", account_pubkey).into())
}
} else {
Err(format!("Program {} has been closed", account_pubkey).into())
}
}
_ => Err(format!("{} is not a Program or Buffer account", account_pubkey).into()),
}
} else {
Err(format!("Unable to find the account {}", account_pubkey).into())
}
} else {
let buffers = get_buffers(
rpc_client,
Some(authority_signer.pubkey()),
use_lamports_unit,
)
.await?;
let mut closed = vec![];
for buffer in buffers.buffers.iter() {
if close(
rpc_client,
config,
&Pubkey::from_str(&buffer.address)?,
&recipient_pubkey,
authority_signer,
None,
)
.await
.is_ok()
{
closed.push(buffer.clone());
}
}
Ok(config
.output_format
.formatted_string(&CliUpgradeableBuffers {
buffers: closed,
use_lamports_unit,
}))
}
}
// /// Deploy using non-upgradeable loader
// pub fn process_deploy(
// rpc_client: Arc<WasmClient>,
// config: &CliConfig<'_>,
// program_location: &str,
// buffer_signer_index: Option<SignerIndex>,
// use_deprecated_loader: bool,
// allow_excessive_balance: bool,
// skip_fee_check: bool,
// ) -> ProcessResult {
// // Create ephemeral keypair to use for Buffer account, if not provided
// let (words, mnemonic, buffer_keypair) = create_ephemeral_keypair()?;
// let buffer_signer = if let Some(i) = buffer_signer_index {
// config.signers[i]
// } else {
// &buffer_keypair
// };
// let program_data = read_and_verify_elf(program_location)?;
// let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(program_data.len())?;
// let loader_id = if use_deprecated_loader {
// bpf_loader_deprecated::id()
// } else {
// bpf_loader::id()
// };
// let result = do_process_program_write_and_deploy(
// rpc_client,
// config,
// &program_data,
// program_data.len(),
// program_data.len(),
// minimum_balance,
// &loader_id,
// Some(&[buffer_signer]),
// Some(buffer_signer),
// &buffer_signer.pubkey(),
// Some(buffer_signer),
// allow_excessive_balance,
// skip_fee_check,
// );
// if result.is_err() && buffer_signer_index.is_none() {
// report_ephemeral_mnemonic(words, mnemonic);
// }
// result
// }
// fn calculate_max_chunk_size<F>(create_msg: &F) -> usize
// where
// F: Fn(u32, Vec<u8>) -> Message,
// {
// let baseline_msg = create_msg(0, Vec::new());
// let tx_size = bincode::serialized_size(&Transaction {
// signatures: vec![
// Signature::default();
// baseline_msg.header.num_required_signatures as usize
// ],
// message: baseline_msg,
// })
// .unwrap() as usize;
// // add 1 byte buffer to account for shortvec encoding
// PACKET_DATA_SIZE.saturating_sub(tx_size).saturating_sub(1)
// }
// #[allow(clippy::too_many_arguments)]
// fn do_process_program_write_and_deploy(
// rpc_client: Arc<WasmClient>,
// config: &CliConfig<'_>,
// program_data: &[u8],
// program_len: usize,
// programdata_len: usize,
// minimum_balance: u64,
// loader_id: &Pubkey,
// program_signers: Option<&[&dyn Signer]>,
// buffer_signer: Option<&dyn Signer>,
// buffer_pubkey: &Pubkey,
// buffer_authority_signer: Option<&dyn Signer>,
// allow_excessive_balance: bool,
// skip_fee_check: bool,
// ) -> ProcessResult {
// // Build messages to calculate fees
// let mut messages: Vec<&Message> = Vec::new();
// let blockhash = rpc_client.get_latest_blockhash()?;
// // Initialize buffer account or complete if already partially initialized
// let (initial_message, write_messages, balance_needed) =
// if let Some(buffer_authority_signer) = buffer_authority_signer {
// let (initial_instructions, balance_needed) = if let Some(account) = rpc_client
// .get_account_with_commitment(buffer_pubkey, config.commitment_config)?
// .value
// {
// complete_partial_program_init(
// loader_id,
// &config.signers[0].pubkey(),
// buffer_pubkey,
// &account,
// if loader_id == &bpf_loader_upgradeable::id() {
// UpgradeableLoaderState::size_of_buffer(program_len)
// } else {
// program_len
// },
// minimum_balance,
// allow_excessive_balance,
// )?
// } else if loader_id == &bpf_loader_upgradeable::id() {
// (
// bpf_loader_upgradeable::create_buffer(
// &config.signers[0].pubkey(),
// buffer_pubkey,
// &buffer_authority_signer.pubkey(),
// minimum_balance,
// program_len,
// )?,
// minimum_balance,
// )
// } else {
// (
// vec![system_instruction::create_account(
// &config.signers[0].pubkey(),
// buffer_pubkey,
// minimum_balance,
// program_len as u64,
// loader_id,
// )],
// minimum_balance,
// )
// };
// let initial_message = if !initial_instructions.is_empty() {
// Some(Message::new_with_blockhash(
// &initial_instructions,
// Some(&config.signers[0].pubkey()),
// &blockhash,
// ))
// } else {
// None
// };
// // Create and add write messages
// let payer_pubkey = config.signers[0].pubkey();
// let create_msg = |offset: u32, bytes: Vec<u8>| {
// let instruction = if loader_id == &bpf_loader_upgradeable::id() {
// bpf_loader_upgradeable::write(
// buffer_pubkey,
// &buffer_authority_signer.pubkey(),
// offset,
// bytes,
// )
// } else {
// loader_instruction::write(buffer_pubkey, loader_id, offset, bytes)
// };
// Message::new_with_blockhash(&[instruction], Some(&payer_pubkey), &blockhash)
// };
// let mut write_messages = vec![];
// let chunk_size = calculate_max_chunk_size(&create_msg);
// for (chunk, i) in program_data.chunks(chunk_size).zip(0..) {
// write_messages.push(create_msg((i * chunk_size) as u32, chunk.to_vec()));
// }
// (initial_message, Some(write_messages), balance_needed)
// } else {
// (None, None, 0)
// };
// if let Some(ref initial_message) = initial_message {
// messages.push(initial_message);
// }
// if let Some(ref write_messages) = write_messages {
// let mut write_message_refs = vec![];
// for message in write_messages.iter() {
// write_message_refs.push(message);
// }
// messages.append(&mut write_message_refs);
// }
// // Create and add final message
// let final_message = if let Some(program_signers) = program_signers {
// let message = if loader_id == &bpf_loader_upgradeable::id() {
// Message::new_with_blockhash(
// &bpf_loader_upgradeable::deploy_with_max_program_len(
// &config.signers[0].pubkey(),
// &program_signers[0].pubkey(),
// buffer_pubkey,
// &program_signers[1].pubkey(),
// rpc_client.get_minimum_balance_for_rent_exemption(
// UpgradeableLoaderState::size_of_program(),
// )?,
// programdata_len,
// )?,
// Some(&config.signers[0].pubkey()),
// &blockhash,
// )
// } else {
// Message::new_with_blockhash(
// &[loader_instruction::finalize(buffer_pubkey, loader_id)],
// Some(&config.signers[0].pubkey()),
// &blockhash,
// )
// };
// Some(message)
// } else {
// None
// };
// if let Some(ref message) = final_message {
// messages.push(message);
// }
// if !skip_fee_check {
// check_payer(
// &rpc_client,
// config,
// balance_needed,
// &initial_message,
// &write_messages,
// &final_message,
// )?;
// }
// send_deploy_messages(
// rpc_client,
// config,
// &initial_message,
// &write_messages,
// &final_message,
// buffer_signer,
// buffer_authority_signer,
// program_signers,
// )?;
// if let Some(program_signers) = program_signers {
// let program_id = CliProgramId {
// program_id: program_signers[0].pubkey().to_string(),
// };
// Ok(config.output_format.formatted_string(&program_id))
// } else {
// let buffer = CliProgramBuffer {
// buffer: buffer_pubkey.to_string(),
// };
// Ok(config.output_format.formatted_string(&buffer))
// }
// }
// fn do_process_program_upgrade(
// rpc_client: Arc<WasmClient>,
// config: &CliConfig<'_>,
// program_data: &[u8],
// program_id: &Pubkey,
// upgrade_authority: &dyn Signer,
// buffer_pubkey: &Pubkey,
// buffer_signer: Option<&dyn Signer>,
// skip_fee_check: bool,
// ) -> ProcessResult {
// let loader_id = bpf_loader_upgradeable::id();
// let data_len = program_data.len();
// let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(
// UpgradeableLoaderState::size_of_programdata(data_len),
// )?;
// // Build messages to calculate fees
// let mut messages: Vec<&Message> = Vec::new();
// let blockhash = rpc_client.get_latest_blockhash()?;
// let (initial_message, write_messages, balance_needed) =
// if let Some(buffer_signer) = buffer_signer {
// // Check Buffer account to see if partial initialization has occurred
// let (initial_instructions, balance_needed) = if let Some(account) = rpc_client
// .get_account_with_commitment(&buffer_signer.pubkey(), config.commitment_config)?
// .value
// {
// complete_partial_program_init(
// &loader_id,
// &config.signers[0].pubkey(),
// &buffer_signer.pubkey(),
// &account,
// UpgradeableLoaderState::size_of_buffer(data_len),
// minimum_balance,
// true,
// )?
// } else {
// (
// bpf_loader_upgradeable::create_buffer(
// &config.signers[0].pubkey(),
// buffer_pubkey,
// &upgrade_authority.pubkey(),
// minimum_balance,
// data_len,
// )?,
// minimum_balance,
// )
// };
// let initial_message = if !initial_instructions.is_empty() {
// Some(Message::new_with_blockhash(
// &initial_instructions,
// Some(&config.signers[0].pubkey()),
// &blockhash,
// ))
// } else {
// None
// };
// let buffer_signer_pubkey = buffer_signer.pubkey();
// let upgrade_authority_pubkey = upgrade_authority.pubkey();
// let payer_pubkey = config.signers[0].pubkey();
// let create_msg = |offset: u32, bytes: Vec<u8>| {
// let instruction = bpf_loader_upgradeable::write(
// &buffer_signer_pubkey,
// &upgrade_authority_pubkey,
// offset,
// bytes,
// );
// Message::new_with_blockhash(&[instruction], Some(&payer_pubkey), &blockhash)
// };
// // Create and add write messages
// let mut write_messages = vec![];
// let chunk_size = calculate_max_chunk_size(&create_msg);
// for (chunk, i) in program_data.chunks(chunk_size).zip(0..) {
// write_messages.push(create_msg((i * chunk_size) as u32, chunk.to_vec()));
// }
// (initial_message, Some(write_messages), balance_needed)
// } else {
// (None, None, 0)
// };
// if let Some(ref message) = initial_message {
// messages.push(message);
// }
// if let Some(ref write_messages) = write_messages {
// let mut write_message_refs = vec![];
// for message in write_messages.iter() {
// write_message_refs.push(message);
// }
// messages.append(&mut write_message_refs);
// }
// // Create and add final message
// let final_message = Message::new_with_blockhash(
// &[bpf_loader_upgradeable::upgrade(
// program_id,
// buffer_pubkey,
// &upgrade_authority.pubkey(),
// &config.signers[0].pubkey(),
// )],
// Some(&config.signers[0].pubkey()),
// &blockhash,
// );
// messages.push(&final_message);
// let final_message = Some(final_message);
// if !skip_fee_check {
// check_payer(
// &rpc_client,
// config,
// balance_needed,
// &initial_message,
// &write_messages,
// &final_message,
// )?;
// }
// send_deploy_messages(
// rpc_client,
// config,
// &initial_message,
// &write_messages,
// &final_message,
// buffer_signer,
// Some(upgrade_authority),
// Some(&[upgrade_authority]),
// )?;
// let program_id = CliProgramId {
// program_id: program_id.to_string(),
// };
// Ok(config.output_format.formatted_string(&program_id))
// }
// fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
// let mut file = File::open(program_location)
// .map_err(|err| format!("Unable to open program file: {}", err))?;
// let mut program_data = Vec::new();
// file.read_to_end(&mut program_data)
// .map_err(|err| format!("Unable to read program file: {}", err))?;
// let mut transaction_context = TransactionContext::new(Vec::new(), 1, 1);
// let mut invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
// // Verify the program
// let executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
// &program_data,
// Config {
// reject_broken_elfs: true,
// ..Config::default()
// },
// register_syscalls(&mut invoke_context, true).unwrap(),
// )
// .map_err(|err| format!("ELF error: {}", err))?;
// let _ =
// VerifiedExecutable::<RequisiteVerifier, BpfError, ThisInstructionMeter>::from_executable(
// executable,
// )
// .map_err(|err| format!("ELF error: {}", err))?;
// Ok(program_data)
// }
// fn complete_partial_program_init(
// loader_id: &Pubkey,
// payer_pubkey: &Pubkey,
// elf_pubkey: &Pubkey,
// account: &Account,
// account_data_len: usize,
// minimum_balance: u64,
// allow_excessive_balance: bool,
// ) -> Result<(Vec<Instruction>, u64), Box<dyn std::error::Error>> {
// let mut instructions: Vec<Instruction> = vec![];
// let mut balance_needed = 0;
// if account.executable {
// return Err("Buffer account is already executable".into());
// }
// if account.owner != *loader_id && !system_program::check_id(&account.owner) {
// return Err("Buffer account passed is already in use by another program".into());
// }
// if !account.data.is_empty() && account.data.len() < account_data_len {
// return Err(
// "Buffer account passed is not large enough, may have been for a different deploy?"
// .into(),
// );
// }
// if account.data.is_empty() && system_program::check_id(&account.owner) {
// instructions.push(system_instruction::allocate(
// elf_pubkey,
// account_data_len as u64,
// ));
// instructions.push(system_instruction::assign(elf_pubkey, loader_id));
// if account.lamports < minimum_balance {
// let balance = minimum_balance - account.lamports;
// instructions.push(system_instruction::transfer(
// payer_pubkey,
// elf_pubkey,
// balance,
// ));
// balance_needed = balance;
// } else if account.lamports > minimum_balance
// && system_program::check_id(&account.owner)
// && !allow_excessive_balance
// {
// return Err(format!(
// "Buffer account has a balance: {:?}; it may already be in use",
// Sol(account.lamports)
// )
// .into());
// }
// }
// Ok((instructions, balance_needed))
// }
// fn check_payer(
// rpc_client: &WasmClient,
// config: &CliConfig<'_>,
// balance_needed: u64,
// initial_message: &Option<Message>,
// write_messages: &Option<Vec<Message>>,
// final_message: &Option<Message>,
// ) -> Result<(), Box<dyn std::error::Error>> {
// let mut fee = 0;
// if let Some(message) = initial_message {
// fee += rpc_client.get_fee_for_message(message)?;
// }
// if let Some(write_messages) = write_messages {
// // Assume all write messages cost the same
// if let Some(message) = write_messages.get(0) {
// fee += rpc_client.get_fee_for_message(message)? * (write_messages.len() as u64);
// }
// }
// if let Some(message) = final_message {
// fee += rpc_client.get_fee_for_message(message)?;
// }
// check_account_for_spend_and_fee_with_commitment(
// rpc_client,
// &config.signers[0].pubkey(),
// balance_needed,
// fee,
// config.commitment_config,
// )?;
// Ok(())
// }
// fn send_deploy_messages(
// rpc_client: Arc<WasmClient>,
// config: &CliConfig<'_>,
// initial_message: &Option<Message>,
// write_messages: &Option<Vec<Message>>,
// final_message: &Option<Message>,
// initial_signer: Option<&dyn Signer>,
// write_signer: Option<&dyn Signer>,
// final_signers: Option<&[&dyn Signer]>,
// ) -> Result<(), Box<dyn std::error::Error>> {
// let payer_signer = config.signers[0];
// if let Some(message) = initial_message {
// if let Some(initial_signer) = initial_signer {
// trace!("Preparing the required accounts");
// let blockhash = rpc_client.get_latest_blockhash()?;
// let mut initial_transaction = Transaction::new_unsigned(message.clone());
// // Most of the initial_transaction combinations require both the fee-payer and new program
// // account to sign the transaction. One (transfer) only requires the fee-payer signature.
// // This check is to ensure signing does not fail on a KeypairPubkeyMismatch error from an
// // extraneous signature.
// if message.header.num_required_signatures == 2 {
// initial_transaction.try_sign(&[payer_signer, initial_signer], blockhash)?;
// } else {
// initial_transaction.try_sign(&[payer_signer], blockhash)?;
// }
// let result = rpc_client.send_and_confirm_transaction_with_spinner(&initial_transaction);
// log_instruction_custom_error::<SystemError>(result, config)
// .map_err(|err| format!("Account allocation failed: {}", err))?;
// } else {
// return Err("Buffer account not created yet, must provide a key pair".into());
// }
// }
// if let Some(write_messages) = write_messages {
// if let Some(write_signer) = write_signer {
// trace!("Writing program data");
// let tpu_client = TpuClient::new(
// rpc_client.clone(),
// &config.websocket_url,
// TpuClientConfig::default(),
// )?;
// let transaction_errors = tpu_client
// .send_and_confirm_messages_with_spinner(
// write_messages,
// &[payer_signer, write_signer],
// )
// .map_err(|err| format!("Data writes to account failed: {}", err))?
// .into_iter()
// .flatten()
// .collect::<Vec<_>>();
// if !transaction_errors.is_empty() {
// for transaction_error in &transaction_errors {
// PgTerminal::log_wasm("{:?}", transaction_error);
// }
// return Err(
// format!("{} write transactions failed", transaction_errors.len()).into(),
// );
// }
// }
// }
// if let Some(message) = final_message {
// if let Some(final_signers) = final_signers {
// trace!("Deploying program");
// let blockhash = rpc_client.get_latest_blockhash()?;
// let mut final_tx = Transaction::new_unsigned(message.clone());
// let mut signers = final_signers.to_vec();
// signers.push(payer_signer);
// final_tx.try_sign(&signers, blockhash)?;
// rpc_client
// .send_and_confirm_transaction_with_config(
// &final_tx,
// config.commitment_config,
// RpcSendTransactionConfig {
// skip_preflight: true,
// preflight_commitment: Some(config.commitment()),
// ..RpcSendTransactionConfig::default()
// },
// )
// .map_err(|e| format!("Deploying program failed: {}", e))?;
// }
// }
// Ok(())
// }
// fn create_ephemeral_keypair(
// ) -> Result<(usize, bip39::Mnemonic, Keypair), Box<dyn std::error::Error>> {
// const WORDS: usize = 12;
// let mnemonic = Mnemonic::new(MnemonicType::for_word_count(WORDS)?, Language::English);
// let seed = Seed::new(&mnemonic, "");
// let new_keypair = keypair_from_seed(seed.as_bytes())?;
// Ok((WORDS, mnemonic, new_keypair))
// }
// fn report_ephemeral_mnemonic(words: usize, mnemonic: bip39::Mnemonic) {
// let phrase: &str = mnemonic.phrase();
// let divider = String::from_utf8(vec![b'='; phrase.len()]).unwrap();
// PgTerminal::log_wasm(
// "{}\nRecover the intermediate account's ephemeral keypair file with",
// divider
// );
// PgTerminal::log_wasm(
// "`solana-keygen recover` and the following {}-word seed phrase:",
// words
// );
// PgTerminal::log_wasm("{}\n{}\n{}", divider, phrase, divider);
// PgTerminal::log_wasm("To resume a deploy, pass the recovered keypair as the");
// PgTerminal::log_wasm("[BUFFER_SIGNER] to `solana program deploy` or `solana program write-buffer'.");
// PgTerminal::log_wasm("Or to recover the account's lamports, pass it as the");
// PgTerminal::log_wasm(
// "[BUFFER_ACCOUNT_ADDRESS] argument to `solana program close`.\n{}",
// divider
// );
// }
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config/Cargo.toml
|
[package]
name = "solana-cli-config-wasm"
authors = ["Acheron <acheroncrypto@gmail.com>"]
description = "Solana CLI config for WASM."
version = "1.11.0"
repository = "https://github.com/solana-playground/solana-playground"
license = "Apache-2.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["solana", "playground", "wasm"]
[dependencies]
dirs-next = "2.0.0"
lazy_static = "1.4.0"
serde = "1.0.137"
serde_derive = "1.0.103"
serde_yaml = "0.8.24"
solana-clap-v3-utils-wasm = { path = "../solana-clap-v3-utils" }
solana-sdk = "*"
url = "2.2.2"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config/src/config.rs
|
// Wallet settings that can be configured for long-term use
use {
serde_derive::{Deserialize, Serialize},
std::{collections::HashMap, io, path::Path},
url::Url,
};
lazy_static! {
/// The default path to the CLI configuration file.
///
/// This is a [lazy_static] of `Option<String>`, the value of which is
///
/// > `~/.config/solana/cli/config.yml`
///
/// It will only be `None` if it is unable to identify the user's home
/// directory, which should not happen under typical OS environments.
///
/// [lazy_static]: https://docs.rs/lazy_static
pub static ref CONFIG_FILE: Option<String> = {
dirs_next::home_dir().map(|mut path| {
path.extend(&[".config", "solana", "cli", "config.yml"]);
path.to_str().unwrap().to_string()
})
};
}
/// The Solana CLI configuration.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct Config {
/// The RPC address of a Solana validator node.
///
/// Typical values for mainnet, devnet, and testnet are [described in the
/// Solana documentation][rpcdocs].
///
/// For local testing, the typical value is `http://localhost:8899`.
///
/// [rpcdocs]: https://docs.solana.com/cluster/rpc-endpoints
pub json_rpc_url: String,
/// The address to connect to for receiving event notifications.
///
/// If it is an empty string then the correct value will be derived
/// from `json_rpc_url`.
///
/// The default value is the empty string.
pub websocket_url: String,
/// The default signing source, which may be a keypair file, but may also
/// represent several other types of signers, as described in the
/// documentation for `solana_clap_utils::keypair::signer_from_path`.
/// Because it represents sources other than a simple path, the name
/// `keypair_path` is misleading, and exists for backwards compatibility
/// reasons.
///
/// The signing source can be loaded with either the `signer_from_path`
/// function, or with `solana_clap_utils::keypair::DefaultSigner`.
pub keypair_path: String,
/// A mapping from Solana addresses to human-readable names.
///
/// By default the only value in this map is the system program.
#[serde(default)]
pub address_labels: HashMap<String, String>,
/// The default commitment level.
///
/// By default the value is "confirmed", as defined by
/// `solana_sdk::commitment_config::CommitmentLevel::Confirmed`.
#[serde(default)]
pub commitment: String,
}
impl Default for Config {
fn default() -> Self {
// let keypair_path = {
// let mut keypair_path = dirs_next::home_dir().expect("home directory");
// keypair_path.extend(&[".config", "solana", "id.json"]);
// keypair_path.to_str().unwrap().to_string()
// };
// TODO:
let keypair_path = "Playground Wallet".to_string();
let json_rpc_url = "http://localhost:8899".to_string();
// Empty websocket_url string indicates the client should
// `Config::compute_websocket_url(&json_rpc_url)`
let websocket_url = "".to_string();
let mut address_labels = HashMap::new();
address_labels.insert(
"11111111111111111111111111111111".to_string(),
"System Program".to_string(),
);
let commitment = "confirmed".to_string();
Self {
json_rpc_url,
websocket_url,
keypair_path,
address_labels,
commitment,
}
}
}
impl Config {
/// WASM
pub fn new(json_rpc_url: &str, commitment: &str) -> Self {
Self {
json_rpc_url: json_rpc_url.to_string(),
commitment: commitment.to_string(),
..Default::default()
}
}
/// Load a configuration from file.
///
/// # Errors
///
/// This function may return typical file I/O errors.
pub fn load(config_file: &str) -> Result<Self, io::Error> {
crate::load_config_file(config_file)
}
/// Save a configuration to file.
///
/// If the file's directory does not exist, it will be created. If the file
/// already exists, it will be overwritten.
///
/// # Errors
///
/// This function may return typical file I/O errors.
pub fn save(&self, config_file: &str) -> Result<(), io::Error> {
crate::save_config_file(self, config_file)
}
/// Compute the websocket URL from the RPC URL.
///
/// The address is created from the RPC URL by:
///
/// - adding 1 to the port number,
/// - using the "wss" scheme if the RPC URL has an "https" scheme, or the
/// "ws" scheme if the RPC URL has an "http" scheme.
///
/// If `json_rpc_url` cannot be parsed as a URL then this function returns
/// the empty string.
pub fn compute_websocket_url(json_rpc_url: &str) -> String {
let json_rpc_url: Option<Url> = json_rpc_url.parse().ok();
if json_rpc_url.is_none() {
return "".to_string();
}
let json_rpc_url = json_rpc_url.unwrap();
let is_secure = json_rpc_url.scheme().to_ascii_lowercase() == "https";
let mut ws_url = json_rpc_url.clone();
ws_url
.set_scheme(if is_secure { "wss" } else { "ws" })
.expect("unable to set scheme");
if let Some(port) = json_rpc_url.port() {
let port = port.checked_add(1).expect("port out of range");
ws_url.set_port(Some(port)).expect("unable to set port");
}
ws_url.to_string()
}
/// Load a map of address/name pairs from a YAML file at the given path and
/// insert them into the configuration.
pub fn import_address_labels<P>(&mut self, filename: P) -> Result<(), io::Error>
where
P: AsRef<Path>,
{
let imports: HashMap<String, String> = crate::load_config_file(filename)?;
for (address, label) in imports.into_iter() {
self.address_labels.insert(address, label);
}
Ok(())
}
/// Save the map of address/name pairs contained in the configuration to a
/// YAML file at the given path.
pub fn export_address_labels<P>(&self, filename: P) -> Result<(), io::Error>
where
P: AsRef<Path>,
{
crate::save_config_file(&self.address_labels, filename)
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config/src/lib.rs
|
//! Loading and saving the Solana CLI configuration file.
//!
//! The configuration file used by the Solana CLI includes information about the
//! RPC node to connect to, the path to the user's signing source, and more.
//! Other software than the Solana CLI may wish to access the same configuration
//! and signer.
//!
//! The default path to the configuration file can be retrieved from
//! [`CONFIG_FILE`], which is a [lazy_static] of `Option<String>`, the value of
//! which is
//!
//! > `~/.config/solana/cli/config.yml`
//!
//! [`CONFIG_FILE`]: struct@CONFIG_FILE
//! [lazy_static]: https://docs.rs/lazy_static
//!
//! `CONFIG_FILE` will only be `None` if it is unable to identify the user's
//! home directory, which should not happen under typical OS environments.
//!
//! The CLI configuration is defined by the [`Config`] struct, and its value is
//! loaded with [`Config::load`] and saved with [`Config::save`].
//!
//! Two important fields of `Config` are
//!
//! - [`json_rpc_url`], the URL to pass to
//! `solana_client::rpc_client::RpcClient`.
//! - [`keypair_path`], a signing source, which may be a keypair file, but
//! may also represent several other types of signers, as described in
//! the documentation for `solana_clap_utils::keypair::signer_from_path`.
//!
//! [`json_rpc_url`]: Config::json_rpc_url
//! [`keypair_path`]: Config::keypair_path
//!
//! # Examples
//!
//! Loading and saving the configuration. Note that this uses the [anyhow] crate
//! for error handling.
//!
//! [anyhow]: https://docs.rs/anyhow
//!
//! ```no_run
//! use anyhow::anyhow;
//! use solana_cli_config_wasm::{CONFIG_FILE, Config};
//!
//! let config_file = solana_cli_config_wasm::CONFIG_FILE.as_ref()
//! .ok_or_else(|| anyhow!("unable to get config file path"))?;
//! let mut cli_config = Config::load(&config_file)?;
//! // Set the RPC URL to devnet
//! cli_config.json_rpc_url = "https://api.devnet.solana.com".to_string();
//! cli_config.save(&config_file)?;
//! # Ok::<(), anyhow::Error>(())
//! ```
#[macro_use]
extern crate lazy_static;
mod config;
mod config_input;
use std::{
fs::{create_dir_all, File},
io::{self, Write},
path::Path,
};
pub use {
config::{Config, CONFIG_FILE},
config_input::{ConfigInput, SettingType},
};
/// Load a value from a file in YAML format.
///
/// Despite the name, this function is generic YAML file deserializer, a thin
/// wrapper around serde.
///
/// Most callers should instead use [`Config::load`].
///
/// # Errors
///
/// This function may return typical file I/O errors.
pub fn load_config_file<T, P>(config_file: P) -> Result<T, io::Error>
where
T: serde::de::DeserializeOwned,
P: AsRef<Path>,
{
let file = File::open(config_file)?;
let config = serde_yaml::from_reader(file)
.map_err(|err| io::Error::new(io::ErrorKind::Other, format!("{:?}", err)))?;
Ok(config)
}
/// Save a value to a file in YAML format.
///
/// Despite the name, this function is a generic YAML file serializer, a thin
/// wrapper around serde.
///
/// If the file's directory does not exist, it will be created. If the file
/// already exists, it will be overwritten.
///
/// Most callers should instead use [`Config::save`].
///
/// # Errors
///
/// This function may return typical file I/O errors.
pub fn save_config_file<T, P>(config: &T, config_file: P) -> Result<(), io::Error>
where
T: serde::ser::Serialize,
P: AsRef<Path>,
{
let serialized = serde_yaml::to_string(config)
.map_err(|err| io::Error::new(io::ErrorKind::Other, format!("{:?}", err)))?;
if let Some(outdir) = config_file.as_ref().parent() {
create_dir_all(outdir)?;
}
let mut file = File::create(config_file)?;
file.write_all(&serialized.into_bytes())?;
Ok(())
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-config/src/config_input.rs
|
use {
crate::Config, solana_clap_v3_utils_wasm::input_validators::normalize_to_url_if_moniker,
solana_sdk::commitment_config::CommitmentConfig, std::str::FromStr,
};
pub enum SettingType {
Explicit,
Computed,
SystemDefault,
}
pub struct ConfigInput {
pub json_rpc_url: String,
pub websocket_url: String,
pub keypair_path: String,
pub commitment: CommitmentConfig,
}
impl ConfigInput {
fn default_keypair_path() -> String {
Config::default().keypair_path
}
fn default_json_rpc_url() -> String {
Config::default().json_rpc_url
}
fn default_websocket_url() -> String {
Config::default().websocket_url
}
fn default_commitment() -> CommitmentConfig {
CommitmentConfig::confirmed()
}
fn first_nonempty_setting(
settings: std::vec::Vec<(SettingType, String)>,
) -> (SettingType, String) {
settings
.into_iter()
.find(|(_, value)| !value.is_empty())
.expect("no nonempty setting")
}
fn first_setting_is_some<T>(
settings: std::vec::Vec<(SettingType, Option<T>)>,
) -> (SettingType, T) {
let (setting_type, setting_option) = settings
.into_iter()
.find(|(_, value)| value.is_some())
.expect("all settings none");
(setting_type, setting_option.unwrap())
}
pub fn compute_websocket_url_setting(
websocket_cmd_url: &str,
websocket_cfg_url: &str,
json_rpc_cmd_url: &str,
json_rpc_cfg_url: &str,
) -> (SettingType, String) {
Self::first_nonempty_setting(vec![
(SettingType::Explicit, websocket_cmd_url.to_string()),
(SettingType::Explicit, websocket_cfg_url.to_string()),
(
SettingType::Computed,
Config::compute_websocket_url(&normalize_to_url_if_moniker(json_rpc_cmd_url)),
),
(
SettingType::Computed,
Config::compute_websocket_url(&normalize_to_url_if_moniker(json_rpc_cfg_url)),
),
(SettingType::SystemDefault, Self::default_websocket_url()),
])
}
pub fn compute_json_rpc_url_setting(
json_rpc_cmd_url: &str,
json_rpc_cfg_url: &str,
) -> (SettingType, String) {
let (setting_type, url_or_moniker) = Self::first_nonempty_setting(vec![
(SettingType::Explicit, json_rpc_cmd_url.to_string()),
(SettingType::Explicit, json_rpc_cfg_url.to_string()),
(SettingType::SystemDefault, Self::default_json_rpc_url()),
]);
(setting_type, normalize_to_url_if_moniker(url_or_moniker))
}
pub fn compute_keypair_path_setting(
keypair_cmd_path: &str,
keypair_cfg_path: &str,
) -> (SettingType, String) {
Self::first_nonempty_setting(vec![
(SettingType::Explicit, keypair_cmd_path.to_string()),
(SettingType::Explicit, keypair_cfg_path.to_string()),
(SettingType::SystemDefault, Self::default_keypair_path()),
])
}
pub fn compute_commitment_config(
commitment_cmd: &str,
commitment_cfg: &str,
) -> (SettingType, CommitmentConfig) {
Self::first_setting_is_some(vec![
(
SettingType::Explicit,
CommitmentConfig::from_str(commitment_cmd).ok(),
),
(
SettingType::Explicit,
CommitmentConfig::from_str(commitment_cfg).ok(),
),
(SettingType::SystemDefault, Some(Self::default_commitment())),
])
}
}
impl Default for ConfigInput {
fn default() -> ConfigInput {
ConfigInput {
json_rpc_url: Self::default_json_rpc_url(),
websocket_url: Self::default_websocket_url(),
keypair_path: Self::default_keypair_path(),
commitment: CommitmentConfig::confirmed(),
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-playground-utils/Cargo.toml
|
[package]
name = "solana-playground-utils-wasm"
version = "0.1.0"
description = "WASM utils for Solana Playground."
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "Apache-2.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["solana", "playground", "wasm"]
[lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["js"]
js = []
[dependencies]
wasm-bindgen = "*"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-playground-utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-playground-utils/src/js.rs
|
use wasm_bindgen::prelude::*;
#[wasm_bindgen(raw_module = "/src/utils/pg/program-info.ts")]
extern "C" {
pub type PgProgramInfo;
/// Get the current program's IDL.
#[wasm_bindgen(static_method_of = PgProgramInfo, js_name = "getIdlStr")]
pub fn idl_string() -> Option<String>;
/// Get the current program's pubkey.
#[wasm_bindgen(static_method_of = PgProgramInfo, js_name = "getPkStr")]
pub fn pk_string() -> Option<String>;
}
#[wasm_bindgen(raw_module = "/src/utils/pg/settings.ts")]
extern "C" {
pub type PgSettings;
pub type PgSettingsConnection;
/// Get the connection settings.
#[wasm_bindgen(static_method_of = PgSettings, getter)]
pub fn connection() -> PgSettingsConnection;
/// Get the connection RPC URL.
#[wasm_bindgen(method, getter)]
pub fn endpoint(this: &PgSettingsConnection) -> String;
/// Set the connection RPC URL.
#[wasm_bindgen(method, setter)]
pub fn set_endpoint(this: &PgSettingsConnection, value: &str);
/// Get the connection commitment level.
#[wasm_bindgen(method, getter)]
pub fn commitment(this: &PgSettingsConnection) -> String;
/// Set the connection commitment level.
#[wasm_bindgen(method, setter)]
pub fn set_commitment(this: &PgSettingsConnection, value: &str);
/// Get transaction preflight checks.
#[wasm_bindgen(method, getter, js_name = "preflightChecks")]
pub fn preflight_checks(this: &PgSettingsConnection) -> bool;
/// Set transaction preflight checks.
#[wasm_bindgen(method, setter, js_name = "preflightChecks")]
pub fn set_preflight_checks(this: &PgSettingsConnection, value: bool);
}
#[wasm_bindgen(raw_module = "/src/utils/pg/terminal/terminal.ts")]
extern "C" {
pub type PgTerminal;
// TODO: Remove, there is no need for a new WASM function since `PgTerminal.log` is now static.
/// Log to the playground terminal.
#[wasm_bindgen(static_method_of = PgTerminal, js_name = "logWasm")]
pub fn log_wasm(msg: &str);
/// Enable the playground terminal.
#[wasm_bindgen(static_method_of = PgTerminal, js_name = "enable")]
pub fn enable();
}
#[wasm_bindgen(raw_module = "/src/utils/pg/wallet/wallet.ts")]
extern "C" {
pub type PgWallet;
/// Get playground wallet's keypair.
#[wasm_bindgen(static_method_of = PgWallet, js_name = "getKeypairBytes")]
pub fn keypair_bytes() -> Vec<u8>;
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-playground-utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-playground-utils/src/lib.rs
|
#[cfg(feature = "js")]
pub mod js;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output/Cargo.toml
|
[package]
name = "solana-cli-output-wasm"
version = "1.11.0"
description = "Solana WASM CLI output."
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "Apache-2.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["solana", "playground", "wasm"]
[dependencies]
base64 = "0.13.0"
chrono = { version = "0.4.11", features = ["serde"] }
clap = "*"
console = "*"
humantime = "2.0.1"
pretty-hex = "0.3.0"
semver = "1.0.9"
serde = "*"
serde_derive = "*"
serde_json = "*"
solana-clap-v3-utils-wasm = { path = "../solana-clap-v3-utils" }
solana-cli-config-wasm = { path = "../solana-cli-config" }
solana-client-wasm = { path = "../../solana-client" }
solana-extra-wasm = { path = "../solana-extra" }
solana-sdk = "*"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output/src/lib.rs
|
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_variables)]
#[macro_use]
extern crate serde_derive;
pub mod cli_output;
pub mod cli_version;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output/src/cli_output.rs
|
use std::{
collections::{BTreeMap, HashMap},
fmt, io,
time::Duration,
};
use chrono::{DateTime, Local, NaiveDateTime, SecondsFormat, TimeZone, Utc};
use clap::ArgMatches;
use console::{style, Emoji};
use serde::Serialize;
use solana_cli_config_wasm::SettingType;
use solana_client_wasm::utils::rpc_response::{
RpcAccountBalance, RpcInflationGovernor, RpcInflationRate, RpcSupply, RpcVoteAccountInfo,
};
use solana_extra_wasm::{
account_decoder::UiAccount,
program::vote::{
authorized_voters::AuthorizedVoters,
vote_state::{BlockTimestamp, Lockout, MAX_EPOCH_CREDITS_HISTORY, MAX_LOCKOUT_HISTORY},
},
transaction_status::{
EncodedConfirmedBlock, EncodedTransaction, Rewards, TransactionConfirmationStatus,
UiTransactionStatusMeta,
},
};
use solana_sdk::{
clock::{Epoch, Slot, UnixTimestamp},
epoch_info::EpochInfo,
hash::Hash,
instruction::CompiledInstruction,
message::v0::MessageAddressTableLookup,
native_token::lamports_to_sol,
pubkey::Pubkey,
signature::Signature,
stake::state::{Authorized, Lockup},
stake_history::StakeHistoryEntry,
transaction::{Transaction, TransactionError, TransactionVersion, VersionedTransaction},
transaction_context::TransactionReturnData,
};
use crate::cli_version::CliVersion;
static CHECK_MARK: Emoji = Emoji("✅ ", "");
static CROSS_MARK: Emoji = Emoji("❌ ", "");
static WARNING: Emoji = Emoji("⚠️", "!");
pub trait QuietDisplay: std::fmt::Display {
fn write_str(&self, w: &mut dyn std::fmt::Write) -> std::fmt::Result {
write!(w, "{}", self)
}
}
pub trait VerboseDisplay: std::fmt::Display {
fn write_str(&self, w: &mut dyn std::fmt::Write) -> std::fmt::Result {
write!(w, "{}", self)
}
}
#[derive(PartialEq, Eq, Debug)]
pub enum OutputFormat {
Display,
Json,
JsonCompact,
DisplayQuiet,
DisplayVerbose,
}
impl OutputFormat {
pub fn formatted_string<T>(&self, item: &T) -> String
where
T: Serialize + fmt::Display + QuietDisplay + VerboseDisplay,
{
match self {
OutputFormat::Display => format!("{}", item),
OutputFormat::DisplayQuiet => {
let mut s = String::new();
QuietDisplay::write_str(item, &mut s).unwrap();
s
}
OutputFormat::DisplayVerbose => {
let mut s = String::new();
VerboseDisplay::write_str(item, &mut s).unwrap();
s
}
OutputFormat::Json => serde_json::to_string_pretty(item).unwrap(),
OutputFormat::JsonCompact => serde_json::to_value(item).unwrap().to_string(),
}
}
pub fn from_matches(matches: &ArgMatches, output_name: &str, verbose: bool) -> Self {
matches
.value_of(output_name)
.map(|value| match value {
"json" => OutputFormat::Json,
"json-compact" => OutputFormat::JsonCompact,
_ => unreachable!(),
})
.unwrap_or(if verbose {
OutputFormat::DisplayVerbose
} else {
OutputFormat::Display
})
}
}
pub fn writeln_name_value(f: &mut dyn fmt::Write, name: &str, value: &str) -> fmt::Result {
let styled_value = if value.is_empty() {
style("(not set)").italic()
} else {
style(value)
};
writeln!(f, "{} {}", style(name).bold(), styled_value)
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliSignature {
pub signature: String,
}
impl QuietDisplay for CliSignature {}
impl VerboseDisplay for CliSignature {}
impl fmt::Display for CliSignature {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Signature:", &self.signature)?;
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CliSignatureVerificationStatus {
None,
Pass,
Fail,
}
impl CliSignatureVerificationStatus {
pub fn verify_transaction(tx: &VersionedTransaction) -> Vec<Self> {
tx.verify_with_results()
.iter()
.zip(&tx.signatures)
.map(|(stat, sig)| match stat {
true => CliSignatureVerificationStatus::Pass,
false if sig == &Signature::default() => CliSignatureVerificationStatus::None,
false => CliSignatureVerificationStatus::Fail,
})
.collect()
}
}
impl fmt::Display for CliSignatureVerificationStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::None => write!(f, "none"),
Self::Pass => write!(f, "pass"),
Self::Fail => write!(f, "fail"),
}
}
}
enum CliTimezone {
Local,
#[allow(dead_code)]
Utc,
}
fn write_block_time<W: io::Write>(
w: &mut W,
block_time: Option<UnixTimestamp>,
timezone: CliTimezone,
prefix: &str,
) -> io::Result<()> {
if let Some(block_time) = block_time {
let block_time_output = match timezone {
CliTimezone::Local => format!("{:?}", Local.timestamp_opt(block_time, 0).unwrap()),
CliTimezone::Utc => format!("{:?}", Utc.timestamp_opt(block_time, 0).unwrap()),
};
writeln!(w, "{}Block Time: {}", prefix, block_time_output,)?;
}
Ok(())
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum AccountKeyType<'a> {
Known(&'a Pubkey),
Unknown {
lookup_index: usize,
table_index: u8,
},
}
impl fmt::Display for AccountKeyType<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::Known(address) => write!(f, "{}", address),
Self::Unknown {
lookup_index,
table_index,
} => {
write!(
f,
"Unknown Address (uses lookup {} and index {})",
lookup_index, table_index
)
}
}
}
}
fn transform_lookups_to_unknown_keys(lookups: &[MessageAddressTableLookup]) -> Vec<AccountKeyType> {
let unknown_writable_keys = lookups
.iter()
.enumerate()
.flat_map(|(lookup_index, lookup)| {
lookup
.writable_indexes
.iter()
.map(move |table_index| AccountKeyType::Unknown {
lookup_index,
table_index: *table_index,
})
});
let unknown_readonly_keys = lookups
.iter()
.enumerate()
.flat_map(|(lookup_index, lookup)| {
lookup
.readonly_indexes
.iter()
.map(move |table_index| AccountKeyType::Unknown {
lookup_index,
table_index: *table_index,
})
});
unknown_writable_keys.chain(unknown_readonly_keys).collect()
}
fn write_version<W: io::Write>(
w: &mut W,
version: TransactionVersion,
prefix: &str,
) -> io::Result<()> {
let version = match version {
TransactionVersion::Legacy(_) => "legacy".to_string(),
TransactionVersion::Number(number) => number.to_string(),
};
writeln!(w, "{}Version: {}", prefix, version)
}
fn write_recent_blockhash<W: io::Write>(
w: &mut W,
recent_blockhash: &Hash,
prefix: &str,
) -> io::Result<()> {
writeln!(w, "{}Recent Blockhash: {:?}", prefix, recent_blockhash)
}
fn write_signatures<W: io::Write>(
w: &mut W,
signatures: &[Signature],
sigverify_status: Option<&[CliSignatureVerificationStatus]>,
prefix: &str,
) -> io::Result<()> {
let sigverify_statuses = if let Some(sigverify_status) = sigverify_status {
sigverify_status
.iter()
.map(|s| format!(" ({})", s))
.collect()
} else {
vec!["".to_string(); signatures.len()]
};
for (signature_index, (signature, sigverify_status)) in
signatures.iter().zip(&sigverify_statuses).enumerate()
{
writeln!(
w,
"{}Signature {}: {:?}{}",
prefix, signature_index, signature, sigverify_status,
)?;
}
Ok(())
}
struct CliAccountMeta {
is_signer: bool,
is_writable: bool,
is_invoked: bool,
}
fn write_account<W: io::Write>(
w: &mut W,
account_index: usize,
account_address: AccountKeyType,
account_mode: String,
is_fee_payer: bool,
prefix: &str,
) -> io::Result<()> {
writeln!(
w,
"{}Account {}: {} {}{}",
prefix,
account_index,
account_mode,
account_address,
if is_fee_payer { " (fee payer)" } else { "" },
)
}
fn format_account_mode(meta: CliAccountMeta) -> String {
format!(
"{}r{}{}", // accounts are always readable...
if meta.is_signer {
"s" // stands for signer
} else {
"-"
},
if meta.is_writable {
"w" // comment for consistent rust fmt (no joking; lol)
} else {
"-"
},
// account may be executable on-chain while not being
// designated as a program-id in the message
if meta.is_invoked {
"x"
} else {
// programs to be executed via CPI cannot be identified as
// executable from the message
"-"
},
)
}
fn write_instruction<'a, W: io::Write>(
w: &mut W,
instruction_index: usize,
program_pubkey: AccountKeyType,
instruction: &CompiledInstruction,
instruction_accounts: impl Iterator<Item = (AccountKeyType<'a>, u8)>,
prefix: &str,
) -> io::Result<()> {
writeln!(w, "{}Instruction {}", prefix, instruction_index)?;
writeln!(
w,
"{} Program: {} ({})",
prefix, program_pubkey, instruction.program_id_index
)?;
for (index, (account_address, account_index)) in instruction_accounts.enumerate() {
writeln!(
w,
"{} Account {}: {} ({})",
prefix, index, account_address, account_index
)?;
}
// TODO:
let raw = true;
// if let AccountKeyType::Known(program_pubkey) = program_pubkey {
// if program_pubkey == &solana_vote_program::id() {
// if let Ok(vote_instruction) = limited_deserialize::<
// solana_vote_program::vote_instruction::VoteInstruction,
// >(&instruction.data)
// {
// writeln!(w, "{} {:?}", prefix, vote_instruction)?;
// raw = false;
// }
// } else if program_pubkey == &stake::program::id() {
// if let Ok(stake_instruction) =
// limited_deserialize::<stake::instruction::StakeInstruction>(&instruction.data)
// {
// writeln!(w, "{} {:?}", prefix, stake_instruction)?;
// raw = false;
// }
// } else if program_pubkey == &solana_sdk::system_program::id() {
// if let Ok(system_instruction) = limited_deserialize::<
// solana_sdk::system_instruction::SystemInstruction,
// >(&instruction.data)
// {
// writeln!(w, "{} {:?}", prefix, system_instruction)?;
// raw = false;
// }
// } else if is_memo_program(program_pubkey) {
// if let Ok(s) = std::str::from_utf8(&instruction.data) {
// writeln!(w, "{} Data: \"{}\"", prefix, s)?;
// raw = false;
// }
// }
// }
if raw {
writeln!(w, "{} Data: {:?}", prefix, instruction.data)?;
}
Ok(())
}
fn write_address_table_lookups<W: io::Write>(
w: &mut W,
address_table_lookups: &[MessageAddressTableLookup],
prefix: &str,
) -> io::Result<()> {
for (lookup_index, lookup) in address_table_lookups.iter().enumerate() {
writeln!(w, "{}Address Table Lookup {}", prefix, lookup_index,)?;
writeln!(w, "{} Table Account: {}", prefix, lookup.account_key,)?;
writeln!(
w,
"{} Writable Indexes: {:?}",
prefix,
&lookup.writable_indexes[..],
)?;
writeln!(
w,
"{} Readonly Indexes: {:?}",
prefix,
&lookup.readonly_indexes[..],
)?;
}
Ok(())
}
fn write_status<W: io::Write>(
w: &mut W,
transaction_status: &Result<(), TransactionError>,
prefix: &str,
) -> io::Result<()> {
writeln!(
w,
"{}Status: {}",
prefix,
match transaction_status {
Ok(_) => "Ok".into(),
Err(err) => err.to_string(),
}
)
}
fn write_fees<W: io::Write>(w: &mut W, transaction_fee: u64, prefix: &str) -> io::Result<()> {
writeln!(w, "{} Fee: ◎{}", prefix, lamports_to_sol(transaction_fee))
}
fn write_balances<W: io::Write>(
w: &mut W,
transaction_status: &UiTransactionStatusMeta,
prefix: &str,
) -> io::Result<()> {
assert_eq!(
transaction_status.pre_balances.len(),
transaction_status.post_balances.len()
);
for (i, (pre, post)) in transaction_status
.pre_balances
.iter()
.zip(transaction_status.post_balances.iter())
.enumerate()
{
if pre == post {
writeln!(
w,
"{} Account {} balance: ◎{}",
prefix,
i,
lamports_to_sol(*pre)
)?;
} else {
writeln!(
w,
"{} Account {} balance: ◎{} -> ◎{}",
prefix,
i,
lamports_to_sol(*pre),
lamports_to_sol(*post)
)?;
}
}
Ok(())
}
fn write_log_messages<W: io::Write>(
w: &mut W,
log_messages: Option<&Vec<String>>,
prefix: &str,
) -> io::Result<()> {
if let Some(log_messages) = log_messages {
if !log_messages.is_empty() {
writeln!(w, "{}Log Messages:", prefix,)?;
for log_message in log_messages {
writeln!(w, "{} {}", prefix, log_message)?;
}
}
}
Ok(())
}
fn write_return_data<W: io::Write>(
w: &mut W,
return_data: Option<&TransactionReturnData>,
prefix: &str,
) -> io::Result<()> {
if let Some(return_data) = return_data {
if !return_data.data.is_empty() {
use pretty_hex::*;
writeln!(
w,
"{}Return Data from Program {}:",
prefix, return_data.program_id
)?;
writeln!(w, "{} {:?}", prefix, return_data.data.hex_dump())?;
}
}
Ok(())
}
fn write_rewards<W: io::Write>(
w: &mut W,
rewards: Option<&Rewards>,
prefix: &str,
) -> io::Result<()> {
if let Some(rewards) = rewards {
if !rewards.is_empty() {
writeln!(w, "{}Rewards:", prefix,)?;
writeln!(
w,
"{} {:<44} {:^15} {:<16} {:<20}",
prefix, "Address", "Type", "Amount", "New Balance"
)?;
for reward in rewards {
let sign = if reward.lamports < 0 { "-" } else { "" };
writeln!(
w,
"{} {:<44} {:^15} {}◎{:<14.9} ◎{:<18.9}",
prefix,
reward.pubkey,
if let Some(reward_type) = reward.reward_type {
format!("{:?}", reward_type)
} else {
"-".to_string()
},
sign,
lamports_to_sol(reward.lamports.unsigned_abs()),
lamports_to_sol(reward.post_balance)
)?;
}
}
}
Ok(())
}
fn write_transaction<W: io::Write>(
w: &mut W,
transaction: &VersionedTransaction,
transaction_status: Option<&UiTransactionStatusMeta>,
prefix: &str,
sigverify_status: Option<&[CliSignatureVerificationStatus]>,
block_time: Option<UnixTimestamp>,
timezone: CliTimezone,
) -> io::Result<()> {
write_block_time(w, block_time, timezone, prefix)?;
let message = &transaction.message;
let account_keys: Vec<AccountKeyType> = {
let static_keys_iter = message
.static_account_keys()
.iter()
.map(AccountKeyType::Known);
let dynamic_keys: Vec<AccountKeyType> = message
.address_table_lookups()
.map(transform_lookups_to_unknown_keys)
.unwrap_or_default();
static_keys_iter.chain(dynamic_keys).collect()
};
write_version(w, transaction.version(), prefix)?;
write_recent_blockhash(w, message.recent_blockhash(), prefix)?;
write_signatures(w, &transaction.signatures, sigverify_status, prefix)?;
let mut fee_payer_index = None;
for (account_index, account) in account_keys.iter().enumerate() {
if fee_payer_index.is_none() && message.is_non_loader_key(account_index) {
fee_payer_index = Some(account_index)
}
let account_meta = CliAccountMeta {
is_signer: message.is_signer(account_index),
is_writable: message.is_maybe_writable(account_index),
is_invoked: message.is_invoked(account_index),
};
write_account(
w,
account_index,
*account,
format_account_mode(account_meta),
Some(account_index) == fee_payer_index,
prefix,
)?;
}
for (instruction_index, instruction) in message.instructions().iter().enumerate() {
let program_pubkey = account_keys[instruction.program_id_index as usize];
let instruction_accounts = instruction
.accounts
.iter()
.map(|account_index| (account_keys[*account_index as usize], *account_index));
write_instruction(
w,
instruction_index,
program_pubkey,
instruction,
instruction_accounts,
prefix,
)?;
}
if let Some(address_table_lookups) = message.address_table_lookups() {
write_address_table_lookups(w, address_table_lookups, prefix)?;
}
if let Some(transaction_status) = transaction_status {
write_status(w, &transaction_status.status, prefix)?;
write_fees(w, transaction_status.fee, prefix)?;
write_balances(w, transaction_status, prefix)?;
write_log_messages(w, transaction_status.log_messages.as_ref(), prefix)?;
write_return_data(w, transaction_status.return_data.as_ref(), prefix)?;
write_rewards(w, transaction_status.rewards.as_ref(), prefix)?;
} else {
writeln!(w, "{}Status: Unavailable", prefix)?;
}
Ok(())
}
pub fn writeln_transaction(
f: &mut dyn fmt::Write,
transaction: &VersionedTransaction,
transaction_status: Option<&UiTransactionStatusMeta>,
prefix: &str,
sigverify_status: Option<&[CliSignatureVerificationStatus]>,
block_time: Option<UnixTimestamp>,
) -> fmt::Result {
let mut w = Vec::new();
let write_result = write_transaction(
&mut w,
transaction,
transaction_status,
prefix,
sigverify_status,
block_time,
CliTimezone::Local,
);
if write_result.is_ok() {
if let Ok(s) = String::from_utf8(w) {
write!(f, "{}", s)?;
}
}
Ok(())
}
pub fn println_transaction(
transaction: &VersionedTransaction,
transaction_status: Option<&UiTransactionStatusMeta>,
prefix: &str,
sigverify_status: Option<&[CliSignatureVerificationStatus]>,
block_time: Option<UnixTimestamp>,
) {
let mut w = Vec::new();
if write_transaction(
&mut w,
transaction,
transaction_status,
prefix,
sigverify_status,
block_time,
CliTimezone::Local,
)
.is_ok()
{
if let Ok(s) = String::from_utf8(w) {
print!("{}", s);
}
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliTransaction {
pub transaction: EncodedTransaction,
pub meta: Option<UiTransactionStatusMeta>,
pub block_time: Option<UnixTimestamp>,
#[serde(skip_serializing)]
pub slot: Option<Slot>,
#[serde(skip_serializing)]
pub decoded_transaction: VersionedTransaction,
#[serde(skip_serializing)]
pub prefix: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub sigverify_status: Vec<CliSignatureVerificationStatus>,
}
impl QuietDisplay for CliTransaction {}
impl VerboseDisplay for CliTransaction {}
impl fmt::Display for CliTransaction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln_transaction(
f,
&self.decoded_transaction,
self.meta.as_ref(),
&self.prefix,
if !self.sigverify_status.is_empty() {
Some(&self.sigverify_status)
} else {
None
},
self.block_time,
)
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliTransactionConfirmation {
pub confirmation_status: Option<TransactionConfirmationStatus>,
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub transaction: Option<CliTransaction>,
#[serde(skip_serializing)]
pub get_transaction_error: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub err: Option<TransactionError>,
}
impl QuietDisplay for CliTransactionConfirmation {}
impl VerboseDisplay for CliTransactionConfirmation {
fn write_str(&self, w: &mut dyn std::fmt::Write) -> std::fmt::Result {
if let Some(transaction) = &self.transaction {
writeln!(
w,
"\nTransaction executed in slot {}:",
transaction.slot.expect("slot should exist")
)?;
write!(w, "{}", transaction)?;
} else if let Some(confirmation_status) = &self.confirmation_status {
if confirmation_status != &TransactionConfirmationStatus::Finalized {
writeln!(w)?;
writeln!(
w,
"Unable to get finalized transaction details: not yet finalized"
)?;
} else if let Some(err) = &self.get_transaction_error {
writeln!(w)?;
writeln!(w, "Unable to get finalized transaction details: {}", err)?;
}
}
writeln!(w)?;
write!(w, "{}", self)
}
}
impl fmt::Display for CliTransactionConfirmation {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match &self.confirmation_status {
None => write!(f, "Not found"),
Some(confirmation_status) => {
if let Some(err) = &self.err {
write!(f, "Transaction failed: {}", err)
} else {
write!(f, "{:?}", confirmation_status)
}
}
}
}
}
#[derive(Clone, Debug)]
pub struct BuildBalanceMessageConfig {
pub use_lamports_unit: bool,
pub show_unit: bool,
pub trim_trailing_zeros: bool,
}
impl Default for BuildBalanceMessageConfig {
fn default() -> Self {
Self {
use_lamports_unit: false,
show_unit: true,
trim_trailing_zeros: true,
}
}
}
pub fn build_balance_message_with_config(
lamports: u64,
config: &BuildBalanceMessageConfig,
) -> String {
let value = if config.use_lamports_unit {
lamports.to_string()
} else {
let sol = lamports_to_sol(lamports);
let sol_str = format!("{:.9}", sol);
if config.trim_trailing_zeros {
sol_str
.trim_end_matches('0')
.trim_end_matches('.')
.to_string()
} else {
sol_str
}
};
let unit = if config.show_unit {
if config.use_lamports_unit {
let ess = if lamports == 1 { "" } else { "s" };
format!(" lamport{}", ess)
} else {
" SOL".to_string()
}
} else {
"".to_string()
};
format!("{}{}", value, unit)
}
pub fn build_balance_message(lamports: u64, use_lamports_unit: bool, show_unit: bool) -> String {
build_balance_message_with_config(
lamports,
&BuildBalanceMessageConfig {
use_lamports_unit,
show_unit,
..BuildBalanceMessageConfig::default()
},
)
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcKeyedAccount {
pub pubkey: String,
pub account: UiAccount,
}
#[derive(Serialize, Deserialize)]
pub struct CliAccount {
#[serde(flatten)]
pub keyed_account: RpcKeyedAccount,
#[serde(skip_serializing, skip_deserializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliAccount {}
impl VerboseDisplay for CliAccount {}
impl fmt::Display for CliAccount {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Public Key:", &self.keyed_account.pubkey)?;
writeln_name_value(
f,
"Balance:",
&build_balance_message(
self.keyed_account.account.lamports,
self.use_lamports_unit,
true,
),
)?;
writeln_name_value(f, "Owner:", &self.keyed_account.account.owner)?;
writeln_name_value(
f,
"Executable:",
&self.keyed_account.account.executable.to_string(),
)?;
writeln_name_value(
f,
"Rent Epoch:",
&self.keyed_account.account.rent_epoch.to_string(),
)?;
Ok(())
}
}
#[derive(Debug, Default)]
pub struct ReturnSignersConfig {
pub dump_transaction_message: bool,
}
#[derive(Serialize, Deserialize, Default, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CliSignOnlyData {
pub blockhash: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub signers: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub absent: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub bad_sig: Vec<String>,
}
impl QuietDisplay for CliSignOnlyData {}
impl VerboseDisplay for CliSignOnlyData {}
impl fmt::Display for CliSignOnlyData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Blockhash:", &self.blockhash)?;
if let Some(message) = self.message.as_ref() {
writeln_name_value(f, "Transaction Message:", message)?;
}
if !self.signers.is_empty() {
writeln!(f, "{}", style("Signers (Pubkey=Signature):").bold())?;
for signer in self.signers.iter() {
writeln!(f, " {}", signer)?;
}
}
if !self.absent.is_empty() {
writeln!(f, "{}", style("Absent Signers (Pubkey):").bold())?;
for pubkey in self.absent.iter() {
writeln!(f, " {}", pubkey)?;
}
}
if !self.bad_sig.is_empty() {
writeln!(f, "{}", style("Bad Signatures (Pubkey):").bold())?;
for pubkey in self.bad_sig.iter() {
writeln!(f, " {}", pubkey)?;
}
}
Ok(())
}
}
pub fn return_signers_data(tx: &Transaction, config: &ReturnSignersConfig) -> CliSignOnlyData {
let verify_results = tx.verify_with_results();
let mut signers = Vec::new();
let mut absent = Vec::new();
let mut bad_sig = Vec::new();
tx.signatures
.iter()
.zip(tx.message.account_keys.iter())
.zip(verify_results)
.for_each(|((sig, key), res)| {
if res {
signers.push(format!("{}={}", key, sig))
} else if *sig == Signature::default() {
absent.push(key.to_string());
} else {
bad_sig.push(key.to_string());
}
});
let message = if config.dump_transaction_message {
let message_data = tx.message_data();
Some(base64::encode(message_data))
} else {
None
};
CliSignOnlyData {
blockhash: tx.message.recent_blockhash.to_string(),
message,
signers,
absent,
bad_sig,
}
}
pub fn return_signers_with_config(
tx: &Transaction,
output_format: &OutputFormat,
config: &ReturnSignersConfig,
) -> Result<String, Box<dyn std::error::Error>> {
let cli_command = return_signers_data(tx, config);
Ok(output_format.formatted_string(&cli_command))
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliProgramId {
pub program_id: String,
}
impl QuietDisplay for CliProgramId {}
impl VerboseDisplay for CliProgramId {}
impl fmt::Display for CliProgramId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln_name_value(f, "Program Id:", &self.program_id)
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliProgramBuffer {
pub buffer: String,
}
impl QuietDisplay for CliProgramBuffer {}
impl VerboseDisplay for CliProgramBuffer {}
impl fmt::Display for CliProgramBuffer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln_name_value(f, "Buffer:", &self.buffer)
}
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CliProgramAccountType {
Buffer,
Program,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliProgramAuthority {
pub authority: String,
pub account_type: CliProgramAccountType,
}
impl QuietDisplay for CliProgramAuthority {}
impl VerboseDisplay for CliProgramAuthority {}
impl fmt::Display for CliProgramAuthority {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln_name_value(f, "Account Type:", &format!("{:?}", self.account_type))?;
writeln_name_value(f, "Authority:", &self.authority)
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliProgram {
pub program_id: String,
pub owner: String,
pub data_len: usize,
}
impl QuietDisplay for CliProgram {}
impl VerboseDisplay for CliProgram {}
impl fmt::Display for CliProgram {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Program Id:", &self.program_id)?;
writeln_name_value(f, "Owner:", &self.owner)?;
writeln_name_value(
f,
"Data Length:",
&format!("{:?} ({:#x?}) bytes", self.data_len, self.data_len),
)?;
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliUpgradeableProgram {
pub program_id: String,
pub owner: String,
pub programdata_address: String,
pub authority: String,
pub last_deploy_slot: u64,
pub data_len: usize,
pub lamports: u64,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeableProgram {}
impl VerboseDisplay for CliUpgradeableProgram {}
impl fmt::Display for CliUpgradeableProgram {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Program Id:", &self.program_id)?;
writeln_name_value(f, "Owner:", &self.owner)?;
writeln_name_value(f, "ProgramData Address:", &self.programdata_address)?;
writeln_name_value(f, "Authority:", &self.authority)?;
writeln_name_value(
f,
"Last Deployed In Slot:",
&self.last_deploy_slot.to_string(),
)?;
writeln_name_value(
f,
"Data Length:",
&format!("{:?} ({:#x?}) bytes", self.data_len, self.data_len),
)?;
writeln_name_value(
f,
"Balance:",
&build_balance_message(self.lamports, self.use_lamports_unit, true),
)?;
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliUpgradeablePrograms {
pub programs: Vec<CliUpgradeableProgram>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeablePrograms {}
impl VerboseDisplay for CliUpgradeablePrograms {}
impl fmt::Display for CliUpgradeablePrograms {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(
"{:<44} | {:<9} | {:<44} | {}",
"Program Id", "Slot", "Authority", "Balance"
))
.bold()
)?;
for program in self.programs.iter() {
writeln!(
f,
"{}",
&format!(
"{:<44} | {:<9} | {:<44} | {}",
program.program_id,
program.last_deploy_slot,
program.authority,
build_balance_message(program.lamports, self.use_lamports_unit, true)
)
)?;
}
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliUpgradeableProgramClosed {
pub program_id: String,
pub lamports: u64,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeableProgramClosed {}
impl VerboseDisplay for CliUpgradeableProgramClosed {}
impl fmt::Display for CliUpgradeableProgramClosed {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln!(
f,
"Closed Program Id {}, {} reclaimed",
&self.program_id,
&build_balance_message(self.lamports, self.use_lamports_unit, true)
)?;
Ok(())
}
}
#[derive(Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliUpgradeableBuffer {
pub address: String,
pub authority: String,
pub data_len: usize,
pub lamports: u64,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeableBuffer {}
impl VerboseDisplay for CliUpgradeableBuffer {}
impl fmt::Display for CliUpgradeableBuffer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(f, "Buffer Address:", &self.address)?;
writeln_name_value(f, "Authority:", &self.authority)?;
writeln_name_value(
f,
"Balance:",
&build_balance_message(self.lamports, self.use_lamports_unit, true),
)?;
writeln_name_value(
f,
"Data Length:",
&format!("{:?} ({:#x?}) bytes", self.data_len, self.data_len),
)?;
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliUpgradeableBuffers {
pub buffers: Vec<CliUpgradeableBuffer>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliUpgradeableBuffers {}
impl VerboseDisplay for CliUpgradeableBuffers {}
impl fmt::Display for CliUpgradeableBuffers {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(
"{:<44} | {:<44} | {}",
"Buffer Address", "Authority", "Balance"
))
.bold()
)?;
for buffer in self.buffers.iter() {
writeln!(
f,
"{}",
&format!(
"{:<44} | {:<44} | {}",
buffer.address,
buffer.authority,
build_balance_message(buffer.lamports, self.use_lamports_unit, true)
)
)?;
}
Ok(())
}
}
pub fn get_name_value_or(name: &str, value: &str, setting_type: SettingType) -> String {
let description = match setting_type {
SettingType::Explicit => "",
SettingType::Computed => "(computed)",
SettingType::SystemDefault => "(default)",
};
format!(
"{} {} {}",
style(name).bold(),
style(value),
style(description).italic(),
)
}
pub fn get_name_value(name: &str, value: &str) -> String {
let styled_value = if value.is_empty() {
style("(not set)").italic()
} else {
style(value)
};
format!("{} {}", style(name).bold(), styled_value)
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliBlock {
#[serde(flatten)]
pub encoded_confirmed_block: EncodedConfirmedBlock,
#[serde(skip_serializing)]
pub slot: Slot,
}
impl QuietDisplay for CliBlock {}
impl VerboseDisplay for CliBlock {}
impl fmt::Display for CliBlock {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "Slot: {}", self.slot)?;
writeln!(
f,
"Parent Slot: {}",
self.encoded_confirmed_block.parent_slot
)?;
writeln!(f, "Blockhash: {}", self.encoded_confirmed_block.blockhash)?;
writeln!(
f,
"Previous Blockhash: {}",
self.encoded_confirmed_block.previous_blockhash
)?;
if let Some(block_time) = self.encoded_confirmed_block.block_time {
writeln!(
f,
"Block Time: {:?}",
Local.timestamp_opt(block_time, 0).unwrap()
)?;
}
if let Some(block_height) = self.encoded_confirmed_block.block_height {
writeln!(f, "Block Height: {:?}", block_height)?;
}
if !self.encoded_confirmed_block.rewards.is_empty() {
let mut rewards = self.encoded_confirmed_block.rewards.clone();
rewards.sort_by(|a, b| a.pubkey.cmp(&b.pubkey));
let mut total_rewards = 0;
writeln!(f, "Rewards:")?;
writeln!(
f,
" {:<44} {:^15} {:<15} {:<20} {:>14} {:>10}",
"Address", "Type", "Amount", "New Balance", "Percent Change", "Commission"
)?;
for reward in rewards {
let sign = if reward.lamports < 0 { "-" } else { "" };
total_rewards += reward.lamports;
#[allow(clippy::format_in_format_args)]
writeln!(
f,
" {:<44} {:^15} {:>15} {} {}",
reward.pubkey,
if let Some(reward_type) = reward.reward_type {
format!("{}", reward_type)
} else {
"-".to_string()
},
format!(
"{}◎{:<14.9}",
sign,
lamports_to_sol(reward.lamports.unsigned_abs())
),
if reward.post_balance == 0 {
" - -".to_string()
} else {
format!(
"◎{:<19.9} {:>13.9}%",
lamports_to_sol(reward.post_balance),
(reward.lamports.abs() as f64
/ (reward.post_balance as f64 - reward.lamports as f64))
* 100.0
)
},
reward
.commission
.map(|commission| format!("{:>9}%", commission))
.unwrap_or_else(|| " -".to_string())
)?;
}
let sign = if total_rewards < 0 { "-" } else { "" };
writeln!(
f,
"Total Rewards: {}◎{:<12.9}",
sign,
lamports_to_sol(total_rewards.unsigned_abs())
)?;
}
for (index, transaction_with_meta) in
self.encoded_confirmed_block.transactions.iter().enumerate()
{
writeln!(f, "Transaction {}:", index)?;
writeln_transaction(
f,
&transaction_with_meta.transaction.decode().unwrap(),
transaction_with_meta.meta.as_ref(),
" ",
None,
None,
)?;
}
Ok(())
}
}
pub fn unix_timestamp_to_string(unix_timestamp: UnixTimestamp) -> String {
match NaiveDateTime::from_timestamp_opt(unix_timestamp, 0) {
Some(ndt) => DateTime::<Utc>::from_naive_utc_and_offset(ndt, Utc)
.to_rfc3339_opts(SecondsFormat::Secs, true),
None => format!("UnixTimestamp {}", unix_timestamp),
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliBlockTime {
pub slot: Slot,
pub timestamp: UnixTimestamp,
}
impl QuietDisplay for CliBlockTime {}
impl VerboseDisplay for CliBlockTime {}
impl fmt::Display for CliBlockTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln_name_value(f, "Block:", &self.slot.to_string())?;
writeln_name_value(f, "Date:", &unix_timestamp_to_string(self.timestamp))
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliEpochInfo {
#[serde(flatten)]
pub epoch_info: EpochInfo,
#[serde(skip)]
pub average_slot_time_ms: u64,
#[serde(skip)]
pub start_block_time: Option<UnixTimestamp>,
#[serde(skip)]
pub current_block_time: Option<UnixTimestamp>,
}
impl QuietDisplay for CliEpochInfo {}
impl VerboseDisplay for CliEpochInfo {}
impl fmt::Display for CliEpochInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln_name_value(
f,
"Block height:",
&self.epoch_info.block_height.to_string(),
)?;
writeln_name_value(f, "Slot:", &self.epoch_info.absolute_slot.to_string())?;
writeln_name_value(f, "Epoch:", &self.epoch_info.epoch.to_string())?;
if let Some(transaction_count) = &self.epoch_info.transaction_count {
writeln_name_value(f, "Transaction Count:", &transaction_count.to_string())?;
}
let start_slot = self.epoch_info.absolute_slot - self.epoch_info.slot_index;
let end_slot = start_slot + self.epoch_info.slots_in_epoch;
writeln_name_value(
f,
"Epoch Slot Range:",
&format!("[{}..{})", start_slot, end_slot),
)?;
writeln_name_value(
f,
"Epoch Completed Percent:",
&format!(
"{:>3.3}%",
self.epoch_info.slot_index as f64 / self.epoch_info.slots_in_epoch as f64 * 100_f64
),
)?;
let remaining_slots_in_epoch = self.epoch_info.slots_in_epoch - self.epoch_info.slot_index;
writeln_name_value(
f,
"Epoch Completed Slots:",
&format!(
"{}/{} ({} remaining)",
self.epoch_info.slot_index,
self.epoch_info.slots_in_epoch,
remaining_slots_in_epoch
),
)?;
let (time_elapsed, annotation) = if let (Some(start_block_time), Some(current_block_time)) =
(self.start_block_time, self.current_block_time)
{
(
Duration::from_secs((current_block_time - start_block_time) as u64),
None,
)
} else {
(
slot_to_duration(self.epoch_info.slot_index, self.average_slot_time_ms),
Some("* estimated based on current slot durations"),
)
};
let time_remaining = slot_to_duration(remaining_slots_in_epoch, self.average_slot_time_ms);
writeln_name_value(
f,
"Epoch Completed Time:",
&format!(
"{}{}/{} ({} remaining)",
humantime::format_duration(time_elapsed),
if annotation.is_some() { "*" } else { "" },
humantime::format_duration(time_elapsed + time_remaining),
humantime::format_duration(time_remaining),
),
)?;
if let Some(annotation) = annotation {
writeln!(f)?;
writeln!(f, "{}", annotation)?;
}
Ok(())
}
}
fn slot_to_duration(slot: Slot, slot_time_ms: u64) -> Duration {
Duration::from_secs((slot * slot_time_ms) / 1000)
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliAccountBalances {
pub accounts: Vec<RpcAccountBalance>,
}
impl QuietDisplay for CliAccountBalances {}
impl VerboseDisplay for CliAccountBalances {}
impl fmt::Display for CliAccountBalances {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(
f,
"{}",
style(format!("{:<44} {}", "Address", "Balance")).bold()
)?;
for account in &self.accounts {
writeln!(
f,
"{:<44} {}",
account.address,
&format!("{} SOL", lamports_to_sol(account.lamports))
)?;
}
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliSupply {
pub total: u64,
pub circulating: u64,
pub non_circulating: u64,
pub non_circulating_accounts: Vec<String>,
#[serde(skip_serializing)]
pub print_accounts: bool,
}
impl From<RpcSupply> for CliSupply {
fn from(rpc_supply: RpcSupply) -> Self {
Self {
total: rpc_supply.total,
circulating: rpc_supply.circulating,
non_circulating: rpc_supply.non_circulating,
non_circulating_accounts: rpc_supply.non_circulating_accounts,
print_accounts: false,
}
}
}
impl QuietDisplay for CliSupply {}
impl VerboseDisplay for CliSupply {}
impl fmt::Display for CliSupply {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln_name_value(f, "Total:", &format!("{} SOL", lamports_to_sol(self.total)))?;
writeln_name_value(
f,
"Circulating:",
&format!("{} SOL", lamports_to_sol(self.circulating)),
)?;
writeln_name_value(
f,
"Non-Circulating:",
&format!("{} SOL", lamports_to_sol(self.non_circulating)),
)?;
if self.print_accounts {
writeln!(f)?;
writeln_name_value(f, "Non-Circulating Accounts:", " ")?;
for account in &self.non_circulating_accounts {
writeln!(f, " {}", account)?;
}
}
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliEpochReward {
pub epoch: Epoch,
pub effective_slot: Slot,
pub amount: u64, // lamports
pub post_balance: u64, // lamports
pub percent_change: f64,
pub apr: Option<f64>,
pub commission: Option<u8>,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliAuthorized {
pub staker: String,
pub withdrawer: String,
}
impl From<&Authorized> for CliAuthorized {
fn from(authorized: &Authorized) -> Self {
Self {
staker: authorized.staker.to_string(),
withdrawer: authorized.withdrawer.to_string(),
}
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliLockup {
pub unix_timestamp: UnixTimestamp,
pub epoch: Epoch,
pub custodian: String,
}
impl From<&Lockup> for CliLockup {
fn from(lockup: &Lockup) -> Self {
Self {
unix_timestamp: lockup.unix_timestamp,
epoch: lockup.epoch,
custodian: lockup.custodian.to_string(),
}
}
}
#[derive(Serialize, Deserialize, PartialEq, Eq)]
pub enum CliStakeType {
Stake,
RewardsPool,
Uninitialized,
Initialized,
}
impl Default for CliStakeType {
fn default() -> Self {
Self::Uninitialized
}
}
#[derive(Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliStakeState {
pub stake_type: CliStakeType,
pub account_balance: u64,
#[serde(skip_serializing_if = "Option::is_none")]
pub credits_observed: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub delegated_stake: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub delegated_vote_account_address: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub activation_epoch: Option<Epoch>,
#[serde(skip_serializing_if = "Option::is_none")]
pub deactivation_epoch: Option<Epoch>,
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub authorized: Option<CliAuthorized>,
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub lockup: Option<CliLockup>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
#[serde(skip_serializing)]
pub current_epoch: Epoch,
#[serde(skip_serializing_if = "Option::is_none")]
pub rent_exempt_reserve: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_stake: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub activating_stake: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub deactivating_stake: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub epoch_rewards: Option<Vec<CliEpochReward>>,
}
impl QuietDisplay for CliStakeState {}
impl VerboseDisplay for CliStakeState {
fn write_str(&self, w: &mut dyn std::fmt::Write) -> std::fmt::Result {
write!(w, "{}", self)?;
if let Some(credits) = self.credits_observed {
writeln!(w, "Credits Observed: {}", credits)?;
}
Ok(())
}
}
impl fmt::Display for CliStakeState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn show_authorized(f: &mut fmt::Formatter, authorized: &CliAuthorized) -> fmt::Result {
writeln!(f, "Stake Authority: {}", authorized.staker)?;
writeln!(f, "Withdraw Authority: {}", authorized.withdrawer)?;
Ok(())
}
fn show_lockup(f: &mut fmt::Formatter, lockup: Option<&CliLockup>) -> fmt::Result {
if let Some(lockup) = lockup {
if lockup.unix_timestamp != UnixTimestamp::default() {
writeln!(
f,
"Lockup Timestamp: {}",
unix_timestamp_to_string(lockup.unix_timestamp)
)?;
}
if lockup.epoch != Epoch::default() {
writeln!(f, "Lockup Epoch: {}", lockup.epoch)?;
}
writeln!(f, "Lockup Custodian: {}", lockup.custodian)?;
}
Ok(())
}
writeln!(
f,
"Balance: {}",
build_balance_message(self.account_balance, self.use_lamports_unit, true)
)?;
if let Some(rent_exempt_reserve) = self.rent_exempt_reserve {
writeln!(
f,
"Rent Exempt Reserve: {}",
build_balance_message(rent_exempt_reserve, self.use_lamports_unit, true)
)?;
}
match self.stake_type {
CliStakeType::RewardsPool => writeln!(f, "Stake account is a rewards pool")?,
CliStakeType::Uninitialized => writeln!(f, "Stake account is uninitialized")?,
CliStakeType::Initialized => {
writeln!(f, "Stake account is undelegated")?;
show_authorized(f, self.authorized.as_ref().unwrap())?;
show_lockup(f, self.lockup.as_ref())?;
}
CliStakeType::Stake => {
let show_delegation = {
self.active_stake.is_some()
|| self.activating_stake.is_some()
|| self.deactivating_stake.is_some()
|| self
.deactivation_epoch
.map(|de| de > self.current_epoch)
.unwrap_or(true)
};
if show_delegation {
let delegated_stake = self.delegated_stake.unwrap();
writeln!(
f,
"Delegated Stake: {}",
build_balance_message(delegated_stake, self.use_lamports_unit, true)
)?;
if self
.deactivation_epoch
.map(|d| self.current_epoch <= d)
.unwrap_or(true)
{
let active_stake = self.active_stake.unwrap_or(0);
writeln!(
f,
"Active Stake: {}",
build_balance_message(active_stake, self.use_lamports_unit, true),
)?;
let activating_stake = self.activating_stake.or_else(|| {
if self.active_stake.is_none() {
Some(delegated_stake)
} else {
None
}
});
if let Some(activating_stake) = activating_stake {
writeln!(
f,
"Activating Stake: {}",
build_balance_message(
activating_stake,
self.use_lamports_unit,
true
),
)?;
writeln!(
f,
"Stake activates starting from epoch: {}",
self.activation_epoch.unwrap()
)?;
}
}
if let Some(deactivation_epoch) = self.deactivation_epoch {
if self.current_epoch > deactivation_epoch {
let deactivating_stake = self.deactivating_stake.or(self.active_stake);
if let Some(deactivating_stake) = deactivating_stake {
writeln!(
f,
"Inactive Stake: {}",
build_balance_message(
delegated_stake - deactivating_stake,
self.use_lamports_unit,
true
),
)?;
writeln!(
f,
"Deactivating Stake: {}",
build_balance_message(
deactivating_stake,
self.use_lamports_unit,
true
),
)?;
}
}
writeln!(
f,
"Stake deactivates starting from epoch: {}",
deactivation_epoch
)?;
}
if let Some(delegated_vote_account_address) =
&self.delegated_vote_account_address
{
writeln!(
f,
"Delegated Vote Account Address: {}",
delegated_vote_account_address
)?;
}
} else {
writeln!(f, "Stake account is undelegated")?;
}
show_authorized(f, self.authorized.as_ref().unwrap())?;
show_lockup(f, self.lockup.as_ref())?;
show_epoch_rewards(f, &self.epoch_rewards)?
}
}
Ok(())
}
}
fn show_epoch_rewards(
f: &mut fmt::Formatter,
epoch_rewards: &Option<Vec<CliEpochReward>>,
) -> fmt::Result {
if let Some(epoch_rewards) = epoch_rewards {
if epoch_rewards.is_empty() {
return Ok(());
}
writeln!(f, "Epoch Rewards:")?;
writeln!(
f,
" {:<6} {:<11} {:<18} {:<18} {:>14} {:>14} {:>10}",
"Epoch", "Reward Slot", "Amount", "New Balance", "Percent Change", "APR", "Commission"
)?;
for reward in epoch_rewards {
writeln!(
f,
" {:<6} {:<11} ◎{:<17.9} ◎{:<17.9} {:>13.9}% {:>14} {:>10}",
reward.epoch,
reward.effective_slot,
lamports_to_sol(reward.amount),
lamports_to_sol(reward.post_balance),
reward.percent_change,
reward
.apr
.map(|apr| format!("{:.2}%", apr))
.unwrap_or_default(),
reward
.commission
.map(|commission| format!("{}%", commission))
.unwrap_or_else(|| "-".to_string())
)?;
}
}
Ok(())
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliKeyedStakeState {
pub stake_pubkey: String,
#[serde(flatten)]
pub stake_state: CliStakeState,
}
impl QuietDisplay for CliKeyedStakeState {}
impl VerboseDisplay for CliKeyedStakeState {
fn write_str(&self, w: &mut dyn std::fmt::Write) -> std::fmt::Result {
writeln!(w, "Stake Pubkey: {}", self.stake_pubkey)?;
VerboseDisplay::write_str(&self.stake_state, w)
}
}
impl fmt::Display for CliKeyedStakeState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "Stake Pubkey: {}", self.stake_pubkey)?;
write!(f, "{}", self.stake_state)
}
}
#[derive(Serialize, Deserialize)]
pub struct CliStakeVec(Vec<CliKeyedStakeState>);
impl CliStakeVec {
pub fn new(list: Vec<CliKeyedStakeState>) -> Self {
Self(list)
}
}
impl QuietDisplay for CliStakeVec {}
impl VerboseDisplay for CliStakeVec {
fn write_str(&self, w: &mut dyn std::fmt::Write) -> std::fmt::Result {
for state in &self.0 {
writeln!(w)?;
VerboseDisplay::write_str(state, w)?;
}
Ok(())
}
}
impl fmt::Display for CliStakeVec {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for state in &self.0 {
writeln!(f)?;
write!(f, "{}", state)?;
}
Ok(())
}
}
pub fn format_labeled_address(pubkey: &str, address_labels: &HashMap<String, String>) -> String {
let label = address_labels.get(pubkey);
match label {
Some(label) => format!(
"{:.31} ({:.4}..{})",
label,
pubkey,
pubkey.split_at(pubkey.len() - 4).1
),
None => pubkey.to_string(),
}
}
#[derive(Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliSlotStatus {
pub slot: Slot,
pub leader: String,
pub skipped: bool,
}
#[derive(Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliBlockProductionEntry {
pub identity_pubkey: String,
pub leader_slots: u64,
pub blocks_produced: u64,
pub skipped_slots: u64,
}
#[derive(Default, Serialize, Deserialize)]
pub struct CliBlockProduction {
pub epoch: Epoch,
pub start_slot: Slot,
pub end_slot: Slot,
pub total_slots: usize,
pub total_blocks_produced: usize,
pub total_slots_skipped: usize,
pub leaders: Vec<CliBlockProductionEntry>,
pub individual_slot_status: Vec<CliSlotStatus>,
#[serde(skip_serializing)]
pub verbose: bool,
}
impl QuietDisplay for CliBlockProduction {}
impl VerboseDisplay for CliBlockProduction {}
impl fmt::Display for CliBlockProduction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(
" {:<44} {:>15} {:>15} {:>15} {:>23}",
"Identity",
"Leader Slots",
"Blocks Produced",
"Skipped Slots",
"Skipped Slot Percentage",
))
.bold()
)?;
for leader in &self.leaders {
writeln!(
f,
" {:<44} {:>15} {:>15} {:>15} {:>22.2}%",
leader.identity_pubkey,
leader.leader_slots,
leader.blocks_produced,
leader.skipped_slots,
leader.skipped_slots as f64 / leader.leader_slots as f64 * 100.
)?;
}
writeln!(f)?;
writeln!(
f,
" {:<44} {:>15} {:>15} {:>15} {:>22.2}%",
format!("Epoch {} total:", self.epoch),
self.total_slots,
self.total_blocks_produced,
self.total_slots_skipped,
self.total_slots_skipped as f64 / self.total_slots as f64 * 100.
)?;
writeln!(
f,
" (using data from {} slots: {} to {})",
self.total_slots, self.start_slot, self.end_slot
)?;
if self.verbose {
writeln!(f)?;
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(" {:<15} {:<44}", "Slot", "Identity Pubkey")).bold(),
)?;
for status in &self.individual_slot_status {
if status.skipped {
writeln!(
f,
"{}",
style(format!(
" {:<15} {:<44} SKIPPED",
status.slot, status.leader
))
.red()
)?;
} else {
writeln!(
f,
"{}",
style(format!(" {:<15} {:<44}", status.slot, status.leader))
)?;
}
}
}
Ok(())
}
}
#[derive(Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CliValidator {
pub identity_pubkey: String,
pub vote_account_pubkey: String,
pub commission: u8,
pub last_vote: u64,
pub root_slot: u64,
pub credits: u64, // lifetime credits
pub epoch_credits: u64, // credits earned in the current epoch
pub activated_stake: u64,
pub version: CliVersion,
pub delinquent: bool,
pub skip_rate: Option<f64>,
}
impl CliValidator {
pub fn new(
vote_account: &RpcVoteAccountInfo,
current_epoch: Epoch,
version: CliVersion,
skip_rate: Option<f64>,
address_labels: &HashMap<String, String>,
) -> Self {
Self::_new(
vote_account,
current_epoch,
version,
skip_rate,
address_labels,
false,
)
}
pub fn new_delinquent(
vote_account: &RpcVoteAccountInfo,
current_epoch: Epoch,
version: CliVersion,
skip_rate: Option<f64>,
address_labels: &HashMap<String, String>,
) -> Self {
Self::_new(
vote_account,
current_epoch,
version,
skip_rate,
address_labels,
true,
)
}
fn _new(
vote_account: &RpcVoteAccountInfo,
current_epoch: Epoch,
version: CliVersion,
skip_rate: Option<f64>,
address_labels: &HashMap<String, String>,
delinquent: bool,
) -> Self {
let (credits, epoch_credits) = vote_account
.epoch_credits
.iter()
.find_map(|(epoch, credits, pre_credits)| {
if *epoch == current_epoch {
Some((*credits, credits.saturating_sub(*pre_credits)))
} else {
None
}
})
.unwrap_or((0, 0));
Self {
identity_pubkey: format_labeled_address(&vote_account.node_pubkey, address_labels),
vote_account_pubkey: format_labeled_address(&vote_account.vote_pubkey, address_labels),
commission: vote_account.commission,
last_vote: vote_account.last_vote,
root_slot: vote_account.root_slot,
credits,
epoch_credits,
activated_stake: vote_account.activated_stake,
version,
delinquent,
skip_rate,
}
}
}
#[derive(Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CliValidatorsStakeByVersion {
pub current_validators: usize,
pub delinquent_validators: usize,
pub current_active_stake: u64,
pub delinquent_active_stake: u64,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone, Copy)]
pub enum CliValidatorsSortOrder {
Delinquent,
Commission,
EpochCredits,
Identity,
LastVote,
Root,
SkipRate,
Stake,
VoteAccount,
Version,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliValidators {
pub total_active_stake: u64,
pub total_current_stake: u64,
pub total_delinquent_stake: u64,
pub validators: Vec<CliValidator>,
pub average_skip_rate: f64,
pub average_stake_weighted_skip_rate: f64,
#[serde(skip_serializing)]
pub validators_sort_order: CliValidatorsSortOrder,
#[serde(skip_serializing)]
pub validators_reverse_sort: bool,
#[serde(skip_serializing)]
pub number_validators: bool,
pub stake_by_version: BTreeMap<CliVersion, CliValidatorsStakeByVersion>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliValidators {}
impl VerboseDisplay for CliValidators {}
impl fmt::Display for CliValidators {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn write_vote_account(
f: &mut fmt::Formatter,
validator: &CliValidator,
total_active_stake: u64,
use_lamports_unit: bool,
highest_last_vote: u64,
highest_root: u64,
) -> fmt::Result {
fn non_zero_or_dash(v: u64, max_v: u64) -> String {
if v == 0 {
" - ".into()
} else if v == max_v {
format!("{:>9} ( 0)", v)
} else if v > max_v.saturating_sub(100) {
format!("{:>9} ({:>3})", v, -(max_v.saturating_sub(v) as isize))
} else {
format!("{:>9} ", v)
}
}
writeln!(
f,
"{} {:<44} {:<44} {:>3}% {:>14} {:>14} {:>7} {:>8} {:>7} {:>22} ({:.2}%)",
if validator.delinquent {
WARNING.to_string()
} else {
"\u{a0}".to_string()
},
validator.identity_pubkey,
validator.vote_account_pubkey,
validator.commission,
non_zero_or_dash(validator.last_vote, highest_last_vote),
non_zero_or_dash(validator.root_slot, highest_root),
if let Some(skip_rate) = validator.skip_rate {
format!("{:.2}%", skip_rate)
} else {
"- ".to_string()
},
validator.epoch_credits,
// convert to a string so that fill/alignment works correctly
validator.version.to_string(),
build_balance_message_with_config(
validator.activated_stake,
&BuildBalanceMessageConfig {
use_lamports_unit,
trim_trailing_zeros: false,
..BuildBalanceMessageConfig::default()
}
),
100. * validator.activated_stake as f64 / total_active_stake as f64,
)
}
let padding = if self.number_validators {
((self.validators.len() + 1) as f64).log10().floor() as usize + 1
} else {
0
};
let header = style(format!(
"{:padding$} {:<44} {:<38} {} {} {} {} {} {} {:>22}",
" ",
"Identity",
"Vote Account",
"Commission",
"Last Vote ",
"Root Slot ",
"Skip Rate",
"Credits",
"Version",
"Active Stake",
padding = padding + 1
))
.bold();
writeln!(f, "{}", header)?;
let mut sorted_validators = self.validators.clone();
match self.validators_sort_order {
CliValidatorsSortOrder::Delinquent => {
sorted_validators.sort_by_key(|a| a.delinquent);
}
CliValidatorsSortOrder::Commission => {
sorted_validators.sort_by_key(|a| a.commission);
}
CliValidatorsSortOrder::EpochCredits => {
sorted_validators.sort_by_key(|a| a.epoch_credits);
}
CliValidatorsSortOrder::Identity => {
sorted_validators.sort_by(|a, b| a.identity_pubkey.cmp(&b.identity_pubkey));
}
CliValidatorsSortOrder::LastVote => {
sorted_validators.sort_by_key(|a| a.last_vote);
}
CliValidatorsSortOrder::Root => {
sorted_validators.sort_by_key(|a| a.root_slot);
}
CliValidatorsSortOrder::VoteAccount => {
sorted_validators.sort_by(|a, b| a.vote_account_pubkey.cmp(&b.vote_account_pubkey));
}
CliValidatorsSortOrder::SkipRate => {
sorted_validators.sort_by(|a, b| {
use std::cmp::Ordering;
match (a.skip_rate, b.skip_rate) {
(None, None) => Ordering::Equal,
(None, Some(_)) => Ordering::Greater,
(Some(_), None) => Ordering::Less,
(Some(a), Some(b)) => a.partial_cmp(&b).unwrap_or(Ordering::Equal),
}
});
}
CliValidatorsSortOrder::Stake => {
sorted_validators.sort_by_key(|a| a.activated_stake);
}
CliValidatorsSortOrder::Version => {
sorted_validators.sort_by(|a, b| {
use std::cmp::Ordering;
match a.version.cmp(&b.version) {
Ordering::Equal => a.activated_stake.cmp(&b.activated_stake),
ordering => ordering,
}
});
}
}
if self.validators_reverse_sort {
sorted_validators.reverse();
}
let highest_root = sorted_validators
.iter()
.map(|v| v.root_slot)
.max()
.unwrap_or_default();
let highest_last_vote = sorted_validators
.iter()
.map(|v| v.last_vote)
.max()
.unwrap_or_default();
for (i, validator) in sorted_validators.iter().enumerate() {
if padding > 0 {
write!(f, "{:padding$}", i + 1, padding = padding)?;
}
write_vote_account(
f,
validator,
self.total_active_stake,
self.use_lamports_unit,
highest_last_vote,
highest_root,
)?;
}
// The actual header has long scrolled away. Print the header once more as a footer
if self.validators.len() > 100 {
writeln!(f, "{}", header)?;
}
writeln!(f)?;
writeln_name_value(
f,
"Average Stake-Weighted Skip Rate:",
&format!("{:.2}%", self.average_stake_weighted_skip_rate,),
)?;
writeln_name_value(
f,
"Average Unweighted Skip Rate: ",
&format!("{:.2}%", self.average_skip_rate),
)?;
writeln!(f)?;
writeln_name_value(
f,
"Active Stake:",
&build_balance_message(self.total_active_stake, self.use_lamports_unit, true),
)?;
if self.total_delinquent_stake > 0 {
writeln_name_value(
f,
"Current Stake:",
&format!(
"{} ({:0.2}%)",
&build_balance_message(self.total_current_stake, self.use_lamports_unit, true),
100. * self.total_current_stake as f64 / self.total_active_stake as f64
),
)?;
writeln_name_value(
f,
"Delinquent Stake:",
&format!(
"{} ({:0.2}%)",
&build_balance_message(
self.total_delinquent_stake,
self.use_lamports_unit,
true
),
100. * self.total_delinquent_stake as f64 / self.total_active_stake as f64
),
)?;
}
writeln!(f)?;
writeln!(f, "{}", style("Stake By Version:").bold())?;
for (version, info) in self.stake_by_version.iter().rev() {
writeln!(
f,
"{:<7} - {:4} current validators ({:>5.2}%){}",
// convert to a string so that fill/alignment works correctly
version.to_string(),
info.current_validators,
100. * info.current_active_stake as f64 / self.total_active_stake as f64,
if info.delinquent_validators > 0 {
format!(
" {:3} delinquent validators ({:>5.2}%)",
info.delinquent_validators,
100. * info.delinquent_active_stake as f64 / self.total_active_stake as f64
)
} else {
"".to_string()
},
)?;
}
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliEpochRewardshMetadata {
pub epoch: Epoch,
pub effective_slot: Slot,
pub block_time: UnixTimestamp,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliInflation {
pub governor: RpcInflationGovernor,
pub current_rate: RpcInflationRate,
}
impl QuietDisplay for CliInflation {}
impl VerboseDisplay for CliInflation {}
impl fmt::Display for CliInflation {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "{}", style("Inflation Governor:").bold())?;
if (self.governor.initial - self.governor.terminal).abs() < f64::EPSILON {
writeln!(
f,
"Fixed rate: {:>5.2}%",
self.governor.terminal * 100.
)?;
} else {
writeln!(
f,
"Initial rate: {:>5.2}%",
self.governor.initial * 100.
)?;
writeln!(
f,
"Terminal rate: {:>5.2}%",
self.governor.terminal * 100.
)?;
writeln!(
f,
"Rate reduction per year: {:>5.2}%",
self.governor.taper * 100.
)?;
writeln!(
f,
"* Rate reduction is derived using the target slot time in genesis config"
)?;
}
if self.governor.foundation_term > 0. {
writeln!(
f,
"Foundation percentage: {:>5.2}%",
self.governor.foundation
)?;
writeln!(
f,
"Foundation term: {:.1} years",
self.governor.foundation_term
)?;
}
writeln!(
f,
"\n{}",
style(format!("Inflation for Epoch {}:", self.current_rate.epoch)).bold()
)?;
writeln!(
f,
"Total rate: {:>5.2}%",
self.current_rate.total * 100.
)?;
writeln!(
f,
"Staking rate: {:>5.2}%",
self.current_rate.validator * 100.
)?;
if self.current_rate.foundation > 0. {
writeln!(
f,
"Foundation rate: {:>5.2}%",
self.current_rate.foundation * 100.
)?;
}
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliKeyedEpochReward {
pub address: String,
pub reward: Option<CliEpochReward>,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliKeyedEpochRewards {
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub epoch_metadata: Option<CliEpochRewardshMetadata>,
pub rewards: Vec<CliKeyedEpochReward>,
}
impl QuietDisplay for CliKeyedEpochRewards {}
impl VerboseDisplay for CliKeyedEpochRewards {}
impl fmt::Display for CliKeyedEpochRewards {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.rewards.is_empty() {
writeln!(f, "No rewards found in epoch")?;
return Ok(());
}
if let Some(metadata) = &self.epoch_metadata {
writeln!(f, "Epoch: {}", metadata.epoch)?;
writeln!(f, "Reward Slot: {}", metadata.effective_slot)?;
let timestamp = metadata.block_time;
writeln!(f, "Block Time: {}", unix_timestamp_to_string(timestamp))?;
}
writeln!(f, "Epoch Rewards:")?;
writeln!(
f,
" {:<44} {:<18} {:<18} {:>14} {:>14} {:>10}",
"Address", "Amount", "New Balance", "Percent Change", "APR", "Commission"
)?;
for keyed_reward in &self.rewards {
match &keyed_reward.reward {
Some(reward) => {
writeln!(
f,
" {:<44} ◎{:<17.9} ◎{:<17.9} {:>13.9}% {:>14} {:>10}",
keyed_reward.address,
lamports_to_sol(reward.amount),
lamports_to_sol(reward.post_balance),
reward.percent_change,
reward
.apr
.map(|apr| format!("{:.2}%", apr))
.unwrap_or_default(),
reward
.commission
.map(|commission| format!("{}%", commission))
.unwrap_or_else(|| "-".to_string())
)?;
}
None => {
writeln!(f, " {:<44} No rewards in epoch", keyed_reward.address,)?;
}
}
}
Ok(())
}
}
#[derive(Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliNonceAccount {
pub balance: u64,
pub minimum_balance_for_rent_exemption: u64,
pub nonce: Option<String>,
pub lamports_per_signature: Option<u64>,
pub authority: Option<String>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliNonceAccount {}
impl VerboseDisplay for CliNonceAccount {}
impl fmt::Display for CliNonceAccount {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(
f,
"Balance: {}",
build_balance_message(self.balance, self.use_lamports_unit, true)
)?;
writeln!(
f,
"Minimum Balance Required: {}",
build_balance_message(
self.minimum_balance_for_rent_exemption,
self.use_lamports_unit,
true
)
)?;
let nonce = self.nonce.as_deref().unwrap_or("uninitialized");
writeln!(f, "Nonce blockhash: {}", nonce)?;
if let Some(fees) = self.lamports_per_signature {
writeln!(f, "Fee: {} lamports per signature", fees)?;
} else {
writeln!(f, "Fees: uninitialized")?;
}
let authority = self.authority.as_deref().unwrap_or("uninitialized");
writeln!(f, "Authority: {}", authority)
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliEpochVotingHistory {
pub epoch: Epoch,
pub slots_in_epoch: u64,
pub credits_earned: u64,
pub credits: u64,
pub prev_credits: u64,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliAuthorizedVoters {
authorized_voters: BTreeMap<Epoch, String>,
}
impl QuietDisplay for CliAuthorizedVoters {}
impl VerboseDisplay for CliAuthorizedVoters {}
impl fmt::Display for CliAuthorizedVoters {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self.authorized_voters)
}
}
impl From<&AuthorizedVoters> for CliAuthorizedVoters {
fn from(authorized_voters: &AuthorizedVoters) -> Self {
let mut voter_map: BTreeMap<Epoch, String> = BTreeMap::new();
for (epoch, voter) in authorized_voters.iter() {
voter_map.insert(*epoch, voter.to_string());
}
Self {
authorized_voters: voter_map,
}
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliLockout {
pub slot: Slot,
pub confirmation_count: u32,
}
impl From<&Lockout> for CliLockout {
fn from(lockout: &Lockout) -> Self {
Self {
slot: lockout.slot,
confirmation_count: lockout.confirmation_count,
}
}
}
fn show_votes_and_credits(
f: &mut fmt::Formatter,
votes: &[CliLockout],
epoch_voting_history: &[CliEpochVotingHistory],
) -> fmt::Result {
if votes.is_empty() {
return Ok(());
}
// Existence of this should guarantee the occurrence of vote truncation
let newest_history_entry = epoch_voting_history.iter().next_back();
writeln!(
f,
"{} Votes (using {}/{} entries):",
(if newest_history_entry.is_none() {
"All"
} else {
"Recent"
}),
votes.len(),
MAX_LOCKOUT_HISTORY
)?;
for vote in votes.iter().rev() {
writeln!(
f,
"- slot: {} (confirmation count: {})",
vote.slot, vote.confirmation_count
)?;
}
if let Some(newest) = newest_history_entry {
writeln!(
f,
"- ... (truncated {} rooted votes, which have been credited)",
newest.credits
)?;
}
if !epoch_voting_history.is_empty() {
writeln!(
f,
"{} Epoch Voting History (using {}/{} entries):",
(if epoch_voting_history.len() < MAX_EPOCH_CREDITS_HISTORY {
"All"
} else {
"Recent"
}),
epoch_voting_history.len(),
MAX_EPOCH_CREDITS_HISTORY
)?;
writeln!(
f,
"* missed credits include slots unavailable to vote on due to delinquent leaders",
)?;
}
for entry in epoch_voting_history.iter().rev() {
writeln!(
f, // tame fmt so that this will be folded like following
"- epoch: {}",
entry.epoch
)?;
writeln!(
f,
" credits range: ({}..{}]",
entry.prev_credits, entry.credits
)?;
writeln!(
f,
" credits/slots: {}/{}",
entry.credits_earned, entry.slots_in_epoch
)?;
}
if let Some(oldest) = epoch_voting_history.iter().next() {
if oldest.prev_credits > 0 {
// Oldest entry doesn't start with 0. so history must be truncated...
// count of this combined pseudo credits range: (0..=oldest.prev_credits] like the above
// (or this is just [1..=oldest.prev_credits] for human's simpler minds)
let count = oldest.prev_credits;
writeln!(
f,
"- ... (omitting {} past rooted votes, which have already been credited)",
count
)?;
}
}
Ok(())
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliVoteAccount {
pub account_balance: u64,
pub validator_identity: String,
#[serde(flatten)]
pub authorized_voters: CliAuthorizedVoters,
pub authorized_withdrawer: String,
pub credits: u64,
pub commission: u8,
pub root_slot: Option<Slot>,
pub recent_timestamp: BlockTimestamp,
pub votes: Vec<CliLockout>,
pub epoch_voting_history: Vec<CliEpochVotingHistory>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub epoch_rewards: Option<Vec<CliEpochReward>>,
}
impl QuietDisplay for CliVoteAccount {}
impl VerboseDisplay for CliVoteAccount {}
impl fmt::Display for CliVoteAccount {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(
f,
"Account Balance: {}",
build_balance_message(self.account_balance, self.use_lamports_unit, true)
)?;
writeln!(f, "Validator Identity: {}", self.validator_identity)?;
writeln!(f, "Vote Authority: {}", self.authorized_voters)?;
writeln!(f, "Withdraw Authority: {}", self.authorized_withdrawer)?;
writeln!(f, "Credits: {}", self.credits)?;
writeln!(f, "Commission: {}%", self.commission)?;
writeln!(
f,
"Root Slot: {}",
match self.root_slot {
Some(slot) => slot.to_string(),
None => "~".to_string(),
}
)?;
writeln!(
f,
"Recent Timestamp: {} from slot {}",
unix_timestamp_to_string(self.recent_timestamp.timestamp),
self.recent_timestamp.slot
)?;
show_votes_and_credits(f, &self.votes, &self.epoch_voting_history)?;
show_epoch_rewards(f, &self.epoch_rewards)?;
Ok(())
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliStakeHistory {
pub entries: Vec<CliStakeHistoryEntry>,
#[serde(skip_serializing)]
pub use_lamports_unit: bool,
}
impl QuietDisplay for CliStakeHistory {}
impl VerboseDisplay for CliStakeHistory {}
impl fmt::Display for CliStakeHistory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f)?;
writeln!(
f,
"{}",
style(format!(
" {:<5} {:>20} {:>20} {:>20}",
"Epoch", "Effective Stake", "Activating Stake", "Deactivating Stake",
))
.bold()
)?;
let config = BuildBalanceMessageConfig {
use_lamports_unit: self.use_lamports_unit,
show_unit: false,
trim_trailing_zeros: false,
};
for entry in &self.entries {
writeln!(
f,
" {:>5} {:>20} {:>20} {:>20} {}",
entry.epoch,
build_balance_message_with_config(entry.effective_stake, &config),
build_balance_message_with_config(entry.activating_stake, &config),
build_balance_message_with_config(entry.deactivating_stake, &config),
if self.use_lamports_unit {
"lamports"
} else {
"SOL"
}
)?;
}
Ok(())
}
}
impl From<&(Epoch, StakeHistoryEntry)> for CliStakeHistoryEntry {
fn from((epoch, entry): &(Epoch, StakeHistoryEntry)) -> Self {
Self {
epoch: *epoch,
effective_stake: entry.effective,
activating_stake: entry.activating,
deactivating_stake: entry.deactivating,
}
}
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliStakeHistoryEntry {
pub epoch: Epoch,
pub effective_stake: u64,
pub activating_stake: u64,
pub deactivating_stake: u64,
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-cli-output/src/cli_version.rs
|
use {
serde::{Deserialize, Deserializer, Serialize, Serializer},
std::{fmt, str::FromStr},
};
#[derive(Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone)]
pub struct CliVersion(Option<semver::Version>);
impl CliVersion {
pub fn unknown_version() -> Self {
Self(None)
}
}
impl fmt::Display for CliVersion {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let s = match &self.0 {
None => "unknown".to_string(),
Some(version) => version.to_string(),
};
write!(f, "{}", s)
}
}
impl From<semver::Version> for CliVersion {
fn from(version: semver::Version) -> Self {
Self(Some(version))
}
}
impl FromStr for CliVersion {
type Err = semver::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let version_option = if s == "unknown" {
None
} else {
Some(semver::Version::from_str(s)?)
};
Ok(CliVersion(version_option))
}
}
impl Serialize for CliVersion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(&self.to_string())
}
}
impl<'de> Deserialize<'de> for CliVersion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s: &str = Deserialize::deserialize(deserializer)?;
CliVersion::from_str(s).map_err(serde::de::Error::custom)
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/Cargo.toml
|
[package]
name = "solana-extra-wasm"
version = "1.18.0" # mirror solana-sdk version
description = "Solana WASM compatible utilities."
authors = ["Acheron <acheroncrypto@gmail.com>"]
repository = "https://github.com/solana-playground/solana-playground"
license = "Apache-2.0"
homepage = "https://beta.solpg.io"
edition = "2021"
keywords = ["solana", "playground", "wasm", "extra", "utils"]
readme = "README.md"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
arrayref = "0.3"
assert_matches = "1"
base64 = "0.13"
bincode = "1"
borsh = "0.10"
bs58 = "0.4"
bytemuck = "1"
fluvio-wasm-timer = "0.2"
log = "0.4.17" # only for nightly builds
num-derive = "0.3"
num-traits = "0.2"
num_enum = "0.5"
serde = "1"
serde_derive = "1"
serde_json = "1"
solana-frozen-abi = "~1.18"
solana-frozen-abi-macro = "~1.18"
solana-sdk = "~1.18"
thiserror = "1"
[build-dependencies]
rustc_version = "0.4"
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/build.rs
|
extern crate rustc_version;
use rustc_version::{version_meta, Channel};
fn main() {
// Copied and adapted from
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example
// Licensed under Apache-2.0 + MIT
match version_meta().unwrap().channel {
Channel::Nightly | Channel::Dev => {
println!("cargo:rustc-cfg=NIGHTLY");
}
_ => {}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/runtime.rs
|
use std::fmt;
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, AbiExample, AbiEnumVisitor, Clone, Copy)]
pub enum RewardType {
Fee,
Rent,
Staking,
Voting,
}
impl fmt::Display for RewardType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
match self {
RewardType::Fee => "fee",
RewardType::Rent => "rent",
RewardType::Staking => "staking",
RewardType::Voting => "voting",
}
)
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/lib.rs
|
#![cfg_attr(NIGHTLY, feature(min_specialization))]
#![allow(dead_code)]
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate solana_frozen_abi_macro;
pub mod account_decoder;
pub mod program;
pub mod runtime;
pub mod transaction_status;
pub mod utils;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/transaction_status.rs
|
use std::fmt;
use serde_json::Value;
use solana_sdk::{
clock::{Slot, UnixTimestamp},
instruction::CompiledInstruction,
message::{
v0::{self, LoadedAddresses, LoadedMessage, MessageAddressTableLookup},
AccountKeys, Message, MessageHeader, VersionedMessage,
},
transaction::{
Result as TransactionResult, TransactionError, TransactionVersion, VersionedTransaction,
},
transaction_context::TransactionReturnData,
};
use thiserror::Error;
use crate::{account_decoder::parse_token::UiTokenAmount, runtime::RewardType};
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum TransactionBinaryEncoding {
Base58,
Base64,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum UiTransactionEncoding {
Binary, // Legacy. Retained for RPC backwards compatibility
Base64,
Base58,
Json,
JsonParsed,
}
impl UiTransactionEncoding {
pub fn into_binary_encoding(&self) -> Option<TransactionBinaryEncoding> {
match self {
Self::Binary | Self::Base58 => Some(TransactionBinaryEncoding::Base58),
Self::Base64 => Some(TransactionBinaryEncoding::Base64),
_ => None,
}
}
}
impl fmt::Display for UiTransactionEncoding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let v = serde_json::to_value(self).map_err(|_| fmt::Error)?;
let s = v.as_str().ok_or(fmt::Error)?;
write!(f, "{}", s)
}
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ParsedAccount {
pub pubkey: String,
pub writable: bool,
pub signer: bool,
}
/// A duplicate representation of a Transaction for pretty JSON serialization
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiTransaction {
pub signatures: Vec<String>,
pub message: UiMessage,
}
/// A duplicate representation of a CompiledInstruction for pretty JSON serialization
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiCompiledInstruction {
pub program_id_index: u8,
pub accounts: Vec<u8>,
pub data: String,
}
impl From<&CompiledInstruction> for UiCompiledInstruction {
fn from(instruction: &CompiledInstruction) -> Self {
Self {
program_id_index: instruction.program_id_index,
accounts: instruction.accounts.clone(),
data: bs58::encode(instruction.data.clone()).into_string(),
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ParsedInstruction {
pub program: String,
pub program_id: String,
pub parsed: Value,
}
/// A partially decoded CompiledInstruction that includes explicit account addresses
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiPartiallyDecodedInstruction {
pub program_id: String,
pub accounts: Vec<String>,
pub data: String,
}
impl UiPartiallyDecodedInstruction {
fn from(instruction: &CompiledInstruction, account_keys: &AccountKeys) -> Self {
Self {
program_id: account_keys[instruction.program_id_index as usize].to_string(),
accounts: instruction
.accounts
.iter()
.map(|&i| account_keys[i as usize].to_string())
.collect(),
data: bs58::encode(instruction.data.clone()).into_string(),
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", untagged)]
pub enum UiParsedInstruction {
Parsed(ParsedInstruction),
PartiallyDecoded(UiPartiallyDecodedInstruction),
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub enum ParsableProgram {
SplAssociatedTokenAccount,
SplMemo,
SplToken,
BpfLoader,
BpfUpgradeableLoader,
Stake,
System,
Vote,
}
#[derive(Error, Debug)]
pub enum ParseInstructionError {
#[error("{0:?} instruction not parsable")]
InstructionNotParsable(ParsableProgram),
#[error("{0:?} instruction key mismatch")]
InstructionKeyMismatch(ParsableProgram),
#[error("Program not parsable")]
ProgramNotParsable,
#[error("Internal error, please report")]
SerdeJsonError(#[from] serde_json::error::Error),
}
// TODO:
// lazy_static! {
// static ref ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey = spl_associated_token_id();
// static ref BPF_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader::id();
// static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id();
// static ref MEMO_V1_PROGRAM_ID: Pubkey = spl_memo_id_v1();
// static ref MEMO_V3_PROGRAM_ID: Pubkey = spl_memo_id_v3();
// static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id();
// static ref SYSTEM_PROGRAM_ID: Pubkey = system_program::id();
// static ref VOTE_PROGRAM_ID: Pubkey = solana_vote_program::id();
// static ref PARSABLE_PROGRAM_IDS: HashMap<Pubkey, ParsableProgram> = {
// let mut m = HashMap::new();
// m.insert(
// *ASSOCIATED_TOKEN_PROGRAM_ID,
// ParsableProgram::SplAssociatedTokenAccount,
// );
// m.insert(*MEMO_V1_PROGRAM_ID, ParsableProgram::SplMemo);
// m.insert(*MEMO_V3_PROGRAM_ID, ParsableProgram::SplMemo);
// for spl_token_id in spl_token_ids() {
// m.insert(spl_token_id, ParsableProgram::SplToken);
// }
// m.insert(*BPF_LOADER_PROGRAM_ID, ParsableProgram::BpfLoader);
// m.insert(
// *BPF_UPGRADEABLE_LOADER_PROGRAM_ID,
// ParsableProgram::BpfUpgradeableLoader,
// );
// m.insert(*STAKE_PROGRAM_ID, ParsableProgram::Stake);
// m.insert(*SYSTEM_PROGRAM_ID, ParsableProgram::System);
// m.insert(*VOTE_PROGRAM_ID, ParsableProgram::Vote);
// m
// };
// }
// pub fn parse(
// program_id: &Pubkey,
// instruction: &CompiledInstruction,
// account_keys: &AccountKeys,
// ) -> Result<ParsedInstruction, ParseInstructionError> {
// let program_name = PARSABLE_PROGRAM_IDS
// .get(program_id)
// .ok_or(ParseInstructionError::ProgramNotParsable)?;
// let parsed_json = match program_name {
// ParsableProgram::SplAssociatedTokenAccount => {
// serde_json::to_value(parse_associated_token(instruction, account_keys)?)?
// }
// ParsableProgram::SplMemo => parse_memo(instruction)?,
// ParsableProgram::SplToken => serde_json::to_value(parse_token(instruction, account_keys)?)?,
// ParsableProgram::BpfLoader => {
// serde_json::to_value(parse_bpf_loader(instruction, account_keys)?)?
// }
// ParsableProgram::BpfUpgradeableLoader => {
// serde_json::to_value(parse_bpf_upgradeable_loader(instruction, account_keys)?)?
// }
// ParsableProgram::Stake => serde_json::to_value(parse_stake(instruction, account_keys)?)?,
// ParsableProgram::System => serde_json::to_value(parse_system(instruction, account_keys)?)?,
// ParsableProgram::Vote => serde_json::to_value(parse_vote(instruction, account_keys)?)?,
// };
// Ok(ParsedInstruction {
// program: format!("{:?}", program_name).to_kebab_case(),
// program_id: program_id.to_string(),
// parsed: parsed_json,
// })
// }
/// A duplicate representation of an Instruction for pretty JSON serialization
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", untagged)]
pub enum UiInstruction {
Compiled(UiCompiledInstruction),
Parsed(UiParsedInstruction),
}
impl UiInstruction {
fn parse(instruction: &CompiledInstruction, account_keys: &AccountKeys) -> Self {
// TODO:
// let program_id = &account_keys[instruction.program_id_index as usize];
// if let Ok(parsed_instruction) = parse(program_id, instruction, account_keys) {
// UiInstruction::Parsed(UiParsedInstruction::Parsed(parsed_instruction))
// } else {
// UiInstruction::Parsed(UiParsedInstruction::PartiallyDecoded(
// UiPartiallyDecodedInstruction::from(instruction, account_keys),
// ))
// }
UiInstruction::Parsed(UiParsedInstruction::PartiallyDecoded(
UiPartiallyDecodedInstruction::from(instruction, account_keys),
))
}
}
/// A duplicate representation of a MessageAddressTableLookup, in raw format, for pretty JSON serialization
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiAddressTableLookup {
pub account_key: String,
pub writable_indexes: Vec<u8>,
pub readonly_indexes: Vec<u8>,
}
impl From<&MessageAddressTableLookup> for UiAddressTableLookup {
fn from(lookup: &MessageAddressTableLookup) -> Self {
Self {
account_key: lookup.account_key.to_string(),
writable_indexes: lookup.writable_indexes.clone(),
readonly_indexes: lookup.readonly_indexes.clone(),
}
}
}
/// A duplicate representation of a Message, in parsed format, for pretty JSON serialization
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiParsedMessage {
pub account_keys: Vec<ParsedAccount>,
pub recent_blockhash: String,
pub instructions: Vec<UiInstruction>,
pub address_table_lookups: Option<Vec<UiAddressTableLookup>>,
}
/// A duplicate representation of a Message, in raw format, for pretty JSON serialization
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiRawMessage {
pub header: MessageHeader,
pub account_keys: Vec<String>,
pub recent_blockhash: String,
pub instructions: Vec<UiCompiledInstruction>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub address_table_lookups: Option<Vec<UiAddressTableLookup>>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", untagged)]
pub enum UiMessage {
Parsed(UiParsedMessage),
Raw(UiRawMessage),
}
#[derive(Clone, Debug, PartialEq)]
pub struct TransactionStatusMeta {
pub status: TransactionResult<()>,
pub fee: u64,
pub pre_balances: Vec<u64>,
pub post_balances: Vec<u64>,
pub inner_instructions: Option<Vec<InnerInstructions>>,
pub log_messages: Option<Vec<String>>,
pub pre_token_balances: Option<Vec<TransactionTokenBalance>>,
pub post_token_balances: Option<Vec<TransactionTokenBalance>>,
pub rewards: Option<Rewards>,
pub loaded_addresses: LoadedAddresses,
pub return_data: Option<TransactionReturnData>,
}
impl Default for TransactionStatusMeta {
fn default() -> Self {
Self {
status: Ok(()),
fee: 0,
pre_balances: vec![],
post_balances: vec![],
inner_instructions: None,
log_messages: None,
pre_token_balances: None,
post_token_balances: None,
rewards: None,
loaded_addresses: LoadedAddresses::default(),
return_data: None,
}
}
}
pub fn parse_accounts(message: &Message) -> Vec<ParsedAccount> {
let mut accounts: Vec<ParsedAccount> = vec![];
for (i, account_key) in message.account_keys.iter().enumerate() {
accounts.push(ParsedAccount {
pubkey: account_key.to_string(),
writable: message.is_writable(i),
signer: message.is_signer(i),
});
}
accounts
}
pub fn parse_static_accounts(message: &LoadedMessage) -> Vec<ParsedAccount> {
let mut accounts: Vec<ParsedAccount> = vec![];
for (i, account_key) in message.static_account_keys().iter().enumerate() {
accounts.push(ParsedAccount {
pubkey: account_key.to_string(),
writable: message.is_writable(i),
signer: message.is_signer(i),
});
}
accounts
}
/// Represents types that can be encoded into one of several encoding formats
pub trait Encodable {
type Encoded;
fn encode(&self, encoding: UiTransactionEncoding) -> Self::Encoded;
}
impl Encodable for Message {
type Encoded = UiMessage;
fn encode(&self, encoding: UiTransactionEncoding) -> Self::Encoded {
if encoding == UiTransactionEncoding::JsonParsed {
let account_keys = AccountKeys::new(&self.account_keys, None);
UiMessage::Parsed(UiParsedMessage {
account_keys: parse_accounts(self),
recent_blockhash: self.recent_blockhash.to_string(),
instructions: self
.instructions
.iter()
.map(|instruction| UiInstruction::parse(instruction, &account_keys))
.collect(),
address_table_lookups: None,
})
} else {
UiMessage::Raw(UiRawMessage {
header: self.header,
account_keys: self.account_keys.iter().map(ToString::to_string).collect(),
recent_blockhash: self.recent_blockhash.to_string(),
instructions: self.instructions.iter().map(Into::into).collect(),
address_table_lookups: None,
})
}
}
}
impl EncodableWithMeta for v0::Message {
type Encoded = UiMessage;
fn encode_with_meta(
&self,
encoding: UiTransactionEncoding,
meta: &TransactionStatusMeta,
) -> Self::Encoded {
if encoding == UiTransactionEncoding::JsonParsed {
let account_keys = AccountKeys::new(&self.account_keys, Some(&meta.loaded_addresses));
let loaded_message = LoadedMessage::new_borrowed(self, &meta.loaded_addresses);
UiMessage::Parsed(UiParsedMessage {
account_keys: parse_static_accounts(&loaded_message),
recent_blockhash: self.recent_blockhash.to_string(),
instructions: self
.instructions
.iter()
.map(|instruction| UiInstruction::parse(instruction, &account_keys))
.collect(),
address_table_lookups: Some(
self.address_table_lookups.iter().map(Into::into).collect(),
),
})
} else {
self.json_encode()
}
}
fn json_encode(&self) -> Self::Encoded {
UiMessage::Raw(UiRawMessage {
header: self.header,
account_keys: self.account_keys.iter().map(ToString::to_string).collect(),
recent_blockhash: self.recent_blockhash.to_string(),
instructions: self.instructions.iter().map(Into::into).collect(),
address_table_lookups: Some(
self.address_table_lookups.iter().map(Into::into).collect(),
),
})
}
}
/// Represents types that can be encoded into one of several encoding formats
pub trait EncodableWithMeta {
type Encoded;
fn encode_with_meta(
&self,
encoding: UiTransactionEncoding,
meta: &TransactionStatusMeta,
) -> Self::Encoded;
fn json_encode(&self) -> Self::Encoded;
}
impl EncodableWithMeta for VersionedTransaction {
type Encoded = EncodedTransaction;
fn encode_with_meta(
&self,
encoding: UiTransactionEncoding,
meta: &TransactionStatusMeta,
) -> Self::Encoded {
match encoding {
UiTransactionEncoding::Binary => EncodedTransaction::LegacyBinary(
bs58::encode(bincode::serialize(self).unwrap()).into_string(),
),
UiTransactionEncoding::Base58 => EncodedTransaction::Binary(
bs58::encode(bincode::serialize(self).unwrap()).into_string(),
TransactionBinaryEncoding::Base58,
),
UiTransactionEncoding::Base64 => EncodedTransaction::Binary(
base64::encode(bincode::serialize(self).unwrap()),
TransactionBinaryEncoding::Base64,
),
UiTransactionEncoding::Json => self.json_encode(),
UiTransactionEncoding::JsonParsed => EncodedTransaction::Json(UiTransaction {
signatures: self.signatures.iter().map(ToString::to_string).collect(),
message: match &self.message {
VersionedMessage::Legacy(message) => {
message.encode(UiTransactionEncoding::JsonParsed)
}
VersionedMessage::V0(message) => {
message.encode_with_meta(UiTransactionEncoding::JsonParsed, meta)
}
},
}),
}
}
fn json_encode(&self) -> Self::Encoded {
EncodedTransaction::Json(UiTransaction {
signatures: self.signatures.iter().map(ToString::to_string).collect(),
message: match &self.message {
VersionedMessage::Legacy(message) => message.encode(UiTransactionEncoding::Json),
VersionedMessage::V0(message) => message.json_encode(),
},
})
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", untagged)]
pub enum EncodedTransaction {
LegacyBinary(String), // Old way of expressing base-58, retained for RPC backwards compatibility
Binary(String, TransactionBinaryEncoding),
Json(UiTransaction),
}
impl EncodedTransaction {
pub fn decode(&self) -> Option<VersionedTransaction> {
let (blob, encoding) = match self {
Self::Json(_) => return None,
Self::LegacyBinary(blob) => (blob, TransactionBinaryEncoding::Base58),
Self::Binary(blob, encoding) => (blob, *encoding),
};
let transaction: Option<VersionedTransaction> = match encoding {
TransactionBinaryEncoding::Base58 => bs58::decode(blob)
.into_vec()
.ok()
.and_then(|bytes| bincode::deserialize(&bytes).ok()),
TransactionBinaryEncoding::Base64 => base64::decode(blob)
.ok()
.and_then(|bytes| bincode::deserialize(&bytes).ok()),
};
transaction.filter(|transaction| transaction.sanitize().is_ok())
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Reward {
pub pubkey: String,
pub lamports: i64,
pub post_balance: u64, // Account balance in lamports after `lamports` was applied
pub reward_type: Option<RewardType>,
pub commission: Option<u8>, // Vote account commission when the reward was credited, only present for voting and staking rewards
}
pub type Rewards = Vec<Reward>;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct InnerInstructions {
/// Transaction instruction index
pub index: u8,
/// List of inner instructions
pub instructions: Vec<CompiledInstruction>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiInnerInstructions {
/// Transaction instruction index
pub index: u8,
/// List of inner instructions
pub instructions: Vec<UiInstruction>,
}
impl UiInnerInstructions {
fn parse(inner_instructions: InnerInstructions, account_keys: &AccountKeys) -> Self {
Self {
index: inner_instructions.index,
instructions: inner_instructions
.instructions
.iter()
.map(|ix| UiInstruction::parse(ix, account_keys))
.collect(),
}
}
}
impl From<InnerInstructions> for UiInnerInstructions {
fn from(inner_instructions: InnerInstructions) -> Self {
Self {
index: inner_instructions.index,
instructions: inner_instructions
.instructions
.iter()
.map(|ix| UiInstruction::Compiled(ix.into()))
.collect(),
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct TransactionTokenBalance {
pub account_index: u8,
pub mint: String,
pub ui_token_amount: UiTokenAmount,
pub owner: String,
pub program_id: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiTransactionTokenBalance {
pub account_index: u8,
pub mint: String,
pub ui_token_amount: UiTokenAmount,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub owner: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub program_id: Option<String>,
}
impl From<TransactionTokenBalance> for UiTransactionTokenBalance {
fn from(token_balance: TransactionTokenBalance) -> Self {
Self {
account_index: token_balance.account_index,
mint: token_balance.mint,
ui_token_amount: token_balance.ui_token_amount,
owner: if !token_balance.owner.is_empty() {
Some(token_balance.owner)
} else {
None
},
program_id: if !token_balance.program_id.is_empty() {
Some(token_balance.program_id)
} else {
None
},
}
}
}
/// A duplicate representation of LoadedAddresses
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiLoadedAddresses {
pub writable: Vec<String>,
pub readonly: Vec<String>,
}
impl From<&LoadedAddresses> for UiLoadedAddresses {
fn from(loaded_addresses: &LoadedAddresses) -> Self {
Self {
writable: loaded_addresses
.writable
.iter()
.map(ToString::to_string)
.collect(),
readonly: loaded_addresses
.readonly
.iter()
.map(ToString::to_string)
.collect(),
}
}
}
/// A duplicate representation of TransactionStatusMeta with `err` field
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiTransactionStatusMeta {
pub err: Option<TransactionError>,
pub status: TransactionResult<()>, // This field is deprecated. See https://github.com/solana-labs/solana/issues/9302
pub fee: u64,
pub pre_balances: Vec<u64>,
pub post_balances: Vec<u64>,
pub inner_instructions: Option<Vec<UiInnerInstructions>>,
pub log_messages: Option<Vec<String>>,
pub pre_token_balances: Option<Vec<UiTransactionTokenBalance>>,
pub post_token_balances: Option<Vec<UiTransactionTokenBalance>>,
pub rewards: Option<Rewards>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub loaded_addresses: Option<UiLoadedAddresses>,
pub return_data: Option<TransactionReturnData>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EncodedTransactionWithStatusMeta {
pub transaction: EncodedTransaction,
pub meta: Option<UiTransactionStatusMeta>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<TransactionVersion>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EncodedConfirmedTransactionWithStatusMeta {
pub slot: Slot,
#[serde(flatten)]
pub transaction: EncodedTransactionWithStatusMeta,
pub block_time: Option<UnixTimestamp>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransactionConfirmationStatus {
Processed,
Confirmed,
Finalized,
}
#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TransactionDetails {
Full,
Signatures,
None,
}
impl Default for TransactionDetails {
fn default() -> Self {
Self::Full
}
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EncodedConfirmedBlock {
pub previous_blockhash: String,
pub blockhash: String,
pub parent_slot: Slot,
pub transactions: Vec<EncodedTransactionWithStatusMeta>,
pub rewards: Rewards,
pub block_time: Option<UnixTimestamp>,
pub block_height: Option<u64>,
}
impl From<UiConfirmedBlock> for EncodedConfirmedBlock {
fn from(block: UiConfirmedBlock) -> Self {
Self {
previous_blockhash: block.previous_blockhash,
blockhash: block.blockhash,
parent_slot: block.parent_slot,
transactions: block.transactions.unwrap_or_default(),
rewards: block.rewards.unwrap_or_default(),
block_time: block.block_time,
block_height: block.block_height,
}
}
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UiConfirmedBlock {
pub previous_blockhash: String,
pub blockhash: String,
pub parent_slot: Slot,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transactions: Option<Vec<EncodedTransactionWithStatusMeta>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub signatures: Option<Vec<String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rewards: Option<Rewards>,
pub block_time: Option<UnixTimestamp>,
pub block_height: Option<u64>,
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/utils.rs
|
use std::time::Duration;
use fluvio_wasm_timer::Delay;
pub async fn sleep(ms: u64) {
Delay::new(Duration::from_millis(ms)).await.ok();
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/mod.rs
|
pub mod spl_associated_token_account;
pub mod spl_memo;
pub mod spl_token;
pub mod spl_token_2022;
pub mod vote;
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/vote_instruction.rs
|
//! Vote program instructions
use {
crate::program::vote::{
id,
vote_state::{Vote, VoteAuthorize, VoteInit, VoteState, VoteStateUpdate},
},
serde_derive::{Deserialize, Serialize},
solana_sdk::{
hash::Hash,
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
system_instruction, sysvar,
},
};
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub enum VoteInstruction {
/// Initialize a vote account
///
/// # Account references
/// 0. `[WRITE]` Uninitialized vote account
/// 1. `[]` Rent sysvar
/// 2. `[]` Clock sysvar
/// 3. `[SIGNER]` New validator identity (node_pubkey)
InitializeAccount(VoteInit),
/// Authorize a key to send votes or issue a withdrawal
///
/// # Account references
/// 0. `[WRITE]` Vote account to be updated with the Pubkey for authorization
/// 1. `[]` Clock sysvar
/// 2. `[SIGNER]` Vote or withdraw authority
Authorize(Pubkey, VoteAuthorize),
/// A Vote instruction with recent votes
///
/// # Account references
/// 0. `[WRITE]` Vote account to vote with
/// 1. `[]` Slot hashes sysvar
/// 2. `[]` Clock sysvar
/// 3. `[SIGNER]` Vote authority
Vote(Vote),
/// Withdraw some amount of funds
///
/// # Account references
/// 0. `[WRITE]` Vote account to withdraw from
/// 1. `[WRITE]` Recipient account
/// 2. `[SIGNER]` Withdraw authority
Withdraw(u64),
/// Update the vote account's validator identity (node_pubkey)
///
/// # Account references
/// 0. `[WRITE]` Vote account to be updated with the given authority public key
/// 1. `[SIGNER]` New validator identity (node_pubkey)
/// 2. `[SIGNER]` Withdraw authority
UpdateValidatorIdentity,
/// Update the commission for the vote account
///
/// # Account references
/// 0. `[WRITE]` Vote account to be updated
/// 1. `[SIGNER]` Withdraw authority
UpdateCommission(u8),
/// A Vote instruction with recent votes
///
/// # Account references
/// 0. `[WRITE]` Vote account to vote with
/// 1. `[]` Slot hashes sysvar
/// 2. `[]` Clock sysvar
/// 3. `[SIGNER]` Vote authority
VoteSwitch(Vote, Hash),
/// Authorize a key to send votes or issue a withdrawal
///
/// This instruction behaves like `Authorize` with the additional requirement that the new vote
/// or withdraw authority must also be a signer.
///
/// # Account references
/// 0. `[WRITE]` Vote account to be updated with the Pubkey for authorization
/// 1. `[]` Clock sysvar
/// 2. `[SIGNER]` Vote or withdraw authority
/// 3. `[SIGNER]` New vote or withdraw authority
AuthorizeChecked(VoteAuthorize),
/// Update the onchain vote state for the signer.
///
/// # Account references
/// 0. `[Write]` Vote account to vote with
/// 1. `[SIGNER]` Vote authority
UpdateVoteState(VoteStateUpdate),
/// Update the onchain vote state for the signer along with a switching proof.
///
/// # Account references
/// 0. `[Write]` Vote account to vote with
/// 1. `[SIGNER]` Vote authority
UpdateVoteStateSwitch(VoteStateUpdate, Hash),
}
fn initialize_account(vote_pubkey: &Pubkey, vote_init: &VoteInit) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(vote_init.node_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::InitializeAccount(*vote_init),
account_metas,
)
}
pub fn create_account(
from_pubkey: &Pubkey,
vote_pubkey: &Pubkey,
vote_init: &VoteInit,
lamports: u64,
) -> Vec<Instruction> {
let space = VoteState::size_of() as u64;
let create_ix =
system_instruction::create_account(from_pubkey, vote_pubkey, lamports, space, &id());
let init_ix = initialize_account(vote_pubkey, vote_init);
vec![create_ix, init_ix]
}
pub fn create_account_with_seed(
from_pubkey: &Pubkey,
vote_pubkey: &Pubkey,
base: &Pubkey,
seed: &str,
vote_init: &VoteInit,
lamports: u64,
) -> Vec<Instruction> {
let space = VoteState::size_of() as u64;
let create_ix = system_instruction::create_account_with_seed(
from_pubkey,
vote_pubkey,
base,
seed,
lamports,
space,
&id(),
);
let init_ix = initialize_account(vote_pubkey, vote_init);
vec![create_ix, init_ix]
}
pub fn authorize(
vote_pubkey: &Pubkey,
authorized_pubkey: &Pubkey, // currently authorized
new_authorized_pubkey: &Pubkey,
vote_authorize: VoteAuthorize,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(*authorized_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::Authorize(*new_authorized_pubkey, vote_authorize),
account_metas,
)
}
pub fn authorize_checked(
vote_pubkey: &Pubkey,
authorized_pubkey: &Pubkey, // currently authorized
new_authorized_pubkey: &Pubkey,
vote_authorize: VoteAuthorize,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(*authorized_pubkey, true),
AccountMeta::new_readonly(*new_authorized_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::AuthorizeChecked(vote_authorize),
account_metas,
)
}
pub fn update_validator_identity(
vote_pubkey: &Pubkey,
authorized_withdrawer_pubkey: &Pubkey,
node_pubkey: &Pubkey,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(*node_pubkey, true),
AccountMeta::new_readonly(*authorized_withdrawer_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::UpdateValidatorIdentity,
account_metas,
)
}
pub fn update_commission(
vote_pubkey: &Pubkey,
authorized_withdrawer_pubkey: &Pubkey,
commission: u8,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(*authorized_withdrawer_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::UpdateCommission(commission),
account_metas,
)
}
pub fn vote(vote_pubkey: &Pubkey, authorized_voter_pubkey: &Pubkey, vote: Vote) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(sysvar::slot_hashes::id(), false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(*authorized_voter_pubkey, true),
];
Instruction::new_with_bincode(id(), &VoteInstruction::Vote(vote), account_metas)
}
pub fn vote_switch(
vote_pubkey: &Pubkey,
authorized_voter_pubkey: &Pubkey,
vote: Vote,
proof_hash: Hash,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(sysvar::slot_hashes::id(), false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(*authorized_voter_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::VoteSwitch(vote, proof_hash),
account_metas,
)
}
pub fn update_vote_state(
vote_pubkey: &Pubkey,
authorized_voter_pubkey: &Pubkey,
vote_state_update: VoteStateUpdate,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(*authorized_voter_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::UpdateVoteState(vote_state_update),
account_metas,
)
}
pub fn update_vote_state_switch(
vote_pubkey: &Pubkey,
authorized_voter_pubkey: &Pubkey,
vote_state_update: VoteStateUpdate,
proof_hash: Hash,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new_readonly(*authorized_voter_pubkey, true),
];
Instruction::new_with_bincode(
id(),
&VoteInstruction::UpdateVoteStateSwitch(vote_state_update, proof_hash),
account_metas,
)
}
pub fn withdraw(
vote_pubkey: &Pubkey,
authorized_withdrawer_pubkey: &Pubkey,
lamports: u64,
to_pubkey: &Pubkey,
) -> Instruction {
let account_metas = vec![
AccountMeta::new(*vote_pubkey, false),
AccountMeta::new(*to_pubkey, false),
AccountMeta::new_readonly(*authorized_withdrawer_pubkey, true),
];
Instruction::new_with_bincode(id(), &VoteInstruction::Withdraw(lamports), account_metas)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/authorized_voters.rs
|
use {
serde_derive::{Deserialize, Serialize},
solana_sdk::{clock::Epoch, pubkey::Pubkey},
std::collections::BTreeMap,
};
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample)]
pub struct AuthorizedVoters {
authorized_voters: BTreeMap<Epoch, Pubkey>,
}
impl AuthorizedVoters {
pub fn new(epoch: Epoch, pubkey: Pubkey) -> Self {
let mut authorized_voters = BTreeMap::new();
authorized_voters.insert(epoch, pubkey);
Self { authorized_voters }
}
pub fn get_authorized_voter(&self, epoch: Epoch) -> Option<Pubkey> {
self.get_or_calculate_authorized_voter_for_epoch(epoch)
.map(|(pubkey, _)| pubkey)
}
pub fn get_and_cache_authorized_voter_for_epoch(&mut self, epoch: Epoch) -> Option<Pubkey> {
let res = self.get_or_calculate_authorized_voter_for_epoch(epoch);
res.map(|(pubkey, existed)| {
if !existed {
self.authorized_voters.insert(epoch, pubkey);
}
pubkey
})
}
pub fn insert(&mut self, epoch: Epoch, authorized_voter: Pubkey) {
self.authorized_voters.insert(epoch, authorized_voter);
}
pub fn purge_authorized_voters(&mut self, current_epoch: Epoch) -> bool {
// Iterate through the keys in order, filtering out the ones
// less than the current epoch
let expired_keys: Vec<_> = self
.authorized_voters
.range(0..current_epoch)
.map(|(authorized_epoch, _)| *authorized_epoch)
.collect();
for key in expired_keys {
self.authorized_voters.remove(&key);
}
// Have to uphold this invariant b/c this is
// 1) The check for whether the vote state is initialized
// 2) How future authorized voters for uninitialized epochs are set
// by this function
assert!(!self.authorized_voters.is_empty());
true
}
pub fn is_empty(&self) -> bool {
self.authorized_voters.is_empty()
}
pub fn first(&self) -> Option<(&u64, &Pubkey)> {
self.authorized_voters.iter().next()
}
pub fn last(&self) -> Option<(&u64, &Pubkey)> {
self.authorized_voters.iter().next_back()
}
pub fn len(&self) -> usize {
self.authorized_voters.len()
}
pub fn contains(&self, epoch: Epoch) -> bool {
self.authorized_voters.contains_key(&epoch)
}
pub fn iter(&self) -> std::collections::btree_map::Iter<Epoch, Pubkey> {
self.authorized_voters.iter()
}
// Returns the authorized voter at the given epoch if the epoch is >= the
// current epoch, and a bool indicating whether the entry for this epoch
// exists in the self.authorized_voter map
fn get_or_calculate_authorized_voter_for_epoch(&self, epoch: Epoch) -> Option<(Pubkey, bool)> {
let res = self.authorized_voters.get(&epoch);
if res.is_none() {
// If no authorized voter has been set yet for this epoch,
// this must mean the authorized voter remains unchanged
// from the latest epoch before this one
let res = self.authorized_voters.range(0..epoch).next_back();
if res.is_none() {
// TODO:
// warn!(
// "Tried to query for the authorized voter of an epoch earlier
// than the current epoch. Earlier epochs have been purged"
// );
}
res.map(|(_, pubkey)| (*pubkey, false))
} else {
res.map(|pubkey| (*pubkey, true))
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/mod.rs
|
pub mod authorized_voters;
pub mod vote_error;
pub mod vote_instruction;
pub mod vote_state;
pub use solana_sdk::vote::program::{check_id, id};
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/vote_error.rs
|
//! Vote program errors
use {
num_derive::{FromPrimitive, ToPrimitive},
solana_sdk::decode_error::DecodeError,
thiserror::Error,
};
/// Reasons the vote might have had an error
#[derive(Error, Debug, Clone, PartialEq, Eq, FromPrimitive, ToPrimitive)]
pub enum VoteError {
#[error("vote already recorded or not in slot hashes history")]
VoteTooOld,
#[error("vote slots do not match bank history")]
SlotsMismatch,
#[error("vote hash does not match bank hash")]
SlotHashMismatch,
#[error("vote has no slots, invalid")]
EmptySlots,
#[error("vote timestamp not recent")]
TimestampTooOld,
#[error("authorized voter has already been changed this epoch")]
TooSoonToReauthorize,
// TODO: figure out how to migrate these new errors
#[error("Old state had vote which should not have been popped off by vote in new state")]
LockoutConflict,
#[error("Proposed state had earlier slot which should have been popped off by later vote")]
NewVoteStateLockoutMismatch,
#[error("Vote slots are not ordered")]
SlotsNotOrdered,
#[error("Confirmations are not ordered")]
ConfirmationsNotOrdered,
#[error("Zero confirmations")]
ZeroConfirmations,
#[error("Confirmation exceeds limit")]
ConfirmationTooLarge,
#[error("Root rolled back")]
RootRollBack,
#[error("Confirmations for same vote were smaller in new proposed state")]
ConfirmationRollBack,
#[error("New state contained a vote slot smaller than the root")]
SlotSmallerThanRoot,
#[error("New state contained too many votes")]
TooManyVotes,
#[error("every slot in the vote was older than the SlotHashes history")]
VotesTooOldAllFiltered,
#[error("Proposed root is not in slot hashes")]
RootOnDifferentFork,
}
impl<E> DecodeError<E> for VoteError {
fn type_of() -> &'static str {
"VoteError"
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/vote_state/vote_state_versions.rs
|
use {super::*, crate::program::vote::vote_state::vote_state_0_23_5::VoteState0_23_5};
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub enum VoteStateVersions {
V0_23_5(Box<VoteState0_23_5>),
Current(Box<VoteState>),
}
impl VoteStateVersions {
pub fn new_current(vote_state: VoteState) -> Self {
Self::Current(Box::new(vote_state))
}
pub fn convert_to_current(self) -> VoteState {
match self {
VoteStateVersions::V0_23_5(state) => {
let authorized_voters =
AuthorizedVoters::new(state.authorized_voter_epoch, state.authorized_voter);
VoteState {
node_pubkey: state.node_pubkey,
// the signer for withdrawals
authorized_withdrawer: state.authorized_withdrawer,
// percentage (0-100) that represents what part of a rewards
// payout should be given to this VoteAccount
commission: state.commission,
votes: state.votes.clone(),
root_slot: state.root_slot,
// the signer for vote transactions
authorized_voters,
// history of prior authorized voters and the epochs for which
// they were set, the bottom end of the range is inclusive,
// the top of the range is exclusive
prior_voters: CircBuf::default(),
// history of how many credits earned by the end of each epoch
// each tuple is (Epoch, credits, prev_credits)
epoch_credits: state.epoch_credits.clone(),
// most recent timestamp submitted with a vote
last_timestamp: state.last_timestamp.clone(),
}
}
VoteStateVersions::Current(state) => *state,
}
}
pub fn is_uninitialized(&self) -> bool {
match self {
VoteStateVersions::V0_23_5(vote_state) => {
vote_state.authorized_voter == Pubkey::default()
}
VoteStateVersions::Current(vote_state) => vote_state.authorized_voters.is_empty(),
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/vote_state/mod.rs
|
use {
crate::program::vote::{authorized_voters::AuthorizedVoters, id, vote_error::VoteError},
bincode::{deserialize, serialize_into, ErrorKind},
serde_derive::{Deserialize, Serialize},
solana_sdk::{
account::{AccountSharedData, ReadableAccount, WritableAccount},
clock::{Epoch, Slot, UnixTimestamp},
feature_set::{self, filter_votes_outside_slot_hashes, FeatureSet},
hash::Hash,
instruction::InstructionError,
pubkey::Pubkey,
rent::Rent,
slot_hashes::SlotHash,
sysvar::clock::Clock,
transaction_context::{BorrowedAccount, InstructionContext, TransactionContext},
},
std::{
cmp::Ordering,
collections::{HashSet, VecDeque},
fmt::Debug,
},
};
mod vote_state_0_23_5;
pub mod vote_state_versions;
pub use vote_state_versions::*;
// Maximum number of votes to keep around, tightly coupled with epoch_schedule::MINIMUM_SLOTS_PER_EPOCH
pub const MAX_LOCKOUT_HISTORY: usize = 31;
pub const INITIAL_LOCKOUT: usize = 2;
// Maximum number of credits history to keep around
pub const MAX_EPOCH_CREDITS_HISTORY: usize = 64;
// Offset of VoteState::prior_voters, for determining initialization status without deserialization
const DEFAULT_PRIOR_VOTERS_OFFSET: usize = 82;
#[frozen_abi(digest = "6LBwH5w3WyAWZhsM3KTG9QZP7nYBhcC61K33kHR6gMAD")]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize, AbiEnumVisitor, AbiExample)]
pub enum VoteTransaction {
Vote(Vote),
VoteStateUpdate(VoteStateUpdate),
}
impl VoteTransaction {
pub fn slots(&self) -> Vec<Slot> {
match self {
VoteTransaction::Vote(vote) => vote.slots.clone(),
VoteTransaction::VoteStateUpdate(vote_state_update) => vote_state_update.slots(),
}
}
pub fn slot(&self, i: usize) -> Slot {
match self {
VoteTransaction::Vote(vote) => vote.slots[i],
VoteTransaction::VoteStateUpdate(vote_state_update) => {
vote_state_update.lockouts[i].slot
}
}
}
pub fn len(&self) -> usize {
match self {
VoteTransaction::Vote(vote) => vote.slots.len(),
VoteTransaction::VoteStateUpdate(vote_state_update) => vote_state_update.lockouts.len(),
}
}
pub fn is_empty(&self) -> bool {
match self {
VoteTransaction::Vote(vote) => vote.slots.is_empty(),
VoteTransaction::VoteStateUpdate(vote_state_update) => {
vote_state_update.lockouts.is_empty()
}
}
}
pub fn hash(&self) -> Hash {
match self {
VoteTransaction::Vote(vote) => vote.hash,
VoteTransaction::VoteStateUpdate(vote_state_update) => vote_state_update.hash,
}
}
pub fn timestamp(&self) -> Option<UnixTimestamp> {
match self {
VoteTransaction::Vote(vote) => vote.timestamp,
VoteTransaction::VoteStateUpdate(vote_state_update) => vote_state_update.timestamp,
}
}
pub fn set_timestamp(&mut self, ts: Option<UnixTimestamp>) {
match self {
VoteTransaction::Vote(vote) => vote.timestamp = ts,
VoteTransaction::VoteStateUpdate(vote_state_update) => vote_state_update.timestamp = ts,
}
}
pub fn last_voted_slot(&self) -> Option<Slot> {
match self {
VoteTransaction::Vote(vote) => vote.slots.last().copied(),
VoteTransaction::VoteStateUpdate(vote_state_update) => {
Some(vote_state_update.lockouts.back()?.slot)
}
}
}
pub fn last_voted_slot_hash(&self) -> Option<(Slot, Hash)> {
Some((self.last_voted_slot()?, self.hash()))
}
}
impl From<Vote> for VoteTransaction {
fn from(vote: Vote) -> Self {
VoteTransaction::Vote(vote)
}
}
impl From<VoteStateUpdate> for VoteTransaction {
fn from(vote_state_update: VoteStateUpdate) -> Self {
VoteTransaction::VoteStateUpdate(vote_state_update)
}
}
#[frozen_abi(digest = "Ch2vVEwos2EjAVqSHCyJjnN2MNX1yrpapZTGhMSCjWUH")]
#[derive(Serialize, Default, Deserialize, Debug, PartialEq, Eq, Clone, AbiExample)]
pub struct Vote {
/// A stack of votes starting with the oldest vote
pub slots: Vec<Slot>,
/// signature of the bank's state at the last slot
pub hash: Hash,
/// processing timestamp of last slot
pub timestamp: Option<UnixTimestamp>,
}
impl Vote {
pub fn new(slots: Vec<Slot>, hash: Hash) -> Self {
Self {
slots,
hash,
timestamp: None,
}
}
}
#[derive(Serialize, Default, Deserialize, Debug, PartialEq, Eq, Copy, Clone, AbiExample)]
pub struct Lockout {
pub slot: Slot,
pub confirmation_count: u32,
}
impl Lockout {
pub fn new(slot: Slot) -> Self {
Self {
slot,
confirmation_count: 1,
}
}
// The number of slots for which this vote is locked
pub fn lockout(&self) -> u64 {
(INITIAL_LOCKOUT as u64).pow(self.confirmation_count)
}
// The last slot at which a vote is still locked out. Validators should not
// vote on a slot in another fork which is less than or equal to this slot
// to avoid having their stake slashed.
pub fn last_locked_out_slot(&self) -> Slot {
self.slot + self.lockout()
}
pub fn is_locked_out_at_slot(&self, slot: Slot) -> bool {
self.last_locked_out_slot() >= slot
}
}
#[frozen_abi(digest = "BctadFJjUKbvPJzr6TszbX6rBfQUNSRKpKKngkzgXgeY")]
#[derive(Serialize, Default, Deserialize, Debug, PartialEq, Eq, Clone, AbiExample)]
pub struct VoteStateUpdate {
/// The proposed tower
pub lockouts: VecDeque<Lockout>,
/// The proposed root
pub root: Option<Slot>,
/// signature of the bank's state at the last slot
pub hash: Hash,
/// processing timestamp of last slot
pub timestamp: Option<UnixTimestamp>,
}
impl From<Vec<(Slot, u32)>> for VoteStateUpdate {
fn from(recent_slots: Vec<(Slot, u32)>) -> Self {
let lockouts: VecDeque<Lockout> = recent_slots
.into_iter()
.map(|(slot, confirmation_count)| Lockout {
slot,
confirmation_count,
})
.collect();
Self {
lockouts,
root: None,
hash: Hash::default(),
timestamp: None,
}
}
}
impl VoteStateUpdate {
pub fn new(lockouts: VecDeque<Lockout>, root: Option<Slot>, hash: Hash) -> Self {
Self {
lockouts,
root,
hash,
timestamp: None,
}
}
pub fn slots(&self) -> Vec<Slot> {
self.lockouts.iter().map(|lockout| lockout.slot).collect()
}
}
#[derive(Default, Serialize, Deserialize, Debug, PartialEq, Eq, Clone, Copy)]
pub struct VoteInit {
pub node_pubkey: Pubkey,
pub authorized_voter: Pubkey,
pub authorized_withdrawer: Pubkey,
pub commission: u8,
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone, Copy)]
pub enum VoteAuthorize {
Voter,
Withdrawer,
}
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample)]
pub struct BlockTimestamp {
pub slot: Slot,
pub timestamp: UnixTimestamp,
}
// this is how many epochs a voter can be remembered for slashing
const MAX_ITEMS: usize = 32;
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample)]
pub struct CircBuf<I> {
buf: [I; MAX_ITEMS],
/// next pointer
idx: usize,
is_empty: bool,
}
impl<I: Default + Copy> Default for CircBuf<I> {
fn default() -> Self {
Self {
buf: [I::default(); MAX_ITEMS],
idx: MAX_ITEMS - 1,
is_empty: true,
}
}
}
impl<I> CircBuf<I> {
pub fn append(&mut self, item: I) {
// remember prior delegate and when we switched, to support later slashing
self.idx += 1;
self.idx %= MAX_ITEMS;
self.buf[self.idx] = item;
self.is_empty = false;
}
pub fn buf(&self) -> &[I; MAX_ITEMS] {
&self.buf
}
pub fn last(&self) -> Option<&I> {
if !self.is_empty {
Some(&self.buf[self.idx])
} else {
None
}
}
}
#[frozen_abi(digest = "331ZmXrmsUcwbKhzR3C1UEU6uNwZr48ExE54JDKGWA4w")]
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample)]
pub struct VoteState {
/// the node that votes in this account
pub node_pubkey: Pubkey,
/// the signer for withdrawals
pub authorized_withdrawer: Pubkey,
/// percentage (0-100) that represents what part of a rewards
/// payout should be given to this VoteAccount
pub commission: u8,
pub votes: VecDeque<Lockout>,
// This usually the last Lockout which was popped from self.votes.
// However, it can be arbitrary slot, when being used inside Tower
pub root_slot: Option<Slot>,
/// the signer for vote transactions
authorized_voters: AuthorizedVoters,
/// history of prior authorized voters and the epochs for which
/// they were set, the bottom end of the range is inclusive,
/// the top of the range is exclusive
prior_voters: CircBuf<(Pubkey, Epoch, Epoch)>,
/// history of how many credits earned by the end of each epoch
/// each tuple is (Epoch, credits, prev_credits)
pub epoch_credits: Vec<(Epoch, u64, u64)>,
/// most recent timestamp submitted with a vote
pub last_timestamp: BlockTimestamp,
}
impl VoteState {
pub fn new(vote_init: &VoteInit, clock: &Clock) -> Self {
Self {
node_pubkey: vote_init.node_pubkey,
authorized_voters: AuthorizedVoters::new(clock.epoch, vote_init.authorized_voter),
authorized_withdrawer: vote_init.authorized_withdrawer,
commission: vote_init.commission,
..VoteState::default()
}
}
pub fn get_authorized_voter(&self, epoch: Epoch) -> Option<Pubkey> {
self.authorized_voters.get_authorized_voter(epoch)
}
pub fn authorized_voters(&self) -> &AuthorizedVoters {
&self.authorized_voters
}
pub fn prior_voters(&mut self) -> &CircBuf<(Pubkey, Epoch, Epoch)> {
&self.prior_voters
}
pub fn get_rent_exempt_reserve(rent: &Rent) -> u64 {
rent.minimum_balance(VoteState::size_of())
}
/// Upper limit on the size of the Vote State
/// when votes.len() is MAX_LOCKOUT_HISTORY.
pub const fn size_of() -> usize {
3731 // see test_vote_state_size_of.
}
// utility function, used by Stakes, tests
pub fn from<T: ReadableAccount>(account: &T) -> Option<VoteState> {
Self::deserialize(account.data()).ok()
}
// utility function, used by Stakes, tests
pub fn to<T: WritableAccount>(versioned: &VoteStateVersions, account: &mut T) -> Option<()> {
Self::serialize(versioned, account.data_as_mut_slice()).ok()
}
pub fn deserialize(input: &[u8]) -> Result<Self, InstructionError> {
deserialize::<VoteStateVersions>(input)
.map(|versioned| versioned.convert_to_current())
.map_err(|_| InstructionError::InvalidAccountData)
}
pub fn serialize(
versioned: &VoteStateVersions,
output: &mut [u8],
) -> Result<(), InstructionError> {
serialize_into(output, versioned).map_err(|err| match *err {
ErrorKind::SizeLimit => InstructionError::AccountDataTooSmall,
_ => InstructionError::GenericError,
})
}
pub fn credits_from<T: ReadableAccount>(account: &T) -> Option<u64> {
Self::from(account).map(|state| state.credits())
}
/// returns commission split as (voter_portion, staker_portion, was_split) tuple
///
/// if commission calculation is 100% one way or other,
/// indicate with false for was_split
pub fn commission_split(&self, on: u64) -> (u64, u64, bool) {
match self.commission.min(100) {
0 => (0, on, false),
100 => (on, 0, false),
split => {
let on = u128::from(on);
// Calculate mine and theirs independently and symmetrically instead of
// using the remainder of the other to treat them strictly equally.
// This is also to cancel the rewarding if either of the parties
// should receive only fractional lamports, resulting in not being rewarded at all.
// Thus, note that we intentionally discard any residual fractional lamports.
let mine = on * u128::from(split) / 100u128;
let theirs = on * u128::from(100 - split) / 100u128;
(mine as u64, theirs as u64, true)
}
}
}
/// Returns if the vote state contains a slot `candidate_slot`
pub fn contains_slot(&self, candidate_slot: Slot) -> bool {
self.votes
.binary_search_by(|lockout| lockout.slot.cmp(&candidate_slot))
.is_ok()
}
fn check_update_vote_state_slots_are_valid(
&self,
vote_state_update: &mut VoteStateUpdate,
slot_hashes: &[(Slot, Hash)],
) -> Result<(), VoteError> {
if vote_state_update.lockouts.is_empty() {
return Err(VoteError::EmptySlots);
}
// If the vote state update is not new enough, return
if let Some(last_vote_slot) = self.votes.back().map(|lockout| lockout.slot) {
if vote_state_update.lockouts.back().unwrap().slot <= last_vote_slot {
return Err(VoteError::VoteTooOld);
}
}
let last_vote_state_update_slot = vote_state_update
.lockouts
.back()
.expect("must be nonempty, checked above")
.slot;
if slot_hashes.is_empty() {
return Err(VoteError::SlotsMismatch);
}
let earliest_slot_hash_in_history = slot_hashes.last().unwrap().0;
// Check if the proposed vote is too old to be in the SlotHash history
if last_vote_state_update_slot < earliest_slot_hash_in_history {
// If this is the last slot in the vote update, it must be in SlotHashes,
// otherwise we have no way of confirming if the hash matches
return Err(VoteError::VoteTooOld);
}
// Check if the proposed root is too old
if let Some(new_proposed_root) = vote_state_update.root {
// If the root is less than the earliest slot hash in the history such that we
// cannot verify whether the slot was actually was on this fork, set the root
// to the current vote state root for safety.
if earliest_slot_hash_in_history > new_proposed_root {
vote_state_update.root = self.root_slot;
}
}
// index into the new proposed vote state's slots, starting with the root if it exists then
// we use this mutable root to fold the root slot case into this loop for performance
let mut check_root = vote_state_update.root;
let mut vote_state_update_index = 0;
// index into the slot_hashes, starting at the oldest known
// slot hash
let mut slot_hashes_index = slot_hashes.len();
let mut vote_state_update_indexes_to_filter = vec![];
// Note:
//
// 1) `vote_state_update.lockouts` is sorted from oldest/smallest vote to newest/largest
// vote, due to the way votes are applied to the vote state (newest votes
// pushed to the back).
//
// 2) Conversely, `slot_hashes` is sorted from newest/largest vote to
// the oldest/smallest vote
//
// Unlike for vote updates, vote state updates here can't only check votes older than the last vote
// because have to ensure that every slot is actually part of the history, not just the most
// recent ones
while vote_state_update_index < vote_state_update.lockouts.len() && slot_hashes_index > 0 {
let proposed_vote_slot = if let Some(root) = check_root {
root
} else {
vote_state_update.lockouts[vote_state_update_index].slot
};
if check_root.is_none()
&& vote_state_update_index > 0
&& proposed_vote_slot
<= vote_state_update.lockouts[vote_state_update_index - 1].slot
{
return Err(VoteError::SlotsNotOrdered);
}
let ancestor_slot = slot_hashes[slot_hashes_index - 1].0;
// Find if this slot in the proposed vote state exists in the SlotHashes history
// to confirm if it was a valid ancestor on this fork
match proposed_vote_slot.cmp(&ancestor_slot) {
Ordering::Less => {
if slot_hashes_index == slot_hashes.len() {
// The vote slot does not exist in the SlotHashes history because it's too old,
// i.e. older than the oldest slot in the history.
assert!(proposed_vote_slot < earliest_slot_hash_in_history);
if !self.contains_slot(proposed_vote_slot) && check_root.is_none() {
// If the vote slot is both:
// 1) Too old
// 2) Doesn't already exist in vote state
//
// Then filter it out
vote_state_update_indexes_to_filter.push(vote_state_update_index);
}
if check_root.is_some() {
// If the vote state update has a root < earliest_slot_hash_in_history
// then we use the current root. The only case where this can happen
// is if the current root itself is not in slot hashes.
assert!(self.root_slot.unwrap() < earliest_slot_hash_in_history);
check_root = None;
} else {
vote_state_update_index += 1;
}
continue;
} else {
// If the vote slot is new enough to be in the slot history,
// but is not part of the slot history, then it must belong to another fork,
// which means this vote state update is invalid.
if check_root.is_some() {
return Err(VoteError::RootOnDifferentFork);
} else {
return Err(VoteError::SlotsMismatch);
}
}
}
Ordering::Greater => {
// Decrement `slot_hashes_index` to find newer slots in the SlotHashes history
slot_hashes_index -= 1;
continue;
}
Ordering::Equal => {
// Once the slot in `vote_state_update.lockouts` is found, bump to the next slot
// in `vote_state_update.lockouts` and continue. If we were checking the root,
// start checking the vote state instead.
if check_root.is_some() {
check_root = None;
} else {
vote_state_update_index += 1;
slot_hashes_index -= 1;
}
}
}
}
if vote_state_update_index != vote_state_update.lockouts.len() {
// The last vote slot in the update did not exist in SlotHashes
return Err(VoteError::SlotsMismatch);
}
// This assertion must be true at this point because we can assume by now:
// 1) vote_state_update_index == vote_state_update.lockouts.len()
// 2) last_vote_state_update_slot >= earliest_slot_hash_in_history
// 3) !vote_state_update.lockouts.is_empty()
//
// 1) implies that during the last iteration of the loop above,
// `vote_state_update_index` was equal to `vote_state_update.lockouts.len() - 1`,
// and was then incremented to `vote_state_update.lockouts.len()`.
// This means in that last loop iteration,
// `proposed_vote_slot ==
// vote_state_update.lockouts[vote_state_update.lockouts.len() - 1] ==
// last_vote_state_update_slot`.
//
// Then we know the last comparison `match proposed_vote_slot.cmp(&ancestor_slot)`
// is equivalent to `match last_vote_state_update_slot.cmp(&ancestor_slot)`. The result
// of this match to increment `vote_state_update_index` must have been either:
//
// 1) The Equal case ran, in which case then we know this assertion must be true
// 2) The Less case ran, and more specifically the case
// `proposed_vote_slot < earliest_slot_hash_in_history` ran, which is equivalent to
// `last_vote_state_update_slot < earliest_slot_hash_in_history`, but this is impossible
// due to assumption 3) above.
assert_eq!(
last_vote_state_update_slot,
slot_hashes[slot_hashes_index].0
);
if slot_hashes[slot_hashes_index].1 != vote_state_update.hash {
// This means the newest vote in the slot has a match that
// doesn't match the expected hash for that slot on this
// fork
// TODO:
// warn!(
// "{} dropped vote {:?} failed to match hash {} {}",
// self.node_pubkey,
// vote_state_update,
// vote_state_update.hash,
// slot_hashes[slot_hashes_index].1
// );
// inc_new_counter_info!("dropped-vote-hash", 1);
return Err(VoteError::SlotHashMismatch);
}
// Filter out the irrelevant votes
let mut vote_state_update_index = 0;
let mut filter_votes_index = 0;
vote_state_update.lockouts.retain(|_lockout| {
let should_retain = if filter_votes_index == vote_state_update_indexes_to_filter.len() {
true
} else if vote_state_update_index
== vote_state_update_indexes_to_filter[filter_votes_index]
{
filter_votes_index += 1;
false
} else {
true
};
vote_state_update_index += 1;
should_retain
});
Ok(())
}
fn check_slots_are_valid(
&self,
vote_slots: &[Slot],
vote_hash: &Hash,
slot_hashes: &[(Slot, Hash)],
) -> Result<(), VoteError> {
// index into the vote's slots, starting at the oldest
// slot
let mut i = 0;
// index into the slot_hashes, starting at the oldest known
// slot hash
let mut j = slot_hashes.len();
// Note:
//
// 1) `vote_slots` is sorted from oldest/smallest vote to newest/largest
// vote, due to the way votes are applied to the vote state (newest votes
// pushed to the back).
//
// 2) Conversely, `slot_hashes` is sorted from newest/largest vote to
// the oldest/smallest vote
while i < vote_slots.len() && j > 0 {
// 1) increment `i` to find the smallest slot `s` in `vote_slots`
// where `s` >= `last_voted_slot`
if self
.last_voted_slot()
.map_or(false, |last_voted_slot| vote_slots[i] <= last_voted_slot)
{
i += 1;
continue;
}
// 2) Find the hash for this slot `s`.
if vote_slots[i] != slot_hashes[j - 1].0 {
// Decrement `j` to find newer slots
j -= 1;
continue;
}
// 3) Once the hash for `s` is found, bump `s` to the next slot
// in `vote_slots` and continue.
i += 1;
j -= 1;
}
if j == slot_hashes.len() {
// This means we never made it to steps 2) or 3) above, otherwise
// `j` would have been decremented at least once. This means
// there are not slots in `vote_slots` greater than `last_voted_slot`
// TODO:
// debug!(
// "{} dropped vote slots {:?}, vote hash: {:?} slot hashes:SlotHash {:?}, too old ",
// self.node_pubkey, vote_slots, vote_hash, slot_hashes
// );
return Err(VoteError::VoteTooOld);
}
if i != vote_slots.len() {
// This means there existed some slot for which we couldn't find
// a matching slot hash in step 2)
// TODO:
// info!(
// "{} dropped vote slots {:?} failed to match slot hashes: {:?}",
// self.node_pubkey, vote_slots, slot_hashes,
// );
// inc_new_counter_info!("dropped-vote-slot", 1);
return Err(VoteError::SlotsMismatch);
}
if &slot_hashes[j].1 != vote_hash {
// This means the newest slot in the `vote_slots` has a match that
// doesn't match the expected hash for that slot on this
// fork
// TODO:
// warn!(
// "{} dropped vote slots {:?} failed to match hash {} {}",
// self.node_pubkey, vote_slots, vote_hash, slot_hashes[j].1
// );
// inc_new_counter_info!("dropped-vote-hash", 1);
return Err(VoteError::SlotHashMismatch);
}
Ok(())
}
//`Ensure check_update_vote_state_slots_are_valid()` runs on the slots in `new_state`
// before `process_new_vote_state()` is called
// This function should guarantee the following about `new_state`:
//
// 1) It's well ordered, i.e. the slots are sorted from smallest to largest,
// and the confirmations sorted from largest to smallest.
// 2) Confirmations `c` on any vote slot satisfy `0 < c <= MAX_LOCKOUT_HISTORY`
// 3) Lockouts are not expired by consecutive votes, i.e. for every consecutive
// `v_i`, `v_{i + 1}` satisfy `v_i.last_locked_out_slot() >= v_{i + 1}`.
// We also guarantee that compared to the current vote state, `new_state`
// introduces no rollback. This means:
//
// 1) The last slot in `new_state` is always greater than any slot in the
// current vote state.
//
// 2) From 1), this means that for every vote `s` in the current state:
// a) If there exists an `s'` in `new_state` where `s.slot == s'.slot`, then
// we must guarantee `s.confirmations <= s'.confirmations`
//
// b) If there does not exist any such `s'` in `new_state`, then there exists
// some `t` that is the smallest vote in `new_state` where `t.slot > s.slot`.
// `t` must have expired/popped off s', so it must be guaranteed that
// `s.last_locked_out_slot() < t`.
// Note these two above checks do not guarantee that the vote state being submitted
// is a vote state that could have been created by iteratively building a tower
// by processing one vote at a time. For instance, the tower:
//
// { slot 0, confirmations: 31 }
// { slot 1, confirmations: 30 }
//
// is a legal tower that could be submitted on top of a previously empty tower. However,
// there is no way to create this tower from the iterative process, because slot 1 would
// have to have at least one other slot on top of it, even if the first 30 votes were all
// popped off.
pub fn process_new_vote_state(
&mut self,
new_state: VecDeque<Lockout>,
new_root: Option<Slot>,
timestamp: Option<i64>,
epoch: Epoch,
feature_set: Option<&FeatureSet>,
) -> Result<(), VoteError> {
assert!(!new_state.is_empty());
if new_state.len() > MAX_LOCKOUT_HISTORY {
return Err(VoteError::TooManyVotes);
}
match (new_root, self.root_slot) {
(Some(new_root), Some(current_root)) => {
if new_root < current_root {
return Err(VoteError::RootRollBack);
}
}
(None, Some(_)) => {
return Err(VoteError::RootRollBack);
}
_ => (),
}
let mut previous_vote: Option<&Lockout> = None;
// Check that all the votes in the new proposed state are:
// 1) Strictly sorted from oldest to newest vote
// 2) The confirmations are strictly decreasing
// 3) Not zero confirmation votes
for vote in &new_state {
if vote.confirmation_count == 0 {
return Err(VoteError::ZeroConfirmations);
} else if vote.confirmation_count > MAX_LOCKOUT_HISTORY as u32 {
return Err(VoteError::ConfirmationTooLarge);
} else if let Some(new_root) = new_root {
if vote.slot <= new_root
&&
// This check is necessary because
// https://github.com/ryoqun/solana/blob/df55bfb46af039cbc597cd60042d49b9d90b5961/core/src/consensus.rs#L120
// always sets a root for even empty towers, which is then hard unwrapped here
// https://github.com/ryoqun/solana/blob/df55bfb46af039cbc597cd60042d49b9d90b5961/core/src/consensus.rs#L776
new_root != Slot::default()
{
return Err(VoteError::SlotSmallerThanRoot);
}
}
if let Some(previous_vote) = previous_vote {
if previous_vote.slot >= vote.slot {
return Err(VoteError::SlotsNotOrdered);
} else if previous_vote.confirmation_count <= vote.confirmation_count {
return Err(VoteError::ConfirmationsNotOrdered);
} else if vote.slot > previous_vote.last_locked_out_slot() {
return Err(VoteError::NewVoteStateLockoutMismatch);
}
}
previous_vote = Some(vote);
}
// Find the first vote in the current vote state for a slot greater
// than the new proposed root
let mut current_vote_state_index = 0;
let mut new_vote_state_index = 0;
// Count the number of slots at and before the new root within the current vote state lockouts. Start with 1
// for the new root. The purpose of this is to know how many slots were rooted by this state update:
// - The new root was rooted
// - As were any slots that were in the current state but are not in the new state. The only slots which
// can be in this set are those oldest slots in the current vote state that are not present in the
// new vote state; these have been "popped off the back" of the tower and thus represent finalized slots
let mut finalized_slot_count = 1_u64;
for current_vote in &self.votes {
// Find the first vote in the current vote state for a slot greater
// than the new proposed root
if let Some(new_root) = new_root {
if current_vote.slot <= new_root {
current_vote_state_index += 1;
if current_vote.slot != new_root {
finalized_slot_count += 1;
}
continue;
}
}
break;
}
// All the votes in our current vote state that are missing from the new vote state
// must have been expired by later votes. Check that the lockouts match this assumption.
while current_vote_state_index < self.votes.len() && new_vote_state_index < new_state.len()
{
let current_vote = &self.votes[current_vote_state_index];
let new_vote = &new_state[new_vote_state_index];
// If the current slot is less than the new proposed slot, then the
// new slot must have popped off the old slot, so check that the
// lockouts are corrects.
match current_vote.slot.cmp(&new_vote.slot) {
Ordering::Less => {
if current_vote.last_locked_out_slot() >= new_vote.slot {
return Err(VoteError::LockoutConflict);
}
current_vote_state_index += 1;
}
Ordering::Equal => {
// The new vote state should never have less lockout than
// the previous vote state for the same slot
if new_vote.confirmation_count < current_vote.confirmation_count {
return Err(VoteError::ConfirmationRollBack);
}
current_vote_state_index += 1;
new_vote_state_index += 1;
}
Ordering::Greater => {
new_vote_state_index += 1;
}
}
}
// `new_vote_state` passed all the checks, finalize the change by rewriting
// our state.
if self.root_slot != new_root {
// Award vote credits based on the number of slots that were voted on and have reached finality
if feature_set
.map(|feature_set| {
feature_set.is_active(&feature_set::vote_state_update_credit_per_dequeue::id())
})
.unwrap_or(false)
{
// For each finalized slot, there was one voted-on slot in the new vote state that was responsible for
// finalizing it. Each of those votes is awarded 1 credit.
self.increment_credits(epoch, finalized_slot_count);
} else {
self.increment_credits(epoch, 1);
}
}
if let Some(timestamp) = timestamp {
let last_slot = new_state.back().unwrap().slot;
self.process_timestamp(last_slot, timestamp)?;
}
self.root_slot = new_root;
self.votes = new_state;
Ok(())
}
pub fn process_vote(
&mut self,
vote: &Vote,
slot_hashes: &[SlotHash],
epoch: Epoch,
feature_set: Option<&FeatureSet>,
) -> Result<(), VoteError> {
if vote.slots.is_empty() {
return Err(VoteError::EmptySlots);
}
let filtered_vote_slots = feature_set.and_then(|feature_set| {
if feature_set.is_active(&filter_votes_outside_slot_hashes::id()) {
let earliest_slot_in_history =
slot_hashes.last().map(|(slot, _hash)| *slot).unwrap_or(0);
Some(
vote.slots
.iter()
.filter(|slot| **slot >= earliest_slot_in_history)
.cloned()
.collect::<Vec<Slot>>(),
)
} else {
None
}
});
let vote_slots = filtered_vote_slots.as_ref().unwrap_or(&vote.slots);
if vote_slots.is_empty() {
return Err(VoteError::VotesTooOldAllFiltered);
}
self.check_slots_are_valid(vote_slots, &vote.hash, slot_hashes)?;
vote_slots
.iter()
.for_each(|s| self.process_next_vote_slot(*s, epoch));
Ok(())
}
pub fn process_next_vote_slot(&mut self, next_vote_slot: Slot, epoch: Epoch) {
// Ignore votes for slots earlier than we already have votes for
if self
.last_voted_slot()
.map_or(false, |last_voted_slot| next_vote_slot <= last_voted_slot)
{
return;
}
let vote = Lockout::new(next_vote_slot);
self.pop_expired_votes(next_vote_slot);
// Once the stack is full, pop the oldest lockout and distribute rewards
if self.votes.len() == MAX_LOCKOUT_HISTORY {
let vote = self.votes.pop_front().unwrap();
self.root_slot = Some(vote.slot);
self.increment_credits(epoch, 1);
}
self.votes.push_back(vote);
self.double_lockouts();
}
/// increment credits, record credits for last epoch if new epoch
pub fn increment_credits(&mut self, epoch: Epoch, credits: u64) {
// increment credits, record by epoch
// never seen a credit
if self.epoch_credits.is_empty() {
self.epoch_credits.push((epoch, 0, 0));
} else if epoch != self.epoch_credits.last().unwrap().0 {
let (_, credits, prev_credits) = *self.epoch_credits.last().unwrap();
if credits != prev_credits {
// if credits were earned previous epoch
// append entry at end of list for the new epoch
self.epoch_credits.push((epoch, credits, credits));
} else {
// else just move the current epoch
self.epoch_credits.last_mut().unwrap().0 = epoch;
}
// Remove too old epoch_credits
if self.epoch_credits.len() > MAX_EPOCH_CREDITS_HISTORY {
self.epoch_credits.remove(0);
}
}
self.epoch_credits.last_mut().unwrap().1 += credits;
}
/// "unchecked" functions used by tests and Tower
pub fn process_vote_unchecked(&mut self, vote: Vote) {
let slot_hashes: Vec<_> = vote.slots.iter().rev().map(|x| (*x, vote.hash)).collect();
let _ignored = self.process_vote(&vote, &slot_hashes, self.current_epoch(), None);
}
#[cfg(test)]
pub fn process_slot_votes_unchecked(&mut self, slots: &[Slot]) {
for slot in slots {
self.process_slot_vote_unchecked(*slot);
}
}
pub fn process_slot_vote_unchecked(&mut self, slot: Slot) {
self.process_vote_unchecked(Vote::new(vec![slot], Hash::default()));
}
pub fn nth_recent_vote(&self, position: usize) -> Option<&Lockout> {
if position < self.votes.len() {
let pos = self.votes.len() - 1 - position;
self.votes.get(pos)
} else {
None
}
}
pub fn last_lockout(&self) -> Option<&Lockout> {
self.votes.back()
}
pub fn last_voted_slot(&self) -> Option<Slot> {
self.last_lockout().map(|v| v.slot)
}
// Upto MAX_LOCKOUT_HISTORY many recent unexpired
// vote slots pushed onto the stack.
pub fn tower(&self) -> Vec<Slot> {
self.votes.iter().map(|v| v.slot).collect()
}
pub fn current_epoch(&self) -> Epoch {
if self.epoch_credits.is_empty() {
0
} else {
self.epoch_credits.last().unwrap().0
}
}
/// Number of "credits" owed to this account from the mining pool. Submit this
/// VoteState to the Rewards program to trade credits for lamports.
pub fn credits(&self) -> u64 {
if self.epoch_credits.is_empty() {
0
} else {
self.epoch_credits.last().unwrap().1
}
}
/// Number of "credits" owed to this account from the mining pool on a per-epoch basis,
/// starting from credits observed.
/// Each tuple of (Epoch, u64, u64) is read as (epoch, credits, prev_credits), where
/// credits for each epoch is credits - prev_credits; while redundant this makes
/// calculating rewards over partial epochs nice and simple
pub fn epoch_credits(&self) -> &Vec<(Epoch, u64, u64)> {
&self.epoch_credits
}
fn set_new_authorized_voter<F>(
&mut self,
authorized_pubkey: &Pubkey,
current_epoch: Epoch,
target_epoch: Epoch,
verify: F,
) -> Result<(), InstructionError>
where
F: Fn(Pubkey) -> Result<(), InstructionError>,
{
let epoch_authorized_voter = self.get_and_update_authorized_voter(current_epoch)?;
verify(epoch_authorized_voter)?;
// The offset in slots `n` on which the target_epoch
// (default value `DEFAULT_LEADER_SCHEDULE_SLOT_OFFSET`) is
// calculated is the number of slots available from the
// first slot `S` of an epoch in which to set a new voter for
// the epoch at `S` + `n`
if self.authorized_voters.contains(target_epoch) {
return Err(VoteError::TooSoonToReauthorize.into());
}
// Get the latest authorized_voter
let (latest_epoch, latest_authorized_pubkey) = self
.authorized_voters
.last()
.ok_or(InstructionError::InvalidAccountData)?;
// If we're not setting the same pubkey as authorized pubkey again,
// then update the list of prior voters to mark the expiration
// of the old authorized pubkey
if latest_authorized_pubkey != authorized_pubkey {
// Update the epoch ranges of authorized pubkeys that will be expired
let epoch_of_last_authorized_switch =
self.prior_voters.last().map(|range| range.2).unwrap_or(0);
// target_epoch must:
// 1) Be monotonically increasing due to the clock always
// moving forward
// 2) not be equal to latest epoch otherwise this
// function would have returned TooSoonToReauthorize error
// above
assert!(target_epoch > *latest_epoch);
// Commit the new state
self.prior_voters.append((
*latest_authorized_pubkey,
epoch_of_last_authorized_switch,
target_epoch,
));
}
self.authorized_voters
.insert(target_epoch, *authorized_pubkey);
Ok(())
}
fn get_and_update_authorized_voter(
&mut self,
current_epoch: Epoch,
) -> Result<Pubkey, InstructionError> {
let pubkey = self
.authorized_voters
.get_and_cache_authorized_voter_for_epoch(current_epoch)
.ok_or(InstructionError::InvalidAccountData)?;
self.authorized_voters
.purge_authorized_voters(current_epoch);
Ok(pubkey)
}
// Pop all recent votes that are not locked out at the next vote slot. This
// allows validators to switch forks once their votes for another fork have
// expired. This also allows validators continue voting on recent blocks in
// the same fork without increasing lockouts.
fn pop_expired_votes(&mut self, next_vote_slot: Slot) {
while let Some(vote) = self.last_lockout() {
if !vote.is_locked_out_at_slot(next_vote_slot) {
self.votes.pop_back();
} else {
break;
}
}
}
fn double_lockouts(&mut self) {
let stack_depth = self.votes.len();
for (i, v) in self.votes.iter_mut().enumerate() {
// Don't increase the lockout for this vote until we get more confirmations
// than the max number of confirmations this vote has seen
if stack_depth > i + v.confirmation_count as usize {
v.confirmation_count += 1;
}
}
}
pub fn process_timestamp(
&mut self,
slot: Slot,
timestamp: UnixTimestamp,
) -> Result<(), VoteError> {
if (slot < self.last_timestamp.slot || timestamp < self.last_timestamp.timestamp)
|| (slot == self.last_timestamp.slot
&& BlockTimestamp { slot, timestamp } != self.last_timestamp
&& self.last_timestamp.slot != 0)
{
return Err(VoteError::TimestampTooOld);
}
self.last_timestamp = BlockTimestamp { slot, timestamp };
Ok(())
}
pub fn is_correct_size_and_initialized(data: &[u8]) -> bool {
const VERSION_OFFSET: usize = 4;
data.len() == VoteState::size_of()
&& data[VERSION_OFFSET..VERSION_OFFSET + DEFAULT_PRIOR_VOTERS_OFFSET]
!= [0; DEFAULT_PRIOR_VOTERS_OFFSET]
}
}
/// Authorize the given pubkey to withdraw or sign votes. This may be called multiple times,
/// but will implicitly withdraw authorization from the previously authorized
/// key
pub fn authorize<S: std::hash::BuildHasher>(
vote_account: &mut BorrowedAccount,
authorized: &Pubkey,
vote_authorize: VoteAuthorize,
signers: &HashSet<Pubkey, S>,
clock: &Clock,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
let mut vote_state: VoteState = vote_account
.get_state::<VoteStateVersions>()?
.convert_to_current();
match vote_authorize {
VoteAuthorize::Voter => {
let authorized_withdrawer_signer = if feature_set
.is_active(&feature_set::vote_withdraw_authority_may_change_authorized_voter::id())
{
verify_authorized_signer(&vote_state.authorized_withdrawer, signers).is_ok()
} else {
false
};
vote_state.set_new_authorized_voter(
authorized,
clock.epoch,
clock.leader_schedule_epoch + 1,
|epoch_authorized_voter| {
// current authorized withdrawer or authorized voter must say "yay"
if authorized_withdrawer_signer {
Ok(())
} else {
verify_authorized_signer(&epoch_authorized_voter, signers)
}
},
)?;
}
VoteAuthorize::Withdrawer => {
// current authorized withdrawer must say "yay"
verify_authorized_signer(&vote_state.authorized_withdrawer, signers)?;
vote_state.authorized_withdrawer = *authorized;
}
}
vote_account.set_state(&VoteStateVersions::new_current(vote_state), feature_set)
}
/// Update the node_pubkey, requires signature of the authorized voter
pub fn update_validator_identity<S: std::hash::BuildHasher>(
vote_account: &mut BorrowedAccount,
node_pubkey: &Pubkey,
signers: &HashSet<Pubkey, S>,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
let mut vote_state: VoteState = vote_account
.get_state::<VoteStateVersions>()?
.convert_to_current();
// current authorized withdrawer must say "yay"
verify_authorized_signer(&vote_state.authorized_withdrawer, signers)?;
// new node must say "yay"
verify_authorized_signer(node_pubkey, signers)?;
vote_state.node_pubkey = *node_pubkey;
vote_account.set_state(&VoteStateVersions::new_current(vote_state), feature_set)
}
/// Update the vote account's commission
pub fn update_commission<S: std::hash::BuildHasher>(
vote_account: &mut BorrowedAccount,
commission: u8,
signers: &HashSet<Pubkey, S>,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
let mut vote_state: VoteState = vote_account
.get_state::<VoteStateVersions>()?
.convert_to_current();
// current authorized withdrawer must say "yay"
verify_authorized_signer(&vote_state.authorized_withdrawer, signers)?;
vote_state.commission = commission;
vote_account.set_state(&VoteStateVersions::new_current(vote_state), feature_set)
}
fn verify_authorized_signer<S: std::hash::BuildHasher>(
authorized: &Pubkey,
signers: &HashSet<Pubkey, S>,
) -> Result<(), InstructionError> {
if signers.contains(authorized) {
Ok(())
} else {
Err(InstructionError::MissingRequiredSignature)
}
}
/// Withdraw funds from the vote account
#[allow(clippy::too_many_arguments)]
pub fn withdraw<S: std::hash::BuildHasher>(
transaction_context: &TransactionContext,
instruction_context: &InstructionContext,
vote_account_index: u16,
lamports: u64,
to_account_index: u16,
signers: &HashSet<Pubkey, S>,
rent_sysvar: Option<&Rent>,
clock: Option<&Clock>,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
// NOTE: solana-sdk 1.11 `try_borrow_account` is private(this lib was written in 1.10.29)
// We use `try_borrow_instruction_account` to fix it.
let mut vote_account = instruction_context
.try_borrow_instruction_account(transaction_context, vote_account_index)?;
let vote_state: VoteState = vote_account
.get_state::<VoteStateVersions>()?
.convert_to_current();
verify_authorized_signer(&vote_state.authorized_withdrawer, signers)?;
let remaining_balance = vote_account
.get_lamports()
.checked_sub(lamports)
.ok_or(InstructionError::InsufficientFunds)?;
if remaining_balance == 0 {
let reject_active_vote_account_close = clock
.zip(vote_state.epoch_credits.last())
.map(|(clock, (last_epoch_with_credits, _, _))| {
let current_epoch = clock.epoch;
// if current_epoch - last_epoch_with_credits < 2 then the validator has received credits
// either in the current epoch or the previous epoch. If it's >= 2 then it has been at least
// one full epoch since the validator has received credits.
current_epoch.saturating_sub(*last_epoch_with_credits) < 2
})
.unwrap_or(false);
if reject_active_vote_account_close {
// TODO:
// datapoint_debug!("vote-account-close", ("reject-active", 1, i64));
return Err(InstructionError::InvalidAccountData);
} else {
// Deinitialize upon zero-balance
// TODO:
// datapoint_debug!("vote-account-close", ("allow", 1, i64));
vote_account.set_state(
&VoteStateVersions::new_current(VoteState::default()),
feature_set,
)?;
}
} else if let Some(rent_sysvar) = rent_sysvar {
let min_rent_exempt_balance = rent_sysvar.minimum_balance(vote_account.get_data().len());
if remaining_balance < min_rent_exempt_balance {
return Err(InstructionError::InsufficientFunds);
}
}
vote_account.checked_sub_lamports(lamports, feature_set)?;
drop(vote_account);
// NOTE: solana-sdk 1.11 `try_borrow_account` is private(this lib was written in 1.10.29)
// We use `try_borrow_instruction_account` to fix it.
let mut to_account = instruction_context
.try_borrow_instruction_account(transaction_context, to_account_index)?;
to_account.checked_add_lamports(lamports, feature_set)?;
Ok(())
}
/// Initialize the vote_state for a vote account
/// Assumes that the account is being init as part of a account creation or balance transfer and
/// that the transaction must be signed by the staker's keys
pub fn initialize_account<S: std::hash::BuildHasher>(
vote_account: &mut BorrowedAccount,
vote_init: &VoteInit,
signers: &HashSet<Pubkey, S>,
clock: &Clock,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
if vote_account.get_data().len() != VoteState::size_of() {
return Err(InstructionError::InvalidAccountData);
}
let versioned = vote_account.get_state::<VoteStateVersions>()?;
if !versioned.is_uninitialized() {
return Err(InstructionError::AccountAlreadyInitialized);
}
// node must agree to accept this vote account
verify_authorized_signer(&vote_init.node_pubkey, signers)?;
vote_account.set_state(
&VoteStateVersions::new_current(VoteState::new(vote_init, clock)),
feature_set,
)
}
fn verify_and_get_vote_state<S: std::hash::BuildHasher>(
vote_account: &BorrowedAccount,
clock: &Clock,
signers: &HashSet<Pubkey, S>,
) -> Result<VoteState, InstructionError> {
let versioned = vote_account.get_state::<VoteStateVersions>()?;
if versioned.is_uninitialized() {
return Err(InstructionError::UninitializedAccount);
}
let mut vote_state = versioned.convert_to_current();
let authorized_voter = vote_state.get_and_update_authorized_voter(clock.epoch)?;
verify_authorized_signer(&authorized_voter, signers)?;
Ok(vote_state)
}
pub fn process_vote<S: std::hash::BuildHasher>(
vote_account: &mut BorrowedAccount,
slot_hashes: &[SlotHash],
clock: &Clock,
vote: &Vote,
signers: &HashSet<Pubkey, S>,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
let mut vote_state = verify_and_get_vote_state(vote_account, clock, signers)?;
vote_state.process_vote(vote, slot_hashes, clock.epoch, Some(feature_set))?;
if let Some(timestamp) = vote.timestamp {
vote.slots
.iter()
.max()
.ok_or(VoteError::EmptySlots)
.and_then(|slot| vote_state.process_timestamp(*slot, timestamp))?;
}
vote_account.set_state(&VoteStateVersions::new_current(vote_state), feature_set)
}
pub fn process_vote_state_update<S: std::hash::BuildHasher>(
vote_account: &mut BorrowedAccount,
slot_hashes: &[SlotHash],
clock: &Clock,
mut vote_state_update: VoteStateUpdate,
signers: &HashSet<Pubkey, S>,
feature_set: &FeatureSet,
) -> Result<(), InstructionError> {
let mut vote_state = verify_and_get_vote_state(vote_account, clock, signers)?;
vote_state.check_update_vote_state_slots_are_valid(&mut vote_state_update, slot_hashes)?;
vote_state.process_new_vote_state(
vote_state_update.lockouts,
vote_state_update.root,
vote_state_update.timestamp,
clock.epoch,
Some(feature_set),
)?;
vote_account.set_state(&VoteStateVersions::new_current(vote_state), feature_set)
}
pub fn create_account_with_authorized(
node_pubkey: &Pubkey,
authorized_voter: &Pubkey,
authorized_withdrawer: &Pubkey,
commission: u8,
lamports: u64,
) -> AccountSharedData {
let mut vote_account = AccountSharedData::new(lamports, VoteState::size_of(), &id());
let vote_state = VoteState::new(
&VoteInit {
node_pubkey: *node_pubkey,
authorized_voter: *authorized_voter,
authorized_withdrawer: *authorized_withdrawer,
commission,
},
&Clock::default(),
);
let versioned = VoteStateVersions::new_current(vote_state);
VoteState::to(&versioned, &mut vote_account).unwrap();
vote_account
}
// create_account() should be removed, use create_account_with_authorized() instead
pub fn create_account(
vote_pubkey: &Pubkey,
node_pubkey: &Pubkey,
commission: u8,
lamports: u64,
) -> AccountSharedData {
create_account_with_authorized(node_pubkey, vote_pubkey, vote_pubkey, commission, lamports)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/vote/vote_state/vote_state_0_23_5.rs
|
use super::*;
const MAX_ITEMS: usize = 32;
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct VoteState0_23_5 {
/// the node that votes in this account
pub node_pubkey: Pubkey,
/// the signer for vote transactions
pub authorized_voter: Pubkey,
/// when the authorized voter was set/initialized
pub authorized_voter_epoch: Epoch,
/// history of prior authorized voters and the epoch ranges for which
/// they were set
pub prior_voters: CircBuf<(Pubkey, Epoch, Epoch, Slot)>,
/// the signer for withdrawals
pub authorized_withdrawer: Pubkey,
/// percentage (0-100) that represents what part of a rewards
/// payout should be given to this VoteAccount
pub commission: u8,
pub votes: VecDeque<Lockout>,
pub root_slot: Option<u64>,
/// history of how many credits earned by the end of each epoch
/// each tuple is (Epoch, credits, prev_credits)
pub epoch_credits: Vec<(Epoch, u64, u64)>,
/// most recent timestamp submitted with a vote
pub last_timestamp: BlockTimestamp,
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub struct CircBuf<I> {
pub buf: [I; MAX_ITEMS],
/// next pointer
pub idx: usize,
}
impl<I: Default + Copy> Default for CircBuf<I> {
fn default() -> Self {
Self {
buf: [I::default(); MAX_ITEMS],
idx: MAX_ITEMS - 1,
}
}
}
impl<I> CircBuf<I> {
pub fn append(&mut self, item: I) {
// remember prior delegate and when we switched, to support later slashing
self.idx += 1;
self.idx %= MAX_ITEMS;
self.buf[self.idx] = item;
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token/error.rs
|
//! Error types
use num_derive::FromPrimitive;
use solana_sdk::{decode_error::DecodeError, program_error::ProgramError};
use thiserror::Error;
/// Errors that may be returned by the Token program.
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum TokenError {
// 0
/// Lamport balance below rent-exempt threshold.
#[error("Lamport balance below rent-exempt threshold")]
NotRentExempt,
/// Insufficient funds for the operation requested.
#[error("Insufficient funds")]
InsufficientFunds,
/// Invalid Mint.
#[error("Invalid Mint")]
InvalidMint,
/// Account not associated with this Mint.
#[error("Account not associated with this Mint")]
MintMismatch,
/// Owner does not match.
#[error("Owner does not match")]
OwnerMismatch,
// 5
/// This token's supply is fixed and new tokens cannot be minted.
#[error("Fixed supply")]
FixedSupply,
/// The account cannot be initialized because it is already being used.
#[error("Already in use")]
AlreadyInUse,
/// Invalid number of provided signers.
#[error("Invalid number of provided signers")]
InvalidNumberOfProvidedSigners,
/// Invalid number of required signers.
#[error("Invalid number of required signers")]
InvalidNumberOfRequiredSigners,
/// State is uninitialized.
#[error("State is unititialized")]
UninitializedState,
// 10
/// Instruction does not support native tokens
#[error("Instruction does not support native tokens")]
NativeNotSupported,
/// Non-native account can only be closed if its balance is zero
#[error("Non-native account can only be closed if its balance is zero")]
NonNativeHasBalance,
/// Invalid instruction
#[error("Invalid instruction")]
InvalidInstruction,
/// State is invalid for requested operation.
#[error("State is invalid for requested operation")]
InvalidState,
/// Operation overflowed
#[error("Operation overflowed")]
Overflow,
// 15
/// Account does not support specified authority type.
#[error("Account does not support specified authority type")]
AuthorityTypeNotSupported,
/// This token mint cannot freeze accounts.
#[error("This token mint cannot freeze accounts")]
MintCannotFreeze,
/// Account is frozen; all account operations will fail
#[error("Account is frozen")]
AccountFrozen,
/// Mint decimals mismatch between the client and mint
#[error("The provided decimals value different from the Mint decimals")]
MintDecimalsMismatch,
/// Instruction does not support non-native tokens
#[error("Instruction does not support non-native tokens")]
NonNativeNotSupported,
}
impl From<TokenError> for ProgramError {
fn from(e: TokenError) -> Self {
ProgramError::Custom(e as u32)
}
}
impl<T> DecodeError<T> for TokenError {
fn type_of() -> &'static str {
"TokenError"
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token/mod.rs
|
pub mod instruction;
pub mod native_mint;
pub mod state;
mod error;
use solana_sdk::{
declare_id, entrypoint::ProgramResult, program_error::ProgramError, pubkey::Pubkey,
};
// Convert the UI representation of a token amount (using the decimals field defined in its mint)
/// to the raw amount
pub fn ui_amount_to_amount(ui_amount: f64, decimals: u8) -> u64 {
(ui_amount * 10_usize.pow(decimals as u32) as f64) as u64
}
/// Convert a raw amount to its UI representation (using the decimals field defined in its mint)
pub fn amount_to_ui_amount(amount: u64, decimals: u8) -> f64 {
amount as f64 / 10_usize.pow(decimals as u32) as f64
}
/// Convert a raw amount to its UI representation (using the decimals field defined in its mint)
pub fn amount_to_ui_amount_string(amount: u64, decimals: u8) -> String {
let decimals = decimals as usize;
if decimals > 0 {
// Left-pad zeros to decimals + 1, so we at least have an integer zero
let mut s = format!("{:01$}", amount, decimals + 1);
// Add the decimal point (Sorry, "," locales!)
s.insert(s.len() - decimals, '.');
s
} else {
amount.to_string()
}
}
/// Convert a raw amount to its UI representation using the given decimals field
/// Excess zeroes or unneeded decimal point are trimmed.
pub fn amount_to_ui_amount_string_trimmed(amount: u64, decimals: u8) -> String {
let mut s = amount_to_ui_amount_string(amount, decimals);
if decimals > 0 {
let zeros_trimmed = s.trim_end_matches('0');
s = zeros_trimmed.trim_end_matches('.').to_string();
}
s
}
/// Try to convert a UI representation of a token amount to its raw amount using the given decimals
/// field
pub fn try_ui_amount_into_amount(ui_amount: String, decimals: u8) -> Result<u64, ProgramError> {
let decimals = decimals as usize;
let mut parts = ui_amount.split('.');
let mut amount_str = parts.next().unwrap().to_string(); // splitting a string, even an empty one, will always yield an iterator of at least len == 1
let after_decimal = parts.next().unwrap_or("");
let after_decimal = after_decimal.trim_end_matches('0');
if (amount_str.is_empty() && after_decimal.is_empty())
|| parts.next().is_some()
|| after_decimal.len() > decimals
{
return Err(ProgramError::InvalidArgument);
}
amount_str.push_str(after_decimal);
for _ in 0..decimals.saturating_sub(after_decimal.len()) {
amount_str.push('0');
}
amount_str
.parse::<u64>()
.map_err(|_| ProgramError::InvalidArgument)
}
declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
/// Checks that the supplied program ID is the correct one for SPL-token
pub fn check_program_account(spl_token_program_id: &Pubkey) -> ProgramResult {
if spl_token_program_id != &id() {
return Err(ProgramError::IncorrectProgramId);
}
Ok(())
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token/native_mint.rs
|
//! The Mint that represents the native token
/// There are 10^9 lamports in one SOL
pub const DECIMALS: u8 = 9;
// The Mint for native SOL Token accounts
solana_sdk::declare_id!("So11111111111111111111111111111111111111112");
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token/state.rs
|
//! State transition types
use super::instruction::MAX_SIGNERS;
use arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs};
use num_enum::TryFromPrimitive;
use solana_sdk::{
incinerator,
program_error::ProgramError,
program_option::COption,
program_pack::{IsInitialized, Pack, Sealed},
pubkey::{Pubkey, PUBKEY_BYTES},
system_program,
};
/// Mint data.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Mint {
/// Optional authority used to mint new tokens. The mint authority may only be provided during
/// mint creation. If no mint authority is present then the mint has a fixed supply and no
/// further tokens may be minted.
pub mint_authority: COption<Pubkey>,
/// Total supply of tokens.
pub supply: u64,
/// Number of base 10 digits to the right of the decimal place.
pub decimals: u8,
/// Is `true` if this structure has been initialized
pub is_initialized: bool,
/// Optional authority to freeze token accounts.
pub freeze_authority: COption<Pubkey>,
}
impl Sealed for Mint {}
impl IsInitialized for Mint {
fn is_initialized(&self) -> bool {
self.is_initialized
}
}
impl Pack for Mint {
const LEN: usize = 82;
fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
let src = array_ref![src, 0, 82];
let (mint_authority, supply, decimals, is_initialized, freeze_authority) =
array_refs![src, 36, 8, 1, 1, 36];
let mint_authority = unpack_coption_key(mint_authority)?;
let supply = u64::from_le_bytes(*supply);
let decimals = decimals[0];
let is_initialized = match is_initialized {
[0] => false,
[1] => true,
_ => return Err(ProgramError::InvalidAccountData),
};
let freeze_authority = unpack_coption_key(freeze_authority)?;
Ok(Mint {
mint_authority,
supply,
decimals,
is_initialized,
freeze_authority,
})
}
fn pack_into_slice(&self, dst: &mut [u8]) {
let dst = array_mut_ref![dst, 0, 82];
let (
mint_authority_dst,
supply_dst,
decimals_dst,
is_initialized_dst,
freeze_authority_dst,
) = mut_array_refs![dst, 36, 8, 1, 1, 36];
let &Mint {
ref mint_authority,
supply,
decimals,
is_initialized,
ref freeze_authority,
} = self;
pack_coption_key(mint_authority, mint_authority_dst);
*supply_dst = supply.to_le_bytes();
decimals_dst[0] = decimals;
is_initialized_dst[0] = is_initialized as u8;
pack_coption_key(freeze_authority, freeze_authority_dst);
}
}
/// Account data.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Account {
/// The mint associated with this account
pub mint: Pubkey,
/// The owner of this account.
pub owner: Pubkey,
/// The amount of tokens this account holds.
pub amount: u64,
/// If `delegate` is `Some` then `delegated_amount` represents
/// the amount authorized by the delegate
pub delegate: COption<Pubkey>,
/// The account's state
pub state: AccountState,
/// If is_native.is_some, this is a native token, and the value logs the rent-exempt reserve. An
/// Account is required to be rent-exempt, so the value is used by the Processor to ensure that
/// wrapped SOL accounts do not drop below this threshold.
pub is_native: COption<u64>,
/// The amount delegated
pub delegated_amount: u64,
/// Optional authority to close the account.
pub close_authority: COption<Pubkey>,
}
impl Account {
/// Checks if account is frozen
pub fn is_frozen(&self) -> bool {
self.state == AccountState::Frozen
}
/// Checks if account is native
pub fn is_native(&self) -> bool {
self.is_native.is_some()
}
/// Checks if a token Account's owner is the system_program or the incinerator
pub fn is_owned_by_system_program_or_incinerator(&self) -> bool {
system_program::check_id(&self.owner) || incinerator::check_id(&self.owner)
}
}
impl Sealed for Account {}
impl IsInitialized for Account {
fn is_initialized(&self) -> bool {
self.state != AccountState::Uninitialized
}
}
impl Pack for Account {
const LEN: usize = 165;
fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
let src = array_ref![src, 0, 165];
let (mint, owner, amount, delegate, state, is_native, delegated_amount, close_authority) =
array_refs![src, 32, 32, 8, 36, 1, 12, 8, 36];
Ok(Account {
mint: Pubkey::new_from_array(*mint),
owner: Pubkey::new_from_array(*owner),
amount: u64::from_le_bytes(*amount),
delegate: unpack_coption_key(delegate)?,
state: AccountState::try_from_primitive(state[0])
.or(Err(ProgramError::InvalidAccountData))?,
is_native: unpack_coption_u64(is_native)?,
delegated_amount: u64::from_le_bytes(*delegated_amount),
close_authority: unpack_coption_key(close_authority)?,
})
}
fn pack_into_slice(&self, dst: &mut [u8]) {
let dst = array_mut_ref![dst, 0, 165];
let (
mint_dst,
owner_dst,
amount_dst,
delegate_dst,
state_dst,
is_native_dst,
delegated_amount_dst,
close_authority_dst,
) = mut_array_refs![dst, 32, 32, 8, 36, 1, 12, 8, 36];
let &Account {
ref mint,
ref owner,
amount,
ref delegate,
state,
ref is_native,
delegated_amount,
ref close_authority,
} = self;
mint_dst.copy_from_slice(mint.as_ref());
owner_dst.copy_from_slice(owner.as_ref());
*amount_dst = amount.to_le_bytes();
pack_coption_key(delegate, delegate_dst);
state_dst[0] = state as u8;
pack_coption_u64(is_native, is_native_dst);
*delegated_amount_dst = delegated_amount.to_le_bytes();
pack_coption_key(close_authority, close_authority_dst);
}
}
/// Account state.
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Default, TryFromPrimitive)]
pub enum AccountState {
/// Account is not yet initialized
#[default]
Uninitialized,
/// Account is initialized; the account owner and/or delegate may perform permitted operations
/// on this account
Initialized,
/// Account has been frozen by the mint freeze authority. Neither the account owner nor
/// the delegate are able to perform operations on this account.
Frozen,
}
/// Multisignature data.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Multisig {
/// Number of signers required
pub m: u8,
/// Number of valid signers
pub n: u8,
/// Is `true` if this structure has been initialized
pub is_initialized: bool,
/// Signer public keys
pub signers: [Pubkey; MAX_SIGNERS],
}
impl Sealed for Multisig {}
impl IsInitialized for Multisig {
fn is_initialized(&self) -> bool {
self.is_initialized
}
}
impl Pack for Multisig {
const LEN: usize = 355;
fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
let src = array_ref![src, 0, 355];
#[allow(clippy::ptr_offset_with_cast)]
let (m, n, is_initialized, signers_flat) = array_refs![src, 1, 1, 1, 32 * MAX_SIGNERS];
let mut result = Multisig {
m: m[0],
n: n[0],
is_initialized: match is_initialized {
[0] => false,
[1] => true,
_ => return Err(ProgramError::InvalidAccountData),
},
signers: [Pubkey::new_from_array([0u8; 32]); MAX_SIGNERS],
};
for (src, dst) in signers_flat.chunks(32).zip(result.signers.iter_mut()) {
*dst = Pubkey::try_from(src).unwrap();
}
Ok(result)
}
fn pack_into_slice(&self, dst: &mut [u8]) {
let dst = array_mut_ref![dst, 0, 355];
#[allow(clippy::ptr_offset_with_cast)]
let (m, n, is_initialized, signers_flat) = mut_array_refs![dst, 1, 1, 1, 32 * MAX_SIGNERS];
*m = [self.m];
*n = [self.n];
*is_initialized = [self.is_initialized as u8];
for (i, src) in self.signers.iter().enumerate() {
let dst_array = array_mut_ref![signers_flat, 32 * i, 32];
dst_array.copy_from_slice(src.as_ref());
}
}
}
// Helpers
fn pack_coption_key(src: &COption<Pubkey>, dst: &mut [u8; 36]) {
let (tag, body) = mut_array_refs![dst, 4, 32];
match src {
COption::Some(key) => {
*tag = [1, 0, 0, 0];
body.copy_from_slice(key.as_ref());
}
COption::None => {
*tag = [0; 4];
}
}
}
fn unpack_coption_key(src: &[u8; 36]) -> Result<COption<Pubkey>, ProgramError> {
let (tag, body) = array_refs![src, 4, 32];
match *tag {
[0, 0, 0, 0] => Ok(COption::None),
[1, 0, 0, 0] => Ok(COption::Some(Pubkey::new_from_array(*body))),
_ => Err(ProgramError::InvalidAccountData),
}
}
fn pack_coption_u64(src: &COption<u64>, dst: &mut [u8; 12]) {
let (tag, body) = mut_array_refs![dst, 4, 8];
match src {
COption::Some(amount) => {
*tag = [1, 0, 0, 0];
*body = amount.to_le_bytes();
}
COption::None => {
*tag = [0; 4];
}
}
}
fn unpack_coption_u64(src: &[u8; 12]) -> Result<COption<u64>, ProgramError> {
let (tag, body) = array_refs![src, 4, 8];
match *tag {
[0, 0, 0, 0] => Ok(COption::None),
[1, 0, 0, 0] => Ok(COption::Some(u64::from_le_bytes(*body))),
_ => Err(ProgramError::InvalidAccountData),
}
}
const SPL_TOKEN_ACCOUNT_MINT_OFFSET: usize = 0;
const SPL_TOKEN_ACCOUNT_OWNER_OFFSET: usize = 32;
/// A trait for token Account structs to enable efficiently unpacking various fields
/// without unpacking the complete state.
pub trait GenericTokenAccount {
/// Check if the account data is a valid token account
fn valid_account_data(account_data: &[u8]) -> bool;
/// Call after account length has already been verified to unpack the account owner
fn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey {
Self::unpack_pubkey_unchecked(account_data, SPL_TOKEN_ACCOUNT_OWNER_OFFSET)
}
/// Call after account length has already been verified to unpack the account mint
fn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey {
Self::unpack_pubkey_unchecked(account_data, SPL_TOKEN_ACCOUNT_MINT_OFFSET)
}
/// Call after account length has already been verified to unpack a Pubkey at
/// the specified offset. Panics if `account_data.len()` is less than `PUBKEY_BYTES`
fn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey {
bytemuck::from_bytes(&account_data[offset..offset + PUBKEY_BYTES])
}
/// Unpacks an account's owner from opaque account data.
fn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey> {
if Self::valid_account_data(account_data) {
Some(Self::unpack_account_owner_unchecked(account_data))
} else {
None
}
}
/// Unpacks an account's mint from opaque account data.
fn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey> {
if Self::valid_account_data(account_data) {
Some(Self::unpack_account_mint_unchecked(account_data))
} else {
None
}
}
}
/// The offset of state field in Account's C representation
pub const ACCOUNT_INITIALIZED_INDEX: usize = 108;
/// Check if the account data buffer represents an initialized account.
/// This is checking the `state` (AccountState) field of an Account object.
pub fn is_initialized_account(account_data: &[u8]) -> bool {
*account_data
.get(ACCOUNT_INITIALIZED_INDEX)
.unwrap_or(&(AccountState::Uninitialized as u8))
!= AccountState::Uninitialized as u8
}
impl GenericTokenAccount for Account {
fn valid_account_data(account_data: &[u8]) -> bool {
account_data.len() == Account::LEN && is_initialized_account(account_data)
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token/instruction.rs
|
//! Instruction types
use std::{convert::TryInto, mem::size_of};
use solana_sdk::{
instruction::{AccountMeta, Instruction},
program_error::ProgramError,
program_option::COption,
pubkey::Pubkey,
sysvar,
};
use super::{check_program_account, error::TokenError};
/// Minimum number of multisignature signers (min N)
pub const MIN_SIGNERS: usize = 1;
/// Maximum number of multisignature signers (max N)
pub const MAX_SIGNERS: usize = 11;
/// Instructions supported by the token program.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub enum TokenInstruction<'a> {
/// Initializes a new mint and optionally deposits all the newly minted
/// tokens in an account.
///
/// The `InitializeMint` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The mint to initialize.
/// 1. `[]` Rent sysvar
///
InitializeMint {
/// Number of base 10 digits to the right of the decimal place.
decimals: u8,
/// The authority/multisignature to mint tokens.
mint_authority: Pubkey,
/// The freeze authority/multisignature of the mint.
freeze_authority: COption<Pubkey>,
},
/// Initializes a new account to hold tokens. If this account is associated
/// with the native mint then the token balance of the initialized account
/// will be equal to the amount of SOL in the account. If this account is
/// associated with another mint, that mint must be initialized before this
/// command can succeed.
///
/// The `InitializeAccount` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The account to initialize.
/// 1. `[]` The mint this account will be associated with.
/// 2. `[]` The new account's owner/multisignature.
/// 3. `[]` Rent sysvar
InitializeAccount,
/// Initializes a multisignature account with N provided signers.
///
/// Multisignature accounts can used in place of any single owner/delegate
/// accounts in any token instruction that require an owner/delegate to be
/// present. The variant field represents the number of signers (M)
/// required to validate this multisignature account.
///
/// The `InitializeMultisig` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The multisignature account to initialize.
/// 1. `[]` Rent sysvar
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <=
/// 11.
InitializeMultisig {
/// The number of signers (M) required to validate this multisignature
/// account.
m: u8,
},
/// Transfers tokens from one account to another either directly or via a
/// delegate. If this account is associated with the native mint then equal
/// amounts of SOL and Tokens will be transferred to the destination
/// account.
///
/// Accounts expected by this instruction:
///
/// * Single owner/delegate
/// 0. `[writable]` The source account.
/// 1. `[writable]` The destination account.
/// 2. `[signer]` The source account's owner/delegate.
///
/// * Multisignature owner/delegate
/// 0. `[writable]` The source account.
/// 1. `[writable]` The destination account.
/// 2. `[]` The source account's multisignature owner/delegate.
/// 3. ..3+M `[signer]` M signer accounts.
Transfer {
/// The amount of tokens to transfer.
amount: u64,
},
/// Approves a delegate. A delegate is given the authority over tokens on
/// behalf of the source account's owner.
///
/// Accounts expected by this instruction:
///
/// * Single owner
/// 0. `[writable]` The source account.
/// 1. `[]` The delegate.
/// 2. `[signer]` The source account owner.
///
/// * Multisignature owner
/// 0. `[writable]` The source account.
/// 1. `[]` The delegate.
/// 2. `[]` The source account's multisignature owner.
/// 3. ..3+M `[signer]` M signer accounts
Approve {
/// The amount of tokens the delegate is approved for.
amount: u64,
},
/// Revokes the delegate's authority.
///
/// Accounts expected by this instruction:
///
/// * Single owner
/// 0. `[writable]` The source account.
/// 1. `[signer]` The source account owner.
///
/// * Multisignature owner
/// 0. `[writable]` The source account.
/// 1. `[]` The source account's multisignature owner.
/// 2. ..2+M `[signer]` M signer accounts
Revoke,
/// Sets a new authority of a mint or account.
///
/// Accounts expected by this instruction:
///
/// * Single authority
/// 0. `[writable]` The mint or account to change the authority of.
/// 1. `[signer]` The current authority of the mint or account.
///
/// * Multisignature authority
/// 0. `[writable]` The mint or account to change the authority of.
/// 1. `[]` The mint's or account's current multisignature authority.
/// 2. ..2+M `[signer]` M signer accounts
SetAuthority {
/// The type of authority to update.
authority_type: AuthorityType,
/// The new authority
new_authority: COption<Pubkey>,
},
/// Mints new tokens to an account. The native mint does not support
/// minting.
///
/// Accounts expected by this instruction:
///
/// * Single authority
/// 0. `[writable]` The mint.
/// 1. `[writable]` The account to mint tokens to.
/// 2. `[signer]` The mint's minting authority.
///
/// * Multisignature authority
/// 0. `[writable]` The mint.
/// 1. `[writable]` The account to mint tokens to.
/// 2. `[]` The mint's multisignature mint-tokens authority.
/// 3. ..3+M `[signer]` M signer accounts.
MintTo {
/// The amount of new tokens to mint.
amount: u64,
},
/// Burns tokens by removing them from an account. `Burn` does not support
/// accounts associated with the native mint, use `CloseAccount` instead.
///
/// Accounts expected by this instruction:
///
/// * Single owner/delegate
/// 0. `[writable]` The account to burn from.
/// 1. `[writable]` The token mint.
/// 2. `[signer]` The account's owner/delegate.
///
/// * Multisignature owner/delegate
/// 0. `[writable]` The account to burn from.
/// 1. `[writable]` The token mint.
/// 2. `[]` The account's multisignature owner/delegate.
/// 3. ..3+M `[signer]` M signer accounts.
Burn {
/// The amount of tokens to burn.
amount: u64,
},
/// Close an account by transferring all its SOL to the destination account.
/// Non-native accounts may only be closed if its token amount is zero.
///
/// Accounts expected by this instruction:
///
/// * Single owner
/// 0. `[writable]` The account to close.
/// 1. `[writable]` The destination account.
/// 2. `[signer]` The account's owner.
///
/// * Multisignature owner
/// 0. `[writable]` The account to close.
/// 1. `[writable]` The destination account.
/// 2. `[]` The account's multisignature owner.
/// 3. ..3+M `[signer]` M signer accounts.
CloseAccount,
/// Freeze an Initialized account using the Mint's freeze_authority (if
/// set).
///
/// Accounts expected by this instruction:
///
/// * Single owner
/// 0. `[writable]` The account to freeze.
/// 1. `[]` The token mint.
/// 2. `[signer]` The mint freeze authority.
///
/// * Multisignature owner
/// 0. `[writable]` The account to freeze.
/// 1. `[]` The token mint.
/// 2. `[]` The mint's multisignature freeze authority.
/// 3. ..3+M `[signer]` M signer accounts.
FreezeAccount,
/// Thaw a Frozen account using the Mint's freeze_authority (if set).
///
/// Accounts expected by this instruction:
///
/// * Single owner
/// 0. `[writable]` The account to freeze.
/// 1. `[]` The token mint.
/// 2. `[signer]` The mint freeze authority.
///
/// * Multisignature owner
/// 0. `[writable]` The account to freeze.
/// 1. `[]` The token mint.
/// 2. `[]` The mint's multisignature freeze authority.
/// 3. ..3+M `[signer]` M signer accounts.
ThawAccount,
/// Transfers tokens from one account to another either directly or via a
/// delegate. If this account is associated with the native mint then equal
/// amounts of SOL and Tokens will be transferred to the destination
/// account.
///
/// This instruction differs from Transfer in that the token mint and
/// decimals value is checked by the caller. This may be useful when
/// creating transactions offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
/// * Single owner/delegate
/// 0. `[writable]` The source account.
/// 1. `[]` The token mint.
/// 2. `[writable]` The destination account.
/// 3. `[signer]` The source account's owner/delegate.
///
/// * Multisignature owner/delegate
/// 0. `[writable]` The source account.
/// 1. `[]` The token mint.
/// 2. `[writable]` The destination account.
/// 3. `[]` The source account's multisignature owner/delegate.
/// 4. ..4+M `[signer]` M signer accounts.
TransferChecked {
/// The amount of tokens to transfer.
amount: u64,
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Approves a delegate. A delegate is given the authority over tokens on
/// behalf of the source account's owner.
///
/// This instruction differs from Approve in that the token mint and
/// decimals value is checked by the caller. This may be useful when
/// creating transactions offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
/// * Single owner
/// 0. `[writable]` The source account.
/// 1. `[]` The token mint.
/// 2. `[]` The delegate.
/// 3. `[signer]` The source account owner.
///
/// * Multisignature owner
/// 0. `[writable]` The source account.
/// 1. `[]` The token mint.
/// 2. `[]` The delegate.
/// 3. `[]` The source account's multisignature owner.
/// 4. ..4+M `[signer]` M signer accounts
ApproveChecked {
/// The amount of tokens the delegate is approved for.
amount: u64,
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Mints new tokens to an account. The native mint does not support
/// minting.
///
/// This instruction differs from MintTo in that the decimals value is
/// checked by the caller. This may be useful when creating transactions
/// offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
/// * Single authority
/// 0. `[writable]` The mint.
/// 1. `[writable]` The account to mint tokens to.
/// 2. `[signer]` The mint's minting authority.
///
/// * Multisignature authority
/// 0. `[writable]` The mint.
/// 1. `[writable]` The account to mint tokens to.
/// 2. `[]` The mint's multisignature mint-tokens authority.
/// 3. ..3+M `[signer]` M signer accounts.
MintToChecked {
/// The amount of new tokens to mint.
amount: u64,
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Burns tokens by removing them from an account. `BurnChecked` does not
/// support accounts associated with the native mint, use `CloseAccount`
/// instead.
///
/// This instruction differs from Burn in that the decimals value is checked
/// by the caller. This may be useful when creating transactions offline or
/// within a hardware wallet.
///
/// Accounts expected by this instruction:
///
/// * Single owner/delegate
/// 0. `[writable]` The account to burn from.
/// 1. `[writable]` The token mint.
/// 2. `[signer]` The account's owner/delegate.
///
/// * Multisignature owner/delegate
/// 0. `[writable]` The account to burn from.
/// 1. `[writable]` The token mint.
/// 2. `[]` The account's multisignature owner/delegate.
/// 3. ..3+M `[signer]` M signer accounts.
BurnChecked {
/// The amount of tokens to burn.
amount: u64,
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Like InitializeAccount, but the owner pubkey is passed via instruction data
/// rather than the accounts list. This variant may be preferable when using
/// Cross Program Invocation from an instruction that does not need the owner's
/// `AccountInfo` otherwise.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The account to initialize.
/// 1. `[]` The mint this account will be associated with.
/// 3. `[]` Rent sysvar
InitializeAccount2 {
/// The new account's owner/multisignature.
owner: Pubkey,
},
/// Given a wrapped / native token account (a token account containing SOL)
/// updates its amount field based on the account's underlying `lamports`.
/// This is useful if a non-wrapped SOL account uses `system_instruction::transfer`
/// to move lamports to a wrapped token account, and needs to have its token
/// `amount` field updated.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The native token account to sync with its underlying lamports.
SyncNative,
/// Like InitializeAccount2, but does not require the Rent sysvar to be provided
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The account to initialize.
/// 1. `[]` The mint this account will be associated with.
InitializeAccount3 {
/// The new account's owner/multisignature.
owner: Pubkey,
},
/// Like InitializeMultisig, but does not require the Rent sysvar to be provided
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The multisignature account to initialize.
/// 1. ..1+N. `[]` The signer accounts, must equal to N where 1 <= N <=
/// 11.
InitializeMultisig2 {
/// The number of signers (M) required to validate this multisignature
/// account.
m: u8,
},
/// Like InitializeMint, but does not require the Rent sysvar to be provided
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The mint to initialize.
///
InitializeMint2 {
/// Number of base 10 digits to the right of the decimal place.
decimals: u8,
/// The authority/multisignature to mint tokens.
mint_authority: Pubkey,
/// The freeze authority/multisignature of the mint.
freeze_authority: COption<Pubkey>,
},
/// Gets the required size of an account for the given mint as a little-endian
/// `u64`.
///
/// Return data can be fetched using `sol_get_return_data` and deserializing
/// the return data as a little-endian `u64`.
///
/// Accounts expected by this instruction:
///
/// 0. `[]` The mint to calculate for
GetAccountDataSize, // typically, there's also data, but this program ignores it
/// Initialize the Immutable Owner extension for the given token account
///
/// Fails if the account has already been initialized, so must be called before
/// `InitializeAccount`.
///
/// No-ops in this version of the program, but is included for compatibility
/// with the Associated Token Account program.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The account to initialize.
///
/// Data expected by this instruction:
/// None
InitializeImmutableOwner,
/// Convert an Amount of tokens to a UiAmount `string`, using the given mint.
/// In this version of the program, the mint can only specify the number of decimals.
///
/// Fails on an invalid mint.
///
/// Return data can be fetched using `sol_get_return_data` and deserialized with
/// `String::from_utf8`.
///
/// Accounts expected by this instruction:
///
/// 0. `[]` The mint to calculate for
AmountToUiAmount {
/// The amount of tokens to reformat.
amount: u64,
},
/// Convert a UiAmount of tokens to a little-endian `u64` raw Amount, using the given mint.
/// In this version of the program, the mint can only specify the number of decimals.
///
/// Return data can be fetched using `sol_get_return_data` and deserializing
/// the return data as a little-endian `u64`.
///
/// Accounts expected by this instruction:
///
/// 0. `[]` The mint to calculate for
UiAmountToAmount {
/// The ui_amount of tokens to reformat.
ui_amount: &'a str,
},
// Any new variants also need to be added to program-2022 `TokenInstruction`, so that the
// latter remains a superset of this instruction set. New variants also need to be added to
// token/js/src/instructions/types.ts to maintain @solana/spl-token compatibility
}
impl<'a> TokenInstruction<'a> {
/// Unpacks a byte buffer into a [TokenInstruction](enum.TokenInstruction.html).
pub fn unpack(input: &'a [u8]) -> Result<Self, ProgramError> {
use TokenError::InvalidInstruction;
let (&tag, rest) = input.split_first().ok_or(InvalidInstruction)?;
Ok(match tag {
0 => {
let (&decimals, rest) = rest.split_first().ok_or(InvalidInstruction)?;
let (mint_authority, rest) = Self::unpack_pubkey(rest)?;
let (freeze_authority, _rest) = Self::unpack_pubkey_option(rest)?;
Self::InitializeMint {
mint_authority,
freeze_authority,
decimals,
}
}
1 => Self::InitializeAccount,
2 => {
let &m = rest.first().ok_or(InvalidInstruction)?;
Self::InitializeMultisig { m }
}
3 | 4 | 7 | 8 => {
let amount = rest
.get(..8)
.and_then(|slice| slice.try_into().ok())
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
match tag {
3 => Self::Transfer { amount },
4 => Self::Approve { amount },
7 => Self::MintTo { amount },
8 => Self::Burn { amount },
_ => unreachable!(),
}
}
5 => Self::Revoke,
6 => {
let (authority_type, rest) = rest
.split_first()
.ok_or_else(|| ProgramError::from(InvalidInstruction))
.and_then(|(&t, rest)| Ok((AuthorityType::from(t)?, rest)))?;
let (new_authority, _rest) = Self::unpack_pubkey_option(rest)?;
Self::SetAuthority {
authority_type,
new_authority,
}
}
9 => Self::CloseAccount,
10 => Self::FreezeAccount,
11 => Self::ThawAccount,
12 => {
let (amount, rest) = rest.split_at(8);
let amount = amount
.try_into()
.ok()
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
let (&decimals, _rest) = rest.split_first().ok_or(InvalidInstruction)?;
Self::TransferChecked { amount, decimals }
}
13 => {
let (amount, rest) = rest.split_at(8);
let amount = amount
.try_into()
.ok()
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
let (&decimals, _rest) = rest.split_first().ok_or(InvalidInstruction)?;
Self::ApproveChecked { amount, decimals }
}
14 => {
let (amount, rest) = rest.split_at(8);
let amount = amount
.try_into()
.ok()
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
let (&decimals, _rest) = rest.split_first().ok_or(InvalidInstruction)?;
Self::MintToChecked { amount, decimals }
}
15 => {
let (amount, rest) = rest.split_at(8);
let amount = amount
.try_into()
.ok()
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
let (&decimals, _rest) = rest.split_first().ok_or(InvalidInstruction)?;
Self::BurnChecked { amount, decimals }
}
16 => {
let (owner, _rest) = Self::unpack_pubkey(rest)?;
Self::InitializeAccount2 { owner }
}
17 => Self::SyncNative,
18 => {
let (owner, _rest) = Self::unpack_pubkey(rest)?;
Self::InitializeAccount3 { owner }
}
19 => {
let &m = rest.first().ok_or(InvalidInstruction)?;
Self::InitializeMultisig2 { m }
}
20 => {
let (&decimals, rest) = rest.split_first().ok_or(InvalidInstruction)?;
let (mint_authority, rest) = Self::unpack_pubkey(rest)?;
let (freeze_authority, _rest) = Self::unpack_pubkey_option(rest)?;
Self::InitializeMint2 {
mint_authority,
freeze_authority,
decimals,
}
}
21 => Self::GetAccountDataSize,
22 => Self::InitializeImmutableOwner,
23 => {
let (amount, _rest) = rest.split_at(8);
let amount = amount
.try_into()
.ok()
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
Self::AmountToUiAmount { amount }
}
24 => {
let ui_amount = std::str::from_utf8(rest).map_err(|_| InvalidInstruction)?;
Self::UiAmountToAmount { ui_amount }
}
_ => return Err(TokenError::InvalidInstruction.into()),
})
}
/// Packs a [TokenInstruction](enum.TokenInstruction.html) into a byte buffer.
pub fn pack(&self) -> Vec<u8> {
let mut buf = Vec::with_capacity(size_of::<Self>());
match self {
&Self::InitializeMint {
ref mint_authority,
ref freeze_authority,
decimals,
} => {
buf.push(0);
buf.push(decimals);
buf.extend_from_slice(mint_authority.as_ref());
Self::pack_pubkey_option(freeze_authority, &mut buf);
}
Self::InitializeAccount => buf.push(1),
&Self::InitializeMultisig { m } => {
buf.push(2);
buf.push(m);
}
&Self::Transfer { amount } => {
buf.push(3);
buf.extend_from_slice(&amount.to_le_bytes());
}
&Self::Approve { amount } => {
buf.push(4);
buf.extend_from_slice(&amount.to_le_bytes());
}
&Self::MintTo { amount } => {
buf.push(7);
buf.extend_from_slice(&amount.to_le_bytes());
}
&Self::Burn { amount } => {
buf.push(8);
buf.extend_from_slice(&amount.to_le_bytes());
}
Self::Revoke => buf.push(5),
Self::SetAuthority {
authority_type,
ref new_authority,
} => {
buf.push(6);
buf.push(authority_type.into());
Self::pack_pubkey_option(new_authority, &mut buf);
}
Self::CloseAccount => buf.push(9),
Self::FreezeAccount => buf.push(10),
Self::ThawAccount => buf.push(11),
&Self::TransferChecked { amount, decimals } => {
buf.push(12);
buf.extend_from_slice(&amount.to_le_bytes());
buf.push(decimals);
}
&Self::ApproveChecked { amount, decimals } => {
buf.push(13);
buf.extend_from_slice(&amount.to_le_bytes());
buf.push(decimals);
}
&Self::MintToChecked { amount, decimals } => {
buf.push(14);
buf.extend_from_slice(&amount.to_le_bytes());
buf.push(decimals);
}
&Self::BurnChecked { amount, decimals } => {
buf.push(15);
buf.extend_from_slice(&amount.to_le_bytes());
buf.push(decimals);
}
&Self::InitializeAccount2 { owner } => {
buf.push(16);
buf.extend_from_slice(owner.as_ref());
}
&Self::SyncNative => {
buf.push(17);
}
&Self::InitializeAccount3 { owner } => {
buf.push(18);
buf.extend_from_slice(owner.as_ref());
}
&Self::InitializeMultisig2 { m } => {
buf.push(19);
buf.push(m);
}
&Self::InitializeMint2 {
ref mint_authority,
ref freeze_authority,
decimals,
} => {
buf.push(20);
buf.push(decimals);
buf.extend_from_slice(mint_authority.as_ref());
Self::pack_pubkey_option(freeze_authority, &mut buf);
}
&Self::GetAccountDataSize => {
buf.push(21);
}
&Self::InitializeImmutableOwner => {
buf.push(22);
}
&Self::AmountToUiAmount { amount } => {
buf.push(23);
buf.extend_from_slice(&amount.to_le_bytes());
}
Self::UiAmountToAmount { ui_amount } => {
buf.push(24);
buf.extend_from_slice(ui_amount.as_bytes());
}
};
buf
}
fn unpack_pubkey(input: &[u8]) -> Result<(Pubkey, &[u8]), ProgramError> {
if input.len() >= 32 {
let (key, rest) = input.split_at(32);
let pk = Pubkey::try_from(key).unwrap();
Ok((pk, rest))
} else {
Err(TokenError::InvalidInstruction.into())
}
}
fn unpack_pubkey_option(input: &[u8]) -> Result<(COption<Pubkey>, &[u8]), ProgramError> {
match input.split_first() {
Option::Some((&0, rest)) => Ok((COption::None, rest)),
Option::Some((&1, rest)) if rest.len() >= 32 => {
let (key, rest) = rest.split_at(32);
let pk = Pubkey::try_from(key).unwrap();
Ok((COption::Some(pk), rest))
}
_ => Err(TokenError::InvalidInstruction.into()),
}
}
fn pack_pubkey_option(value: &COption<Pubkey>, buf: &mut Vec<u8>) {
match *value {
COption::Some(ref key) => {
buf.push(1);
buf.extend_from_slice(&key.to_bytes());
}
COption::None => buf.push(0),
}
}
}
/// Specifies the authority type for SetAuthority instructions
#[repr(u8)]
#[derive(Clone, Debug, PartialEq)]
pub enum AuthorityType {
/// Authority to mint new tokens
MintTokens,
/// Authority to freeze any account associated with the Mint
FreezeAccount,
/// Owner of a given token account
AccountOwner,
/// Authority to close a token account
CloseAccount,
}
impl AuthorityType {
fn into(&self) -> u8 {
match self {
AuthorityType::MintTokens => 0,
AuthorityType::FreezeAccount => 1,
AuthorityType::AccountOwner => 2,
AuthorityType::CloseAccount => 3,
}
}
fn from(index: u8) -> Result<Self, ProgramError> {
match index {
0 => Ok(AuthorityType::MintTokens),
1 => Ok(AuthorityType::FreezeAccount),
2 => Ok(AuthorityType::AccountOwner),
3 => Ok(AuthorityType::CloseAccount),
_ => Err(TokenError::InvalidInstruction.into()),
}
}
}
/// Creates a `InitializeMint` instruction.
pub fn initialize_mint(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
mint_authority_pubkey: &Pubkey,
freeze_authority_pubkey: Option<&Pubkey>,
decimals: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let freeze_authority = freeze_authority_pubkey.cloned().into();
let data = TokenInstruction::InitializeMint {
mint_authority: *mint_authority_pubkey,
freeze_authority,
decimals,
}
.pack();
let accounts = vec![
AccountMeta::new(*mint_pubkey, false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `InitializeMint2` instruction.
pub fn initialize_mint2(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
mint_authority_pubkey: &Pubkey,
freeze_authority_pubkey: Option<&Pubkey>,
decimals: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let freeze_authority = freeze_authority_pubkey.cloned().into();
let data = TokenInstruction::InitializeMint2 {
mint_authority: *mint_authority_pubkey,
freeze_authority,
decimals,
}
.pack();
let accounts = vec![AccountMeta::new(*mint_pubkey, false)];
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `InitializeAccount` instruction.
pub fn initialize_account(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::InitializeAccount.pack();
let accounts = vec![
AccountMeta::new(*account_pubkey, false),
AccountMeta::new_readonly(*mint_pubkey, false),
AccountMeta::new_readonly(*owner_pubkey, false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `InitializeAccount2` instruction.
pub fn initialize_account2(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::InitializeAccount2 {
owner: *owner_pubkey,
}
.pack();
let accounts = vec![
AccountMeta::new(*account_pubkey, false),
AccountMeta::new_readonly(*mint_pubkey, false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
];
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `InitializeAccount3` instruction.
pub fn initialize_account3(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::InitializeAccount3 {
owner: *owner_pubkey,
}
.pack();
let accounts = vec![
AccountMeta::new(*account_pubkey, false),
AccountMeta::new_readonly(*mint_pubkey, false),
];
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `InitializeMultisig` instruction.
pub fn initialize_multisig(
token_program_id: &Pubkey,
multisig_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
m: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
if !is_valid_signer_index(m as usize)
|| !is_valid_signer_index(signer_pubkeys.len())
|| m as usize > signer_pubkeys.len()
{
return Err(ProgramError::MissingRequiredSignature);
}
let data = TokenInstruction::InitializeMultisig { m }.pack();
let mut accounts = Vec::with_capacity(1 + 1 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*multisig_pubkey, false));
accounts.push(AccountMeta::new_readonly(sysvar::rent::id(), false));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, false));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `InitializeMultisig2` instruction.
pub fn initialize_multisig2(
token_program_id: &Pubkey,
multisig_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
m: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
if !is_valid_signer_index(m as usize)
|| !is_valid_signer_index(signer_pubkeys.len())
|| m as usize > signer_pubkeys.len()
{
return Err(ProgramError::MissingRequiredSignature);
}
let data = TokenInstruction::InitializeMultisig2 { m }.pack();
let mut accounts = Vec::with_capacity(1 + 1 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*multisig_pubkey, false));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, false));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `Transfer` instruction.
pub fn transfer(
token_program_id: &Pubkey,
source_pubkey: &Pubkey,
destination_pubkey: &Pubkey,
authority_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::Transfer { amount }.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*source_pubkey, false));
accounts.push(AccountMeta::new(*destination_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*authority_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates an `Approve` instruction.
pub fn approve(
token_program_id: &Pubkey,
source_pubkey: &Pubkey,
delegate_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::Approve { amount }.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*source_pubkey, false));
accounts.push(AccountMeta::new_readonly(*delegate_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `Revoke` instruction.
pub fn revoke(
token_program_id: &Pubkey,
source_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::Revoke.pack();
let mut accounts = Vec::with_capacity(2 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*source_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `SetAuthority` instruction.
pub fn set_authority(
token_program_id: &Pubkey,
owned_pubkey: &Pubkey,
new_authority_pubkey: Option<&Pubkey>,
authority_type: AuthorityType,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let new_authority = new_authority_pubkey.cloned().into();
let data = TokenInstruction::SetAuthority {
authority_type,
new_authority,
}
.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*owned_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `MintTo` instruction.
pub fn mint_to(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
account_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::MintTo { amount }.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*mint_pubkey, false));
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `Burn` instruction.
pub fn burn(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
authority_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::Burn { amount }.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new(*mint_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*authority_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `CloseAccount` instruction.
pub fn close_account(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
destination_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::CloseAccount.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new(*destination_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `FreezeAccount` instruction.
pub fn freeze_account(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::FreezeAccount.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new_readonly(*mint_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `ThawAccount` instruction.
pub fn thaw_account(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::ThawAccount.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new_readonly(*mint_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `TransferChecked` instruction.
#[allow(clippy::too_many_arguments)]
pub fn transfer_checked(
token_program_id: &Pubkey,
source_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
destination_pubkey: &Pubkey,
authority_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
decimals: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::TransferChecked { amount, decimals }.pack();
let mut accounts = Vec::with_capacity(4 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*source_pubkey, false));
accounts.push(AccountMeta::new_readonly(*mint_pubkey, false));
accounts.push(AccountMeta::new(*destination_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*authority_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates an `ApproveChecked` instruction.
#[allow(clippy::too_many_arguments)]
pub fn approve_checked(
token_program_id: &Pubkey,
source_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
delegate_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
decimals: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::ApproveChecked { amount, decimals }.pack();
let mut accounts = Vec::with_capacity(4 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*source_pubkey, false));
accounts.push(AccountMeta::new_readonly(*mint_pubkey, false));
accounts.push(AccountMeta::new_readonly(*delegate_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `MintToChecked` instruction.
pub fn mint_to_checked(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
account_pubkey: &Pubkey,
owner_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
decimals: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::MintToChecked { amount, decimals }.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*mint_pubkey, false));
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `BurnChecked` instruction.
pub fn burn_checked(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
mint_pubkey: &Pubkey,
authority_pubkey: &Pubkey,
signer_pubkeys: &[&Pubkey],
amount: u64,
decimals: u8,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
let data = TokenInstruction::BurnChecked { amount, decimals }.pack();
let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len());
accounts.push(AccountMeta::new(*account_pubkey, false));
accounts.push(AccountMeta::new(*mint_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*authority_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}
Ok(Instruction {
program_id: *token_program_id,
accounts,
data,
})
}
/// Creates a `SyncNative` instruction
pub fn sync_native(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
Ok(Instruction {
program_id: *token_program_id,
accounts: vec![AccountMeta::new(*account_pubkey, false)],
data: TokenInstruction::SyncNative.pack(),
})
}
/// Creates a `GetAccountDataSize` instruction
pub fn get_account_data_size(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
Ok(Instruction {
program_id: *token_program_id,
accounts: vec![AccountMeta::new_readonly(*mint_pubkey, false)],
data: TokenInstruction::GetAccountDataSize.pack(),
})
}
/// Creates a `InitializeImmutableOwner` instruction
pub fn initialize_immutable_owner(
token_program_id: &Pubkey,
account_pubkey: &Pubkey,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
Ok(Instruction {
program_id: *token_program_id,
accounts: vec![AccountMeta::new(*account_pubkey, false)],
data: TokenInstruction::InitializeImmutableOwner.pack(),
})
}
/// Creates an `AmountToUiAmount` instruction
pub fn amount_to_ui_amount(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
amount: u64,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
Ok(Instruction {
program_id: *token_program_id,
accounts: vec![AccountMeta::new_readonly(*mint_pubkey, false)],
data: TokenInstruction::AmountToUiAmount { amount }.pack(),
})
}
/// Creates a `UiAmountToAmount` instruction
pub fn ui_amount_to_amount(
token_program_id: &Pubkey,
mint_pubkey: &Pubkey,
ui_amount: &str,
) -> Result<Instruction, ProgramError> {
check_program_account(token_program_id)?;
Ok(Instruction {
program_id: *token_program_id,
accounts: vec![AccountMeta::new_readonly(*mint_pubkey, false)],
data: TokenInstruction::UiAmountToAmount { ui_amount }.pack(),
})
}
/// Utility function that checks index is between MIN_SIGNERS and MAX_SIGNERS
pub fn is_valid_signer_index(index: usize) -> bool {
(MIN_SIGNERS..=MAX_SIGNERS).contains(&index)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_associated_token_account/mod.rs
|
//! Convention for associating token accounts with a user wallet
#![deny(missing_docs)]
#![forbid(unsafe_code)]
// mod entrypoint;
// pub mod error;
pub mod instruction;
// pub mod processor;
// pub mod tools;
use solana_sdk::{
declare_id,
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
system_program, sysvar,
};
use crate::program::spl_token;
declare_id!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
pub(crate) fn get_associated_token_address_and_bump_seed(
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
program_id: &Pubkey,
token_program_id: &Pubkey,
) -> (Pubkey, u8) {
get_associated_token_address_and_bump_seed_internal(
wallet_address,
token_mint_address,
program_id,
token_program_id,
)
}
/// Derives the associated token account address for the given wallet address and token mint
pub fn get_associated_token_address(
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
) -> Pubkey {
get_associated_token_address_with_program_id(
wallet_address,
token_mint_address,
&spl_token::id(),
)
}
/// Derives the associated token account address for the given wallet address, token mint and token program id
pub fn get_associated_token_address_with_program_id(
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
token_program_id: &Pubkey,
) -> Pubkey {
get_associated_token_address_and_bump_seed(
wallet_address,
token_mint_address,
&id(),
token_program_id,
)
.0
}
fn get_associated_token_address_and_bump_seed_internal(
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
program_id: &Pubkey,
token_program_id: &Pubkey,
) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[
&wallet_address.to_bytes(),
&token_program_id.to_bytes(),
&token_mint_address.to_bytes(),
],
program_id,
)
}
/// Create an associated token account for the given wallet address and token mint
///
/// Accounts expected by this instruction:
///
/// 0. `[writeable,signer]` Funding account (must be a system account)
/// 1. `[writeable]` Associated token account address to be created
/// 2. `[]` Wallet address for the new associated token account
/// 3. `[]` The token mint for the new associated token account
/// 4. `[]` System program
/// 5. `[]` SPL Token program
///
#[deprecated(
since = "1.0.5",
note = "please use `instruction::create_associated_token_account` instead"
)]
pub fn create_associated_token_account(
funding_address: &Pubkey,
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
) -> Instruction {
let associated_account_address =
get_associated_token_address(wallet_address, token_mint_address);
Instruction {
program_id: id(),
accounts: vec![
AccountMeta::new(*funding_address, true),
AccountMeta::new(associated_account_address, false),
AccountMeta::new_readonly(*wallet_address, false),
AccountMeta::new_readonly(*token_mint_address, false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(spl_token::id(), false),
AccountMeta::new_readonly(sysvar::rent::id(), false),
],
data: vec![],
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_associated_token_account/instruction.rs
|
//! Program instructions
use {
super::{get_associated_token_address_with_program_id, id},
assert_matches::assert_matches,
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
solana_sdk::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
system_program,
},
};
/// Instructions supported by the AssociatedTokenAccount program
#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize, BorshSchema)]
pub enum AssociatedTokenAccountInstruction {
/// Creates an associated token account for the given wallet address and token mint
/// Returns an error if the account exists.
///
/// 0. `[writeable,signer]` Funding account (must be a system account)
/// 1. `[writeable]` Associated token account address to be created
/// 2. `[]` Wallet address for the new associated token account
/// 3. `[]` The token mint for the new associated token account
/// 4. `[]` System program
/// 5. `[]` SPL Token program
Create,
/// Creates an associated token account for the given wallet address and token mint,
/// if it doesn't already exist. Returns an error if the account exists,
/// but with a different owner.
///
/// 0. `[writeable,signer]` Funding account (must be a system account)
/// 1. `[writeable]` Associated token account address to be created
/// 2. `[]` Wallet address for the new associated token account
/// 3. `[]` The token mint for the new associated token account
/// 4. `[]` System program
/// 5. `[]` SPL Token program
CreateIdempotent,
/// Transfers from and closes a nested associated token account: an
/// associated token account owned by an associated token account.
///
/// The tokens are moved from the nested associated token account to the
/// wallet's associated token account, and the nested account lamports are
/// moved to the wallet.
///
/// Note: Nested token accounts are an anti-pattern, and almost always
/// created unintentionally, so this instruction should only be used to
/// recover from errors.
///
/// 0. `[writeable]` Nested associated token account, must be owned by `3`
/// 1. `[]` Token mint for the nested associated token account
/// 2. `[writeable]` Wallet's associated token account
/// 3. `[]` Owner associated token account address, must be owned by `5`
/// 4. `[]` Token mint for the owner associated token account
/// 5. `[writeable, signer]` Wallet address for the owner associated token account
/// 6. `[]` SPL Token program
RecoverNested,
}
fn build_associated_token_account_instruction(
funding_address: &Pubkey,
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
token_program_id: &Pubkey,
instruction: AssociatedTokenAccountInstruction,
) -> Instruction {
let associated_account_address = get_associated_token_address_with_program_id(
wallet_address,
token_mint_address,
token_program_id,
);
// safety check, assert if not a creation instruction
assert_matches!(
instruction,
AssociatedTokenAccountInstruction::Create
| AssociatedTokenAccountInstruction::CreateIdempotent
);
Instruction {
program_id: id(),
accounts: vec![
AccountMeta::new(*funding_address, true),
AccountMeta::new(associated_account_address, false),
AccountMeta::new_readonly(*wallet_address, false),
AccountMeta::new_readonly(*token_mint_address, false),
AccountMeta::new_readonly(system_program::id(), false),
AccountMeta::new_readonly(*token_program_id, false),
],
data: instruction.try_to_vec().unwrap(),
}
}
/// Creates Create instruction
pub fn create_associated_token_account(
funding_address: &Pubkey,
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
token_program_id: &Pubkey,
) -> Instruction {
build_associated_token_account_instruction(
funding_address,
wallet_address,
token_mint_address,
token_program_id,
AssociatedTokenAccountInstruction::Create,
)
}
/// Creates CreateIdempotent instruction
pub fn create_associated_token_account_idempotent(
funding_address: &Pubkey,
wallet_address: &Pubkey,
token_mint_address: &Pubkey,
token_program_id: &Pubkey,
) -> Instruction {
build_associated_token_account_instruction(
funding_address,
wallet_address,
token_mint_address,
token_program_id,
AssociatedTokenAccountInstruction::CreateIdempotent,
)
}
/// Creates a `RecoverNested` instruction
pub fn recover_nested(
wallet_address: &Pubkey,
owner_token_mint_address: &Pubkey,
nested_token_mint_address: &Pubkey,
token_program_id: &Pubkey,
) -> Instruction {
let owner_associated_account_address = get_associated_token_address_with_program_id(
wallet_address,
owner_token_mint_address,
token_program_id,
);
let destination_associated_account_address = get_associated_token_address_with_program_id(
wallet_address,
nested_token_mint_address,
token_program_id,
);
let nested_associated_account_address = get_associated_token_address_with_program_id(
&owner_associated_account_address, // ATA is wrongly used as a wallet_address
nested_token_mint_address,
token_program_id,
);
let instruction_data = AssociatedTokenAccountInstruction::RecoverNested;
Instruction {
program_id: id(),
accounts: vec![
AccountMeta::new(nested_associated_account_address, false),
AccountMeta::new_readonly(*nested_token_mint_address, false),
AccountMeta::new(destination_associated_account_address, false),
AccountMeta::new_readonly(owner_associated_account_address, false),
AccountMeta::new_readonly(*owner_token_mint_address, false),
AccountMeta::new(*wallet_address, true),
AccountMeta::new_readonly(*token_program_id, false),
],
data: instruction_data.try_to_vec().unwrap(),
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/processor.rs
|
//! Program state processor
use {
crate::program::spl_token_2022::{
amount_to_ui_amount_string_trimmed, check_program_account, cmp_pubkeys,
error::TokenError,
extension::{
// TODO:
// confidential_transfer::{self, ConfidentialTransferAccount},
default_account_state::{self, DefaultAccountState},
immutable_owner::ImmutableOwner,
interest_bearing_mint::{self, InterestBearingConfig},
memo_transfer::{self, check_previous_sibling_instruction_is_memo, memo_required},
mint_close_authority::MintCloseAuthority,
non_transferable::NonTransferable,
reallocate,
transfer_fee::{self, TransferFeeAmount, TransferFeeConfig},
ExtensionType,
StateWithExtensions,
StateWithExtensionsMut,
},
instruction::{is_valid_signer_index, AuthorityType, TokenInstruction, MAX_SIGNERS},
native_mint,
state::{Account, AccountState, Mint, Multisig},
try_ui_amount_into_amount,
},
num_traits::FromPrimitive,
solana_sdk::{
account_info::{next_account_info, AccountInfo},
clock::Clock,
decode_error::DecodeError,
entrypoint::ProgramResult,
msg,
program::{invoke, invoke_signed, set_return_data},
program_error::{PrintProgramError, ProgramError},
program_memory::sol_memset,
program_option::COption,
program_pack::Pack,
pubkey::Pubkey,
system_instruction,
sysvar::{rent::Rent, Sysvar},
},
std::convert::{TryFrom, TryInto},
};
/// Program state handler.
pub struct Processor {}
impl Processor {
fn _process_initialize_mint(
accounts: &[AccountInfo],
decimals: u8,
mint_authority: Pubkey,
freeze_authority: COption<Pubkey>,
rent_sysvar_account: bool,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_info = next_account_info(account_info_iter)?;
let mint_data_len = mint_info.data_len();
let mut mint_data = mint_info.data.borrow_mut();
let rent = if rent_sysvar_account {
Rent::from_account_info(next_account_info(account_info_iter)?)?
} else {
Rent::get()?
};
if !rent.is_exempt(mint_info.lamports(), mint_data_len) {
return Err(TokenError::NotRentExempt.into());
}
let mut mint = StateWithExtensionsMut::<Mint>::unpack_uninitialized(&mut mint_data)?;
if mint.base.is_initialized {
return Err(TokenError::AlreadyInUse.into());
}
let extension_types = mint.get_extension_types()?;
if ExtensionType::get_account_len::<Mint>(&extension_types) != mint_data_len {
return Err(ProgramError::InvalidAccountData);
}
if let Ok(default_account_state) = mint.get_extension_mut::<DefaultAccountState>() {
let default_account_state = AccountState::try_from(default_account_state.state)
.or(Err(ProgramError::InvalidAccountData))?;
if default_account_state == AccountState::Frozen && freeze_authority.is_none() {
return Err(TokenError::MintCannotFreeze.into());
}
}
mint.base.mint_authority = COption::Some(mint_authority);
mint.base.decimals = decimals;
mint.base.is_initialized = true;
mint.base.freeze_authority = freeze_authority;
mint.pack_base();
mint.init_account_type()?;
Ok(())
}
/// Processes an [InitializeMint](enum.TokenInstruction.html) instruction.
pub fn process_initialize_mint(
accounts: &[AccountInfo],
decimals: u8,
mint_authority: Pubkey,
freeze_authority: COption<Pubkey>,
) -> ProgramResult {
Self::_process_initialize_mint(accounts, decimals, mint_authority, freeze_authority, true)
}
/// Processes an [InitializeMint2](enum.TokenInstruction.html) instruction.
pub fn process_initialize_mint2(
accounts: &[AccountInfo],
decimals: u8,
mint_authority: Pubkey,
freeze_authority: COption<Pubkey>,
) -> ProgramResult {
Self::_process_initialize_mint(accounts, decimals, mint_authority, freeze_authority, false)
}
fn _process_initialize_account(
accounts: &[AccountInfo],
owner: Option<&Pubkey>,
rent_sysvar_account: bool,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let new_account_info = next_account_info(account_info_iter)?;
let mint_info = next_account_info(account_info_iter)?;
let owner = if let Some(owner) = owner {
owner
} else {
next_account_info(account_info_iter)?.key
};
let new_account_info_data_len = new_account_info.data_len();
let rent = if rent_sysvar_account {
Rent::from_account_info(next_account_info(account_info_iter)?)?
} else {
Rent::get()?
};
let mut account_data = new_account_info.data.borrow_mut();
// unpack_uninitialized checks account.base.is_initialized() under the hood
let mut account =
StateWithExtensionsMut::<Account>::unpack_uninitialized(&mut account_data)?;
if !rent.is_exempt(new_account_info.lamports(), new_account_info_data_len) {
return Err(TokenError::NotRentExempt.into());
}
// get_required_account_extensions checks mint validity
let mint_data = mint_info.data.borrow();
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)
.map_err(|_| Into::<ProgramError>::into(TokenError::InvalidMint))?;
let required_extensions =
Self::get_required_account_extensions_from_unpacked_mint(mint_info.owner, &mint)?;
if ExtensionType::get_account_len::<Account>(&required_extensions)
> new_account_info_data_len
{
return Err(ProgramError::InvalidAccountData);
}
for extension in required_extensions {
account.init_account_extension_from_type(extension)?;
}
let starting_state =
if let Ok(default_account_state) = mint.get_extension::<DefaultAccountState>() {
AccountState::try_from(default_account_state.state)
.or(Err(ProgramError::InvalidAccountData))?
} else {
AccountState::Initialized
};
account.base.mint = *mint_info.key;
account.base.owner = *owner;
account.base.close_authority = COption::None;
account.base.delegate = COption::None;
account.base.delegated_amount = 0;
account.base.state = starting_state;
if cmp_pubkeys(mint_info.key, &native_mint::id()) {
let rent_exempt_reserve = rent.minimum_balance(new_account_info_data_len);
account.base.is_native = COption::Some(rent_exempt_reserve);
account.base.amount = new_account_info
.lamports()
.checked_sub(rent_exempt_reserve)
.ok_or(TokenError::Overflow)?;
} else {
account.base.is_native = COption::None;
account.base.amount = 0;
};
account.pack_base();
account.init_account_type()?;
Ok(())
}
/// Processes an [InitializeAccount](enum.TokenInstruction.html) instruction.
pub fn process_initialize_account(accounts: &[AccountInfo]) -> ProgramResult {
Self::_process_initialize_account(accounts, None, true)
}
/// Processes an [InitializeAccount2](enum.TokenInstruction.html) instruction.
pub fn process_initialize_account2(accounts: &[AccountInfo], owner: Pubkey) -> ProgramResult {
Self::_process_initialize_account(accounts, Some(&owner), true)
}
/// Processes an [InitializeAccount3](enum.TokenInstruction.html) instruction.
pub fn process_initialize_account3(accounts: &[AccountInfo], owner: Pubkey) -> ProgramResult {
Self::_process_initialize_account(accounts, Some(&owner), false)
}
fn _process_initialize_multisig(
accounts: &[AccountInfo],
m: u8,
rent_sysvar_account: bool,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let multisig_info = next_account_info(account_info_iter)?;
let multisig_info_data_len = multisig_info.data_len();
let rent = if rent_sysvar_account {
Rent::from_account_info(next_account_info(account_info_iter)?)?
} else {
Rent::get()?
};
let mut multisig = Multisig::unpack_unchecked(&multisig_info.data.borrow())?;
if multisig.is_initialized {
return Err(TokenError::AlreadyInUse.into());
}
if !rent.is_exempt(multisig_info.lamports(), multisig_info_data_len) {
return Err(TokenError::NotRentExempt.into());
}
let signer_infos = account_info_iter.as_slice();
multisig.m = m;
multisig.n = signer_infos.len() as u8;
if !is_valid_signer_index(multisig.n as usize) {
return Err(TokenError::InvalidNumberOfProvidedSigners.into());
}
if !is_valid_signer_index(multisig.m as usize) {
return Err(TokenError::InvalidNumberOfRequiredSigners.into());
}
for (i, signer_info) in signer_infos.iter().enumerate() {
multisig.signers[i] = *signer_info.key;
}
multisig.is_initialized = true;
Multisig::pack(multisig, &mut multisig_info.data.borrow_mut())?;
Ok(())
}
/// Processes a [InitializeMultisig](enum.TokenInstruction.html) instruction.
pub fn process_initialize_multisig(accounts: &[AccountInfo], m: u8) -> ProgramResult {
Self::_process_initialize_multisig(accounts, m, true)
}
/// Processes a [InitializeMultisig2](enum.TokenInstruction.html) instruction.
pub fn process_initialize_multisig2(accounts: &[AccountInfo], m: u8) -> ProgramResult {
Self::_process_initialize_multisig(accounts, m, false)
}
/// Processes a [Transfer](enum.TokenInstruction.html) instruction.
pub fn process_transfer(
program_id: &Pubkey,
accounts: &[AccountInfo],
amount: u64,
expected_decimals: Option<u8>,
expected_fee: Option<u64>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let expected_mint_info = if let Some(expected_decimals) = expected_decimals {
Some((next_account_info(account_info_iter)?, expected_decimals))
} else {
None
};
let destination_account_info = next_account_info(account_info_iter)?;
let authority_info = next_account_info(account_info_iter)?;
let authority_info_data_len = authority_info.data_len();
let mut source_account_data = source_account_info.data.borrow_mut();
let mut source_account =
StateWithExtensionsMut::<Account>::unpack(&mut source_account_data)?;
if source_account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
if source_account.base.amount < amount {
return Err(TokenError::InsufficientFunds.into());
}
let fee = if let Some((mint_info, expected_decimals)) = expected_mint_info {
if !cmp_pubkeys(&source_account.base.mint, mint_info.key) {
return Err(TokenError::MintMismatch.into());
}
let mint_data = mint_info.try_borrow_data()?;
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)?;
if mint.get_extension::<NonTransferable>().is_ok() {
return Err(TokenError::NonTransferable.into());
}
if expected_decimals != mint.base.decimals {
return Err(TokenError::MintDecimalsMismatch.into());
}
if let Ok(transfer_fee_config) = mint.get_extension::<TransferFeeConfig>() {
transfer_fee_config
.calculate_epoch_fee(Clock::get()?.epoch, amount)
.ok_or(TokenError::Overflow)?
} else {
0
}
} else {
// Transfer fee amount extension exists on the account, but no mint
// was provided to calculate the fee, abort
if source_account
.get_extension_mut::<TransferFeeAmount>()
.is_ok()
{
return Err(TokenError::MintRequiredForTransfer.into());
} else {
0
}
};
if let Some(expected_fee) = expected_fee {
if expected_fee != fee {
msg!("Calculated fee {}, received {}", fee, expected_fee);
return Err(TokenError::FeeMismatch.into());
}
}
let self_transfer = cmp_pubkeys(source_account_info.key, destination_account_info.key);
match source_account.base.delegate {
COption::Some(ref delegate) if cmp_pubkeys(authority_info.key, delegate) => {
Self::validate_owner(
program_id,
delegate,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
if source_account.base.delegated_amount < amount {
return Err(TokenError::InsufficientFunds.into());
}
if !self_transfer {
source_account.base.delegated_amount = source_account
.base
.delegated_amount
.checked_sub(amount)
.ok_or(TokenError::Overflow)?;
if source_account.base.delegated_amount == 0 {
source_account.base.delegate = COption::None;
}
}
}
_ => Self::validate_owner(
program_id,
&source_account.base.owner,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?,
};
// Revisit this later to see if it's worth adding a check to reduce
// compute costs, ie:
// if self_transfer || amount == 0
check_program_account(source_account_info.owner)?;
check_program_account(destination_account_info.owner)?;
// This check MUST occur just before the amounts are manipulated
// to ensure self-transfers are fully validated
if self_transfer {
return Ok(());
}
// self-transfer was dealt with earlier, so this *should* be safe
let mut destination_account_data = destination_account_info.data.borrow_mut();
let mut destination_account =
StateWithExtensionsMut::<Account>::unpack(&mut destination_account_data)?;
if destination_account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
if !cmp_pubkeys(&source_account.base.mint, &destination_account.base.mint) {
return Err(TokenError::MintMismatch.into());
}
if memo_required(&destination_account) {
check_previous_sibling_instruction_is_memo()?;
}
source_account.base.amount = source_account
.base
.amount
.checked_sub(amount)
.ok_or(TokenError::Overflow)?;
let credited_amount = amount.checked_sub(fee).ok_or(TokenError::Overflow)?;
destination_account.base.amount = destination_account
.base
.amount
.checked_add(credited_amount)
.ok_or(TokenError::Overflow)?;
if fee > 0 {
if let Ok(extension) = destination_account.get_extension_mut::<TransferFeeAmount>() {
let new_withheld_amount = u64::from(extension.withheld_amount)
.checked_add(fee)
.ok_or(TokenError::Overflow)?;
extension.withheld_amount = new_withheld_amount.into();
} else {
// Use the generic error since this should never happen. If there's
// a fee, then the mint has a fee configured, which means all accounts
// must have the withholding.
return Err(TokenError::InvalidState.into());
}
}
if source_account.base.is_native() {
let source_starting_lamports = source_account_info.lamports();
**source_account_info.lamports.borrow_mut() = source_starting_lamports
.checked_sub(amount)
.ok_or(TokenError::Overflow)?;
let destination_starting_lamports = destination_account_info.lamports();
**destination_account_info.lamports.borrow_mut() = destination_starting_lamports
.checked_add(amount)
.ok_or(TokenError::Overflow)?;
}
source_account.pack_base();
destination_account.pack_base();
Ok(())
}
/// Processes an [Approve](enum.TokenInstruction.html) instruction.
pub fn process_approve(
program_id: &Pubkey,
accounts: &[AccountInfo],
amount: u64,
expected_decimals: Option<u8>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let expected_mint_info = if let Some(expected_decimals) = expected_decimals {
Some((next_account_info(account_info_iter)?, expected_decimals))
} else {
None
};
let delegate_info = next_account_info(account_info_iter)?;
let owner_info = next_account_info(account_info_iter)?;
let owner_info_data_len = owner_info.data_len();
let mut source_account_data = source_account_info.data.borrow_mut();
let mut source_account =
StateWithExtensionsMut::<Account>::unpack(&mut source_account_data)?;
if source_account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
if let Some((mint_info, expected_decimals)) = expected_mint_info {
if !cmp_pubkeys(&source_account.base.mint, mint_info.key) {
return Err(TokenError::MintMismatch.into());
}
let mint_data = mint_info.data.borrow();
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)?;
if expected_decimals != mint.base.decimals {
return Err(TokenError::MintDecimalsMismatch.into());
}
}
Self::validate_owner(
program_id,
&source_account.base.owner,
owner_info,
owner_info_data_len,
account_info_iter.as_slice(),
)?;
source_account.base.delegate = COption::Some(*delegate_info.key);
source_account.base.delegated_amount = amount;
source_account.pack_base();
Ok(())
}
/// Processes an [Revoke](enum.TokenInstruction.html) instruction.
pub fn process_revoke(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let authority_info = next_account_info(account_info_iter)?;
let authority_info_data_len = authority_info.data_len();
let mut source_account_data = source_account_info.data.borrow_mut();
let mut source_account =
StateWithExtensionsMut::<Account>::unpack(&mut source_account_data)?;
if source_account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
Self::validate_owner(
program_id,
match source_account.base.delegate {
COption::Some(ref delegate) if cmp_pubkeys(authority_info.key, delegate) => {
delegate
}
_ => &source_account.base.owner,
},
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
source_account.base.delegate = COption::None;
source_account.base.delegated_amount = 0;
source_account.pack_base();
Ok(())
}
/// Processes a [SetAuthority](enum.TokenInstruction.html) instruction.
pub fn process_set_authority(
program_id: &Pubkey,
accounts: &[AccountInfo],
authority_type: AuthorityType,
new_authority: COption<Pubkey>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let account_info = next_account_info(account_info_iter)?;
let authority_info = next_account_info(account_info_iter)?;
let authority_info_data_len = authority_info.data_len();
let mut account_data = account_info.data.borrow_mut();
if let Ok(mut account) = StateWithExtensionsMut::<Account>::unpack(&mut account_data) {
if account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
match authority_type {
AuthorityType::AccountOwner => {
Self::validate_owner(
program_id,
&account.base.owner,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
if account.get_extension_mut::<ImmutableOwner>().is_ok() {
return Err(TokenError::ImmutableOwner.into());
}
if let COption::Some(authority) = new_authority {
account.base.owner = authority;
} else {
return Err(TokenError::InvalidInstruction.into());
}
account.base.delegate = COption::None;
account.base.delegated_amount = 0;
if account.base.is_native() {
account.base.close_authority = COption::None;
}
}
AuthorityType::CloseAccount => {
let authority = account.base.close_authority.unwrap_or(account.base.owner);
Self::validate_owner(
program_id,
&authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
account.base.close_authority = new_authority;
}
_ => {
return Err(TokenError::AuthorityTypeNotSupported.into());
}
}
account.pack_base();
} else if let Ok(mut mint) = StateWithExtensionsMut::<Mint>::unpack(&mut account_data) {
match authority_type {
AuthorityType::MintTokens => {
// Once a mint's supply is fixed, it cannot be undone by setting a new
// mint_authority
let mint_authority = mint
.base
.mint_authority
.ok_or(Into::<ProgramError>::into(TokenError::FixedSupply))?;
Self::validate_owner(
program_id,
&mint_authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
mint.base.mint_authority = new_authority;
mint.pack_base();
}
AuthorityType::FreezeAccount => {
// Once a mint's freeze authority is disabled, it cannot be re-enabled by
// setting a new freeze_authority
let freeze_authority = mint
.base
.freeze_authority
.ok_or(Into::<ProgramError>::into(TokenError::MintCannotFreeze))?;
Self::validate_owner(
program_id,
&freeze_authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
mint.base.freeze_authority = new_authority;
mint.pack_base();
}
AuthorityType::CloseMint => {
let extension = mint.get_extension_mut::<MintCloseAuthority>()?;
let maybe_close_authority: Option<Pubkey> = extension.close_authority.into();
let close_authority =
maybe_close_authority.ok_or(TokenError::AuthorityTypeNotSupported)?;
Self::validate_owner(
program_id,
&close_authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
extension.close_authority = new_authority.try_into()?;
}
AuthorityType::TransferFeeConfig => {
let extension = mint.get_extension_mut::<TransferFeeConfig>()?;
let maybe_transfer_fee_config_authority: Option<Pubkey> =
extension.transfer_fee_config_authority.into();
let transfer_fee_config_authority = maybe_transfer_fee_config_authority
.ok_or(TokenError::AuthorityTypeNotSupported)?;
Self::validate_owner(
program_id,
&transfer_fee_config_authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
extension.transfer_fee_config_authority = new_authority.try_into()?;
}
AuthorityType::WithheldWithdraw => {
let extension = mint.get_extension_mut::<TransferFeeConfig>()?;
let maybe_withdraw_withheld_authority: Option<Pubkey> =
extension.withdraw_withheld_authority.into();
let withdraw_withheld_authority = maybe_withdraw_withheld_authority
.ok_or(TokenError::AuthorityTypeNotSupported)?;
Self::validate_owner(
program_id,
&withdraw_withheld_authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
extension.withdraw_withheld_authority = new_authority.try_into()?;
}
AuthorityType::InterestRate => {
let extension = mint.get_extension_mut::<InterestBearingConfig>()?;
let maybe_rate_authority: Option<Pubkey> = extension.rate_authority.into();
let rate_authority =
maybe_rate_authority.ok_or(TokenError::AuthorityTypeNotSupported)?;
Self::validate_owner(
program_id,
&rate_authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
extension.rate_authority = new_authority.try_into()?;
}
_ => {
return Err(TokenError::AuthorityTypeNotSupported.into());
}
}
} else {
return Err(ProgramError::InvalidAccountData);
}
Ok(())
}
/// Processes a [MintTo](enum.TokenInstruction.html) instruction.
pub fn process_mint_to(
program_id: &Pubkey,
accounts: &[AccountInfo],
amount: u64,
expected_decimals: Option<u8>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_info = next_account_info(account_info_iter)?;
let destination_account_info = next_account_info(account_info_iter)?;
let owner_info = next_account_info(account_info_iter)?;
let owner_info_data_len = owner_info.data_len();
let mut destination_account_data = destination_account_info.data.borrow_mut();
let mut destination_account =
StateWithExtensionsMut::<Account>::unpack(&mut destination_account_data)?;
if destination_account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
if destination_account.base.is_native() {
return Err(TokenError::NativeNotSupported.into());
}
if !cmp_pubkeys(mint_info.key, &destination_account.base.mint) {
return Err(TokenError::MintMismatch.into());
}
let mut mint_data = mint_info.data.borrow_mut();
let mut mint = StateWithExtensionsMut::<Mint>::unpack(&mut mint_data)?;
// If the mint if non-transferable, only allow minting to accounts
// with immutable ownership.
if mint.get_extension::<NonTransferable>().is_ok()
&& destination_account
.get_extension::<ImmutableOwner>()
.is_err()
{
return Err(TokenError::NonTransferableNeedsImmutableOwnership.into());
}
if let Some(expected_decimals) = expected_decimals {
if expected_decimals != mint.base.decimals {
return Err(TokenError::MintDecimalsMismatch.into());
}
}
match mint.base.mint_authority {
COption::Some(mint_authority) => Self::validate_owner(
program_id,
&mint_authority,
owner_info,
owner_info_data_len,
account_info_iter.as_slice(),
)?,
COption::None => return Err(TokenError::FixedSupply.into()),
}
// Revisit this later to see if it's worth adding a check to reduce
// compute costs, ie:
// if amount == 0
check_program_account(mint_info.owner)?;
check_program_account(destination_account_info.owner)?;
destination_account.base.amount = destination_account
.base
.amount
.checked_add(amount)
.ok_or(TokenError::Overflow)?;
mint.base.supply = mint
.base
.supply
.checked_add(amount)
.ok_or(TokenError::Overflow)?;
mint.pack_base();
destination_account.pack_base();
Ok(())
}
/// Processes a [Burn](enum.TokenInstruction.html) instruction.
pub fn process_burn(
program_id: &Pubkey,
accounts: &[AccountInfo],
amount: u64,
expected_decimals: Option<u8>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let mint_info = next_account_info(account_info_iter)?;
let authority_info = next_account_info(account_info_iter)?;
let authority_info_data_len = authority_info.data_len();
let mut source_account_data = source_account_info.data.borrow_mut();
let mut source_account =
StateWithExtensionsMut::<Account>::unpack(&mut source_account_data)?;
let mut mint_data = mint_info.data.borrow_mut();
let mut mint = StateWithExtensionsMut::<Mint>::unpack(&mut mint_data)?;
if source_account.base.is_frozen() {
return Err(TokenError::AccountFrozen.into());
}
if source_account.base.is_native() {
return Err(TokenError::NativeNotSupported.into());
}
if source_account.base.amount < amount {
return Err(TokenError::InsufficientFunds.into());
}
if mint_info.key != &source_account.base.mint {
return Err(TokenError::MintMismatch.into());
}
if let Some(expected_decimals) = expected_decimals {
if expected_decimals != mint.base.decimals {
return Err(TokenError::MintDecimalsMismatch.into());
}
}
if !source_account
.base
.is_owned_by_system_program_or_incinerator()
{
match source_account.base.delegate {
COption::Some(ref delegate) if cmp_pubkeys(authority_info.key, delegate) => {
Self::validate_owner(
program_id,
delegate,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
if source_account.base.delegated_amount < amount {
return Err(TokenError::InsufficientFunds.into());
}
source_account.base.delegated_amount = source_account
.base
.delegated_amount
.checked_sub(amount)
.ok_or(TokenError::Overflow)?;
if source_account.base.delegated_amount == 0 {
source_account.base.delegate = COption::None;
}
}
_ => Self::validate_owner(
program_id,
&source_account.base.owner,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?,
}
}
// Revisit this later to see if it's worth adding a check to reduce
// compute costs, ie:
// if amount == 0
check_program_account(source_account_info.owner)?;
check_program_account(mint_info.owner)?;
source_account.base.amount = source_account
.base
.amount
.checked_sub(amount)
.ok_or(TokenError::Overflow)?;
mint.base.supply = mint
.base
.supply
.checked_sub(amount)
.ok_or(TokenError::Overflow)?;
source_account.pack_base();
mint.pack_base();
Ok(())
}
/// Processes a [CloseAccount](enum.TokenInstruction.html) instruction.
pub fn process_close_account(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let destination_account_info = next_account_info(account_info_iter)?;
let authority_info = next_account_info(account_info_iter)?;
let authority_info_data_len = authority_info.data_len();
if cmp_pubkeys(source_account_info.key, destination_account_info.key) {
return Err(ProgramError::InvalidAccountData);
}
let mut source_account_data = source_account_info.data.borrow_mut();
if let Ok(source_account) = StateWithExtensions::<Account>::unpack(&source_account_data) {
if !source_account.base.is_native() && source_account.base.amount != 0 {
return Err(TokenError::NonNativeHasBalance.into());
}
let authority = source_account
.base
.close_authority
.unwrap_or(source_account.base.owner);
if !source_account
.base
.is_owned_by_system_program_or_incinerator()
{
Self::validate_owner(
program_id,
&authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
} else if !solana_sdk::incinerator::check_id(destination_account_info.key) {
return Err(ProgramError::InvalidAccountData);
}
// TODO:
// if let Ok(confidential_transfer_state) =
// source_account.get_extension::<ConfidentialTransferAccount>()
// {
// confidential_transfer_state.closable()?
// }
if let Ok(transfer_fee_state) = source_account.get_extension::<TransferFeeAmount>() {
transfer_fee_state.closable()?
}
} else if let Ok(mint) = StateWithExtensions::<Mint>::unpack(&source_account_data) {
let extension = mint.get_extension::<MintCloseAuthority>()?;
let maybe_authority: Option<Pubkey> = extension.close_authority.into();
let authority = maybe_authority.ok_or(TokenError::AuthorityTypeNotSupported)?;
Self::validate_owner(
program_id,
&authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
)?;
if mint.base.supply != 0 {
return Err(TokenError::MintHasSupply.into());
}
} else {
return Err(ProgramError::UninitializedAccount);
}
let destination_starting_lamports = destination_account_info.lamports();
**destination_account_info.lamports.borrow_mut() = destination_starting_lamports
.checked_add(source_account_info.lamports())
.ok_or(TokenError::Overflow)?;
**source_account_info.lamports.borrow_mut() = 0;
let data_len = source_account_data.len();
sol_memset(*source_account_data, 0, data_len);
Ok(())
}
/// Processes a [FreezeAccount](enum.TokenInstruction.html) or a
/// [ThawAccount](enum.TokenInstruction.html) instruction.
pub fn process_toggle_freeze_account(
program_id: &Pubkey,
accounts: &[AccountInfo],
freeze: bool,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let source_account_info = next_account_info(account_info_iter)?;
let mint_info = next_account_info(account_info_iter)?;
let authority_info = next_account_info(account_info_iter)?;
let authority_info_data_len = authority_info.data_len();
let mut source_account_data = source_account_info.data.borrow_mut();
let mut source_account =
StateWithExtensionsMut::<Account>::unpack(&mut source_account_data)?;
if freeze && source_account.base.is_frozen() || !freeze && !source_account.base.is_frozen()
{
return Err(TokenError::InvalidState.into());
}
if source_account.base.is_native() {
return Err(TokenError::NativeNotSupported.into());
}
if !cmp_pubkeys(mint_info.key, &source_account.base.mint) {
return Err(TokenError::MintMismatch.into());
}
let mint_data = mint_info.data.borrow();
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)?;
match mint.base.freeze_authority {
COption::Some(authority) => Self::validate_owner(
program_id,
&authority,
authority_info,
authority_info_data_len,
account_info_iter.as_slice(),
),
COption::None => Err(TokenError::MintCannotFreeze.into()),
}?;
source_account.base.state = if freeze {
AccountState::Frozen
} else {
AccountState::Initialized
};
source_account.pack_base();
Ok(())
}
/// Processes a [SyncNative](enum.TokenInstruction.html) instruction
pub fn process_sync_native(accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let native_account_info = next_account_info(account_info_iter)?;
check_program_account(native_account_info.owner)?;
let mut native_account_data = native_account_info.data.borrow_mut();
let mut native_account =
StateWithExtensionsMut::<Account>::unpack(&mut native_account_data)?;
if let COption::Some(rent_exempt_reserve) = native_account.base.is_native {
let new_amount = native_account_info
.lamports()
.checked_sub(rent_exempt_reserve)
.ok_or(TokenError::Overflow)?;
if new_amount < native_account.base.amount {
return Err(TokenError::InvalidState.into());
}
native_account.base.amount = new_amount;
} else {
return Err(TokenError::NonNativeNotSupported.into());
}
native_account.pack_base();
Ok(())
}
/// Processes an [InitializeMintCloseAuthority](enum.TokenInstruction.html) instruction
pub fn process_initialize_mint_close_authority(
accounts: &[AccountInfo],
close_authority: COption<Pubkey>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_account_info = next_account_info(account_info_iter)?;
let mut mint_data = mint_account_info.data.borrow_mut();
let mut mint = StateWithExtensionsMut::<Mint>::unpack_uninitialized(&mut mint_data)?;
let extension = mint.init_extension::<MintCloseAuthority>(true)?;
extension.close_authority = close_authority.try_into()?;
Ok(())
}
/// Processes a [GetAccountDataSize](enum.TokenInstruction.html) instruction
pub fn process_get_account_data_size(
accounts: &[AccountInfo],
new_extension_types: Vec<ExtensionType>,
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_account_info = next_account_info(account_info_iter)?;
let mut account_extensions = Self::get_required_account_extensions(mint_account_info)?;
// ExtensionType::get_account_len() dedupes types, so just a dumb concatenation is fine
// here
account_extensions.extend_from_slice(&new_extension_types);
let account_len = ExtensionType::get_account_len::<Account>(&account_extensions);
set_return_data(&account_len.to_le_bytes());
Ok(())
}
/// Processes an [InitializeImmutableOwner](enum.TokenInstruction.html) instruction
pub fn process_initialize_immutable_owner(accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let token_account_info = next_account_info(account_info_iter)?;
let token_account_data = &mut token_account_info.data.borrow_mut();
let mut token_account =
StateWithExtensionsMut::<Account>::unpack_uninitialized(token_account_data)?;
token_account
.init_extension::<ImmutableOwner>(true)
.map(|_| ())
}
/// Processes an [AmountToUiAmount](enum.TokenInstruction.html) instruction
pub fn process_amount_to_ui_amount(accounts: &[AccountInfo], amount: u64) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_info = next_account_info(account_info_iter)?;
check_program_account(mint_info.owner)?;
let mint_data = mint_info.data.borrow();
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)
.map_err(|_| Into::<ProgramError>::into(TokenError::InvalidMint))?;
let ui_amount = if let Ok(extension) = mint.get_extension::<InterestBearingConfig>() {
let unix_timestamp = Clock::get()?.unix_timestamp;
extension
.amount_to_ui_amount(amount, mint.base.decimals, unix_timestamp)
.ok_or(ProgramError::InvalidArgument)?
} else {
amount_to_ui_amount_string_trimmed(amount, mint.base.decimals)
};
set_return_data(&ui_amount.into_bytes());
Ok(())
}
/// Processes an [AmountToUiAmount](enum.TokenInstruction.html) instruction
pub fn process_ui_amount_to_amount(accounts: &[AccountInfo], ui_amount: &str) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_info = next_account_info(account_info_iter)?;
check_program_account(mint_info.owner)?;
let mint_data = mint_info.data.borrow();
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)
.map_err(|_| Into::<ProgramError>::into(TokenError::InvalidMint))?;
let amount = if let Ok(extension) = mint.get_extension::<InterestBearingConfig>() {
let unix_timestamp = Clock::get()?.unix_timestamp;
extension.try_ui_amount_into_amount(ui_amount, mint.base.decimals, unix_timestamp)?
} else {
try_ui_amount_into_amount(ui_amount.to_string(), mint.base.decimals)?
};
set_return_data(&amount.to_le_bytes());
Ok(())
}
/// Processes a [CreateNativeMint](enum.TokenInstruction.html) instruction
pub fn process_create_native_mint(accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let payer_info = next_account_info(account_info_iter)?;
let native_mint_info = next_account_info(account_info_iter)?;
let system_program_info = next_account_info(account_info_iter)?;
if *native_mint_info.key != native_mint::id() {
return Err(TokenError::InvalidMint.into());
}
let rent = Rent::get()?;
let new_minimum_balance = rent.minimum_balance(Mint::get_packed_len());
let lamports_diff = new_minimum_balance.saturating_sub(native_mint_info.lamports());
invoke(
&system_instruction::transfer(payer_info.key, native_mint_info.key, lamports_diff),
&[
payer_info.clone(),
native_mint_info.clone(),
system_program_info.clone(),
],
)?;
invoke_signed(
&system_instruction::allocate(native_mint_info.key, Mint::get_packed_len() as u64),
&[native_mint_info.clone(), system_program_info.clone()],
&[native_mint::PROGRAM_ADDRESS_SEEDS],
)?;
invoke_signed(
&system_instruction::assign(
native_mint_info.key,
&crate::program::spl_token_2022::id(),
),
&[native_mint_info.clone(), system_program_info.clone()],
&[native_mint::PROGRAM_ADDRESS_SEEDS],
)?;
Mint::pack(
Mint {
decimals: native_mint::DECIMALS,
is_initialized: true,
..Mint::default()
},
&mut native_mint_info.data.borrow_mut(),
)
}
/// Processes an [InitializeNonTransferableMint](enum.TokenInstruction.html) instruction
pub fn process_initialize_non_transferable_mint(accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
let mint_account_info = next_account_info(account_info_iter)?;
let mut mint_data = mint_account_info.data.borrow_mut();
let mut mint = StateWithExtensionsMut::<Mint>::unpack_uninitialized(&mut mint_data)?;
mint.init_extension::<NonTransferable>(true)?;
Ok(())
}
/// Processes an [Instruction](enum.Instruction.html).
pub fn process(program_id: &Pubkey, accounts: &[AccountInfo], input: &[u8]) -> ProgramResult {
let instruction = TokenInstruction::unpack(input)?;
match instruction {
TokenInstruction::InitializeMint {
decimals,
mint_authority,
freeze_authority,
} => {
msg!("Instruction: InitializeMint");
Self::process_initialize_mint(accounts, decimals, mint_authority, freeze_authority)
}
TokenInstruction::InitializeMint2 {
decimals,
mint_authority,
freeze_authority,
} => {
msg!("Instruction: InitializeMint2");
Self::process_initialize_mint2(accounts, decimals, mint_authority, freeze_authority)
}
TokenInstruction::InitializeAccount => {
msg!("Instruction: InitializeAccount");
Self::process_initialize_account(accounts)
}
TokenInstruction::InitializeAccount2 { owner } => {
msg!("Instruction: InitializeAccount2");
Self::process_initialize_account2(accounts, owner)
}
TokenInstruction::InitializeAccount3 { owner } => {
msg!("Instruction: InitializeAccount3");
Self::process_initialize_account3(accounts, owner)
}
TokenInstruction::InitializeMultisig { m } => {
msg!("Instruction: InitializeMultisig");
Self::process_initialize_multisig(accounts, m)
}
TokenInstruction::InitializeMultisig2 { m } => {
msg!("Instruction: InitializeMultisig2");
Self::process_initialize_multisig2(accounts, m)
}
#[allow(deprecated)]
TokenInstruction::Transfer { amount } => {
msg!("Instruction: Transfer");
Self::process_transfer(program_id, accounts, amount, None, None)
}
TokenInstruction::Approve { amount } => {
msg!("Instruction: Approve");
Self::process_approve(program_id, accounts, amount, None)
}
TokenInstruction::Revoke => {
msg!("Instruction: Revoke");
Self::process_revoke(program_id, accounts)
}
TokenInstruction::SetAuthority {
authority_type,
new_authority,
} => {
msg!("Instruction: SetAuthority");
Self::process_set_authority(program_id, accounts, authority_type, new_authority)
}
TokenInstruction::MintTo { amount } => {
msg!("Instruction: MintTo");
Self::process_mint_to(program_id, accounts, amount, None)
}
TokenInstruction::Burn { amount } => {
msg!("Instruction: Burn");
Self::process_burn(program_id, accounts, amount, None)
}
TokenInstruction::CloseAccount => {
msg!("Instruction: CloseAccount");
Self::process_close_account(program_id, accounts)
}
TokenInstruction::FreezeAccount => {
msg!("Instruction: FreezeAccount");
Self::process_toggle_freeze_account(program_id, accounts, true)
}
TokenInstruction::ThawAccount => {
msg!("Instruction: ThawAccount");
Self::process_toggle_freeze_account(program_id, accounts, false)
}
TokenInstruction::TransferChecked { amount, decimals } => {
msg!("Instruction: TransferChecked");
Self::process_transfer(program_id, accounts, amount, Some(decimals), None)
}
TokenInstruction::ApproveChecked { amount, decimals } => {
msg!("Instruction: ApproveChecked");
Self::process_approve(program_id, accounts, amount, Some(decimals))
}
TokenInstruction::MintToChecked { amount, decimals } => {
msg!("Instruction: MintToChecked");
Self::process_mint_to(program_id, accounts, amount, Some(decimals))
}
TokenInstruction::BurnChecked { amount, decimals } => {
msg!("Instruction: BurnChecked");
Self::process_burn(program_id, accounts, amount, Some(decimals))
}
TokenInstruction::SyncNative => {
msg!("Instruction: SyncNative");
Self::process_sync_native(accounts)
}
TokenInstruction::GetAccountDataSize { extension_types } => {
msg!("Instruction: GetAccountDataSize");
Self::process_get_account_data_size(accounts, extension_types)
}
TokenInstruction::InitializeMintCloseAuthority { close_authority } => {
msg!("Instruction: InitializeMintCloseAuthority");
Self::process_initialize_mint_close_authority(accounts, close_authority)
}
TokenInstruction::TransferFeeExtension(instruction) => {
transfer_fee::processor::process_instruction(program_id, accounts, instruction)
}
// TODO:
TokenInstruction::ConfidentialTransferExtension => {
Err(ProgramError::InvalidArgument)
// confidential_transfer::processor::process_instruction(
// program_id,
// accounts,
// &input[1..],
// )
}
TokenInstruction::DefaultAccountStateExtension => {
default_account_state::processor::process_instruction(
program_id,
accounts,
&input[1..],
)
}
TokenInstruction::InitializeImmutableOwner => {
msg!("Instruction: InitializeImmutableOwner");
Self::process_initialize_immutable_owner(accounts)
}
TokenInstruction::AmountToUiAmount { amount } => {
msg!("Instruction: AmountToUiAmount");
Self::process_amount_to_ui_amount(accounts, amount)
}
TokenInstruction::UiAmountToAmount { ui_amount } => {
msg!("Instruction: UiAmountToAmount");
Self::process_ui_amount_to_amount(accounts, ui_amount)
}
TokenInstruction::Reallocate { extension_types } => {
msg!("Instruction: Reallocate");
reallocate::process_reallocate(program_id, accounts, extension_types)
}
TokenInstruction::MemoTransferExtension => {
memo_transfer::processor::process_instruction(program_id, accounts, &input[1..])
}
TokenInstruction::CreateNativeMint => {
msg!("Instruction: CreateNativeMint");
Self::process_create_native_mint(accounts)
}
TokenInstruction::InitializeNonTransferableMint => {
msg!("Instruction: InitializeNonTransferableMint");
Self::process_initialize_non_transferable_mint(accounts)
}
TokenInstruction::InterestBearingMintExtension => {
interest_bearing_mint::processor::process_instruction(
program_id,
accounts,
&input[1..],
)
}
}
}
/// Validates owner(s) are present. Used for Mints and Accounts only.
pub fn validate_owner(
program_id: &Pubkey,
expected_owner: &Pubkey,
owner_account_info: &AccountInfo,
owner_account_data_len: usize,
signers: &[AccountInfo],
) -> ProgramResult {
if !cmp_pubkeys(expected_owner, owner_account_info.key) {
return Err(TokenError::OwnerMismatch.into());
}
if cmp_pubkeys(program_id, owner_account_info.owner)
&& owner_account_data_len == Multisig::get_packed_len()
{
let multisig = Multisig::unpack(&owner_account_info.data.borrow())?;
let mut num_signers = 0;
let mut matched = [false; MAX_SIGNERS];
for signer in signers.iter() {
for (position, key) in multisig.signers[0..multisig.n as usize].iter().enumerate() {
if cmp_pubkeys(key, signer.key) && !matched[position] {
if !signer.is_signer {
return Err(ProgramError::MissingRequiredSignature);
}
matched[position] = true;
num_signers += 1;
}
}
}
if num_signers < multisig.m {
return Err(ProgramError::MissingRequiredSignature);
}
return Ok(());
} else if !owner_account_info.is_signer {
return Err(ProgramError::MissingRequiredSignature);
}
Ok(())
}
fn get_required_account_extensions(
mint_account_info: &AccountInfo,
) -> Result<Vec<ExtensionType>, ProgramError> {
let mint_data = mint_account_info.data.borrow();
let state = StateWithExtensions::<Mint>::unpack(&mint_data)
.map_err(|_| Into::<ProgramError>::into(TokenError::InvalidMint))?;
Self::get_required_account_extensions_from_unpacked_mint(mint_account_info.owner, &state)
}
fn get_required_account_extensions_from_unpacked_mint(
token_program_id: &Pubkey,
state: &StateWithExtensions<Mint>,
) -> Result<Vec<ExtensionType>, ProgramError> {
check_program_account(token_program_id)?;
let mint_extensions: Vec<ExtensionType> = state.get_extension_types()?;
Ok(ExtensionType::get_required_init_account_extensions(
&mint_extensions,
))
}
}
impl PrintProgramError for TokenError {
fn print<E>(&self)
where
E: 'static + std::error::Error + DecodeError<E> + PrintProgramError + FromPrimitive,
{
match self {
TokenError::NotRentExempt => msg!("Error: Lamport balance below rent-exempt threshold"),
TokenError::InsufficientFunds => msg!("Error: insufficient funds"),
TokenError::InvalidMint => msg!("Error: Invalid Mint"),
TokenError::MintMismatch => msg!("Error: Account not associated with this Mint"),
TokenError::OwnerMismatch => msg!("Error: owner does not match"),
TokenError::FixedSupply => msg!("Error: the total supply of this token is fixed"),
TokenError::AlreadyInUse => msg!("Error: account or token already in use"),
TokenError::InvalidNumberOfProvidedSigners => {
msg!("Error: Invalid number of provided signers")
}
TokenError::InvalidNumberOfRequiredSigners => {
msg!("Error: Invalid number of required signers")
}
TokenError::UninitializedState => msg!("Error: State is uninitialized"),
TokenError::NativeNotSupported => {
msg!("Error: Instruction does not support native tokens")
}
TokenError::NonNativeHasBalance => {
msg!("Error: Non-native account can only be closed if its balance is zero")
}
TokenError::InvalidInstruction => msg!("Error: Invalid instruction"),
TokenError::InvalidState => msg!("Error: Invalid account state for operation"),
TokenError::Overflow => msg!("Error: Operation overflowed"),
TokenError::AuthorityTypeNotSupported => {
msg!("Error: Account does not support specified authority type")
}
TokenError::MintCannotFreeze => msg!("Error: This token mint cannot freeze accounts"),
TokenError::AccountFrozen => msg!("Error: Account is frozen"),
TokenError::MintDecimalsMismatch => {
msg!("Error: decimals different from the Mint decimals")
}
TokenError::NonNativeNotSupported => {
msg!("Error: Instruction does not support non-native tokens")
}
TokenError::ExtensionTypeMismatch => {
msg!("Error: New extension type does not match already existing extensions")
}
TokenError::ExtensionBaseMismatch => {
msg!("Error: Extension does not match the base type provided")
}
TokenError::ExtensionAlreadyInitialized => {
msg!("Error: Extension already initialized on this account")
}
TokenError::ConfidentialTransferAccountHasBalance => {
msg!("Error: An account can only be closed if its confidential balance is zero")
}
TokenError::ConfidentialTransferAccountNotApproved => {
msg!("Error: Account not approved for confidential transfers")
}
TokenError::ConfidentialTransferDepositsAndTransfersDisabled => {
msg!("Error: Account not accepting deposits or transfers")
}
TokenError::ConfidentialTransferElGamalPubkeyMismatch => {
msg!("Error: ElGamal public key mismatch")
}
TokenError::ConfidentialTransferBalanceMismatch => {
msg!("Error: Balance mismatch")
}
TokenError::MintHasSupply => {
msg!("Error: Mint has non-zero supply. Burn all tokens before closing the mint")
}
TokenError::NoAuthorityExists => {
msg!("Error: No authority exists to perform the desired operation");
}
TokenError::TransferFeeExceedsMaximum => {
msg!("Error: Transfer fee exceeds maximum of 10,000 basis points");
}
TokenError::MintRequiredForTransfer => {
msg!("Mint required for this account to transfer tokens, use `transfer_checked` or `transfer_checked_with_fee`");
}
TokenError::FeeMismatch => {
msg!("Calculated fee does not match expected fee");
}
TokenError::FeeParametersMismatch => {
msg!("Fee parameters associated with zero-knowledge proofs do not match fee parameters in mint")
}
TokenError::ImmutableOwner => {
msg!("The owner authority cannot be changed");
}
TokenError::AccountHasWithheldTransferFees => {
msg!("Error: An account can only be closed if its withheld fee balance is zero, harvest fees to the mint and try again");
}
TokenError::NoMemo => {
msg!("Error: No memo in previous instruction; required for recipient to receive a transfer");
}
TokenError::NonTransferable => {
msg!("Transfer is disabled for this mint");
}
TokenError::NonTransferableNeedsImmutableOwnership => {
msg!("Non-transferable tokens can't be minted to an account without immutable ownership");
}
TokenError::MaximumPendingBalanceCreditCounterExceeded => {
msg!("The total number of `Deposit` and `Transfer` instructions to an account cannot exceed the associated `maximum_pending_balance_credit_counter`");
}
}
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/pod.rs
|
//! Solana program utilities for Plain Old Data types
use {
bytemuck::{Pod, Zeroable},
solana_sdk::{program_error::ProgramError, program_option::COption, pubkey::Pubkey},
std::convert::TryFrom,
};
/// A Pubkey that encodes `None` as all `0`, meant to be usable as a Pod type,
/// similar to all NonZero* number types from the bytemuck library.
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct OptionalNonZeroPubkey(Pubkey);
impl TryFrom<Option<Pubkey>> for OptionalNonZeroPubkey {
type Error = ProgramError;
fn try_from(p: Option<Pubkey>) -> Result<Self, Self::Error> {
match p {
None => Ok(Self(Pubkey::default())),
Some(pubkey) => {
if pubkey == Pubkey::default() {
Err(ProgramError::InvalidArgument)
} else {
Ok(Self(pubkey))
}
}
}
}
}
impl TryFrom<COption<Pubkey>> for OptionalNonZeroPubkey {
type Error = ProgramError;
fn try_from(p: COption<Pubkey>) -> Result<Self, Self::Error> {
match p {
COption::None => Ok(Self(Pubkey::default())),
COption::Some(pubkey) => {
if pubkey == Pubkey::default() {
Err(ProgramError::InvalidArgument)
} else {
Ok(Self(pubkey))
}
}
}
}
}
impl From<OptionalNonZeroPubkey> for Option<Pubkey> {
fn from(p: OptionalNonZeroPubkey) -> Self {
if p.0 == Pubkey::default() {
None
} else {
Some(p.0)
}
}
}
impl From<OptionalNonZeroPubkey> for COption<Pubkey> {
fn from(p: OptionalNonZeroPubkey) -> Self {
if p.0 == Pubkey::default() {
COption::None
} else {
COption::Some(p.0)
}
}
}
/// The standard `bool` is not a `Pod`, define a replacement that is
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct PodBool(u8);
impl From<bool> for PodBool {
fn from(b: bool) -> Self {
Self(if b { 1 } else { 0 })
}
}
impl From<&PodBool> for bool {
fn from(b: &PodBool) -> Self {
b.0 != 0
}
}
impl From<PodBool> for bool {
fn from(b: PodBool) -> Self {
b.0 != 0
}
}
/// Simple macro for implementing conversion functions between Pod* ints and standard ints.
///
/// The standard int types can cause alignment issues when placed in a `Pod`,
/// so these replacements are usable in all `Pod`s.
macro_rules! impl_int_conversion {
($P:ty, $I:ty) => {
impl From<$I> for $P {
fn from(n: $I) -> Self {
Self(n.to_le_bytes())
}
}
impl From<$P> for $I {
fn from(pod: $P) -> Self {
Self::from_le_bytes(pod.0)
}
}
};
}
/// `u16` type that can be used in `Pod`s
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct PodU16([u8; 2]);
impl_int_conversion!(PodU16, u16);
/// `i16` type that can be used in `Pod`s
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct PodI16([u8; 2]);
impl_int_conversion!(PodI16, i16);
/// `u64` type that can be used in `Pod`s
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct PodU64([u8; 8]);
impl_int_conversion!(PodU64, u64);
/// `i64` type that can be used in `Pod`s
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct PodI64([u8; 8]);
impl_int_conversion!(PodI64, i64);
/// On-chain size of a `Pod` type
pub fn pod_get_packed_len<T: Pod>() -> usize {
std::mem::size_of::<T>()
}
/// Convert a `Pod` into a slice (zero copy)
pub fn pod_bytes_of<T: Pod>(t: &T) -> &[u8] {
bytemuck::bytes_of(t)
}
/// Convert a slice into a `Pod` (zero copy)
pub fn pod_from_bytes<T: Pod>(bytes: &[u8]) -> Result<&T, ProgramError> {
bytemuck::try_from_bytes(bytes).map_err(|_| ProgramError::InvalidArgument)
}
/// Maybe convert a slice into a `Pod` (zero copy)
///
/// Returns `None` if the slice is empty, but `Err` if all other lengths but `get_packed_len()`
/// This function exists primarily because `Option<T>` is not a `Pod`.
pub fn pod_maybe_from_bytes<T: Pod>(bytes: &[u8]) -> Result<Option<&T>, ProgramError> {
if bytes.is_empty() {
Ok(None)
} else {
bytemuck::try_from_bytes(bytes)
.map(Some)
.map_err(|_| ProgramError::InvalidArgument)
}
}
/// Convert a slice into a mutable `Pod` (zero copy)
pub fn pod_from_bytes_mut<T: Pod>(bytes: &mut [u8]) -> Result<&mut T, ProgramError> {
bytemuck::try_from_bytes_mut(bytes).map_err(|_| ProgramError::InvalidArgument)
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/error.rs
|
//! Error types
use {
num_derive::FromPrimitive,
solana_sdk::{decode_error::DecodeError, program_error::ProgramError},
thiserror::Error,
};
/// Errors that may be returned by the Token program.
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum TokenError {
// 0
/// Lamport balance below rent-exempt threshold.
#[error("Lamport balance below rent-exempt threshold")]
NotRentExempt,
/// Insufficient funds for the operation requested.
#[error("Insufficient funds")]
InsufficientFunds,
/// Invalid Mint.
#[error("Invalid Mint")]
InvalidMint,
/// Account not associated with this Mint.
#[error("Account not associated with this Mint")]
MintMismatch,
/// Owner does not match.
#[error("Owner does not match")]
OwnerMismatch,
// 5
/// This token's supply is fixed and new tokens cannot be minted.
#[error("Fixed supply")]
FixedSupply,
/// The account cannot be initialized because it is already being used.
#[error("Already in use")]
AlreadyInUse,
/// Invalid number of provided signers.
#[error("Invalid number of provided signers")]
InvalidNumberOfProvidedSigners,
/// Invalid number of required signers.
#[error("Invalid number of required signers")]
InvalidNumberOfRequiredSigners,
/// State is uninitialized.
#[error("State is unititialized")]
UninitializedState,
// 10
/// Instruction does not support native tokens
#[error("Instruction does not support native tokens")]
NativeNotSupported,
/// Non-native account can only be closed if its balance is zero
#[error("Non-native account can only be closed if its balance is zero")]
NonNativeHasBalance,
/// Invalid instruction
#[error("Invalid instruction")]
InvalidInstruction,
/// State is invalid for requested operation.
#[error("State is invalid for requested operation")]
InvalidState,
/// Operation overflowed
#[error("Operation overflowed")]
Overflow,
// 15
/// Account does not support specified authority type.
#[error("Account does not support specified authority type")]
AuthorityTypeNotSupported,
/// This token mint cannot freeze accounts.
#[error("This token mint cannot freeze accounts")]
MintCannotFreeze,
/// Account is frozen; all account operations will fail
#[error("Account is frozen")]
AccountFrozen,
/// Mint decimals mismatch between the client and mint
#[error("The provided decimals value different from the Mint decimals")]
MintDecimalsMismatch,
/// Instruction does not support non-native tokens
#[error("Instruction does not support non-native tokens")]
NonNativeNotSupported,
// 20
/// Extension type does not match already existing extensions
#[error("Extension type does not match already existing extensions")]
ExtensionTypeMismatch,
/// Extension does not match the base type provided
#[error("Extension does not match the base type provided")]
ExtensionBaseMismatch,
/// Extension already initialized on this account
#[error("Extension already initialized on this account")]
ExtensionAlreadyInitialized,
/// An account can only be closed if its confidential balance is zero
#[error("An account can only be closed if its confidential balance is zero")]
ConfidentialTransferAccountHasBalance,
/// Account not approved for confidential transfers
#[error("Account not approved for confidential transfers")]
ConfidentialTransferAccountNotApproved,
// 25
/// Account not accepting deposits or transfers
#[error("Account not accepting deposits or transfers")]
ConfidentialTransferDepositsAndTransfersDisabled,
/// ElGamal public key mismatch
#[error("ElGamal public key mismatch")]
ConfidentialTransferElGamalPubkeyMismatch,
/// Balance mismatch
#[error("Balance mismatch")]
ConfidentialTransferBalanceMismatch,
/// Mint has non-zero supply. Burn all tokens before closing the mint.
#[error("Mint has non-zero supply. Burn all tokens before closing the mint")]
MintHasSupply,
/// No authority exists to perform the desired operation
#[error("No authority exists to perform the desired operation")]
NoAuthorityExists,
// 30
/// Transfer fee exceeds maximum of 10,000 basis points
#[error("Transfer fee exceeds maximum of 10,000 basis points")]
TransferFeeExceedsMaximum,
/// Mint required for this account to transfer tokens, use `transfer_checked` or `transfer_checked_with_fee`
#[error("Mint required for this account to transfer tokens, use `transfer_checked` or `transfer_checked_with_fee`")]
MintRequiredForTransfer,
/// Calculated fee does not match expected fee
#[error("Calculated fee does not match expected fee")]
FeeMismatch,
/// Fee parameters associated with confidential transfer zero-knowledge proofs do not match fee parameters in mint
#[error(
"Fee parameters associated with zero-knowledge proofs do not match fee parameters in mint"
)]
FeeParametersMismatch,
/// The owner authority cannot be changed
#[error("The owner authority cannot be changed")]
ImmutableOwner,
// 35
/// An account can only be closed if its withheld fee balance is zero, harvest fees to the
/// mint and try again
#[error("An account can only be closed if its withheld fee balance is zero, harvest fees to the mint and try again")]
AccountHasWithheldTransferFees,
/// No memo in previous instruction; required for recipient to receive a transfer
#[error("No memo in previous instruction; required for recipient to receive a transfer")]
NoMemo,
/// Transfer is disabled for this mint
#[error("Transfer is disabled for this mint")]
NonTransferable,
/// Non-transferable tokens can't be minted to an account without immutable ownership
#[error("Non-transferable tokens can't be minted to an account without immutable ownership")]
NonTransferableNeedsImmutableOwnership,
/// The total number of `Deposit` and `Transfer` instructions to an account cannot exceed the
/// associated `maximum_pending_balance_credit_counter`
#[error(
"The total number of `Deposit` and `Transfer` instructions to an account cannot exceed
the associated `maximum_pending_balance_credit_counter`"
)]
MaximumPendingBalanceCreditCounterExceeded,
}
impl From<TokenError> for ProgramError {
fn from(e: TokenError) -> Self {
ProgramError::Custom(e as u32)
}
}
impl<T> DecodeError<T> for TokenError {
fn type_of() -> &'static str {
"TokenError"
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/mod.rs
|
pub mod extension;
pub mod generic_token_account;
pub mod instruction;
pub mod native_mint;
pub mod processor;
pub mod state;
mod error;
mod pod;
use solana_sdk::{
declare_id,
entrypoint::ProgramResult,
program_error::ProgramError,
program_memory::sol_memcmp,
pubkey::{Pubkey, PUBKEY_BYTES},
};
use crate::program::spl_token;
/// Convert the UI representation of a token amount (using the decimals field defined in its mint)
/// to the raw amount
pub fn ui_amount_to_amount(ui_amount: f64, decimals: u8) -> u64 {
(ui_amount * 10_usize.pow(decimals as u32) as f64) as u64
}
/// Convert a raw amount to its UI representation (using the decimals field defined in its mint)
pub fn amount_to_ui_amount(amount: u64, decimals: u8) -> f64 {
amount as f64 / 10_usize.pow(decimals as u32) as f64
}
/// Convert a raw amount to its UI representation (using the decimals field defined in its mint)
pub fn amount_to_ui_amount_string(amount: u64, decimals: u8) -> String {
let decimals = decimals as usize;
if decimals > 0 {
// Left-pad zeros to decimals + 1, so we at least have an integer zero
let mut s = format!("{:01$}", amount, decimals + 1);
// Add the decimal point (Sorry, "," locales!)
s.insert(s.len() - decimals, '.');
s
} else {
amount.to_string()
}
}
/// Convert a raw amount to its UI representation using the given decimals field
/// Excess zeroes or unneeded decimal point are trimmed.
pub fn amount_to_ui_amount_string_trimmed(amount: u64, decimals: u8) -> String {
let mut s = amount_to_ui_amount_string(amount, decimals);
if decimals > 0 {
let zeros_trimmed = s.trim_end_matches('0');
s = zeros_trimmed.trim_end_matches('.').to_string();
}
s
}
/// Try to convert a UI representation of a token amount to its raw amount using the given decimals
/// field
pub fn try_ui_amount_into_amount(ui_amount: String, decimals: u8) -> Result<u64, ProgramError> {
let decimals = decimals as usize;
let mut parts = ui_amount.split('.');
let mut amount_str = parts.next().unwrap().to_string(); // splitting a string, even an empty one, will always yield an iterator of at least len == 1
let after_decimal = parts.next().unwrap_or("");
let after_decimal = after_decimal.trim_end_matches('0');
if (amount_str.is_empty() && after_decimal.is_empty())
|| parts.next().is_some()
|| after_decimal.len() > decimals
{
return Err(ProgramError::InvalidArgument);
}
amount_str.push_str(after_decimal);
for _ in 0..decimals.saturating_sub(after_decimal.len()) {
amount_str.push('0');
}
amount_str
.parse::<u64>()
.map_err(|_| ProgramError::InvalidArgument)
}
declare_id!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
/// Checks that the supplied program ID is correct for spl-token-2022
pub fn check_program_account(spl_token_program_id: &Pubkey) -> ProgramResult {
if spl_token_program_id != &id() {
return Err(ProgramError::IncorrectProgramId);
}
Ok(())
}
/// Checks that the supplied program ID is correct for spl-token or spl-token-2022
pub fn check_spl_token_program_account(spl_token_program_id: &Pubkey) -> ProgramResult {
if spl_token_program_id != &id() && spl_token_program_id != &spl_token::id() {
return Err(ProgramError::IncorrectProgramId);
}
Ok(())
}
/// Checks two pubkeys for equality in a computationally cheap way using
/// `sol_memcmp`
pub fn cmp_pubkeys(a: &Pubkey, b: &Pubkey) -> bool {
sol_memcmp(a.as_ref(), b.as_ref(), PUBKEY_BYTES) == 0
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/native_mint.rs
|
//! The Mint that represents the native token
/// There are 10^9 lamports in one SOL
pub const DECIMALS: u8 = 9;
// The Mint for native SOL Token accounts
solana_sdk::declare_id!("So11111111111111111111111111111111111111112");
// New token id is causing incorrect program id since it's not deployed yet
// solana_sdk::declare_id!("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
/// Seed for the native_mint's program-derived address
pub const PROGRAM_ADDRESS_SEEDS: &[&[u8]] = &["native-mint".as_bytes(), &[255]];
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/state.rs
|
//! State transition types
use {
crate::program::{
spl_token,
spl_token_2022::{
extension::AccountType,
generic_token_account::{is_initialized_account, GenericTokenAccount},
instruction::MAX_SIGNERS,
},
},
arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs},
num_enum::{IntoPrimitive, TryFromPrimitive},
solana_sdk::{
incinerator,
program_error::ProgramError,
program_option::COption,
program_pack::{IsInitialized, Pack, Sealed},
pubkey::Pubkey,
system_program,
},
};
/// Mint data.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Mint {
/// Optional authority used to mint new tokens. The mint authority may only be provided during
/// mint creation. If no mint authority is present then the mint has a fixed supply and no
/// further tokens may be minted.
pub mint_authority: COption<Pubkey>,
/// Total supply of tokens.
pub supply: u64,
/// Number of base 10 digits to the right of the decimal place.
pub decimals: u8,
/// Is `true` if this structure has been initialized
pub is_initialized: bool,
/// Optional authority to freeze token accounts.
pub freeze_authority: COption<Pubkey>,
}
impl Sealed for Mint {}
impl IsInitialized for Mint {
fn is_initialized(&self) -> bool {
self.is_initialized
}
}
impl Pack for Mint {
const LEN: usize = 82;
fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
let src = array_ref![src, 0, 82];
let (mint_authority, supply, decimals, is_initialized, freeze_authority) =
array_refs![src, 36, 8, 1, 1, 36];
let mint_authority = unpack_coption_key(mint_authority)?;
let supply = u64::from_le_bytes(*supply);
let decimals = decimals[0];
let is_initialized = match is_initialized {
[0] => false,
[1] => true,
_ => return Err(ProgramError::InvalidAccountData),
};
let freeze_authority = unpack_coption_key(freeze_authority)?;
Ok(Mint {
mint_authority,
supply,
decimals,
is_initialized,
freeze_authority,
})
}
fn pack_into_slice(&self, dst: &mut [u8]) {
let dst = array_mut_ref![dst, 0, 82];
let (
mint_authority_dst,
supply_dst,
decimals_dst,
is_initialized_dst,
freeze_authority_dst,
) = mut_array_refs![dst, 36, 8, 1, 1, 36];
let &Mint {
ref mint_authority,
supply,
decimals,
is_initialized,
ref freeze_authority,
} = self;
pack_coption_key(mint_authority, mint_authority_dst);
*supply_dst = supply.to_le_bytes();
decimals_dst[0] = decimals;
is_initialized_dst[0] = is_initialized as u8;
pack_coption_key(freeze_authority, freeze_authority_dst);
}
}
/// Account data.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Account {
/// The mint associated with this account
pub mint: Pubkey,
/// The owner of this account.
pub owner: Pubkey,
/// The amount of tokens this account holds.
pub amount: u64,
/// If `delegate` is `Some` then `delegated_amount` represents
/// the amount authorized by the delegate
pub delegate: COption<Pubkey>,
/// The account's state
pub state: AccountState,
/// If is_some, this is a native token, and the value logs the rent-exempt reserve. An Account
/// is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped
/// SOL accounts do not drop below this threshold.
pub is_native: COption<u64>,
/// The amount delegated
pub delegated_amount: u64,
/// Optional authority to close the account.
pub close_authority: COption<Pubkey>,
}
impl Account {
/// Checks if account is frozen
pub fn is_frozen(&self) -> bool {
self.state == AccountState::Frozen
}
/// Checks if account is native
pub fn is_native(&self) -> bool {
self.is_native.is_some()
}
/// Checks if a token Account's owner is the system_program or the incinerator
pub fn is_owned_by_system_program_or_incinerator(&self) -> bool {
system_program::check_id(&self.owner) || incinerator::check_id(&self.owner)
}
}
impl Sealed for Account {}
impl IsInitialized for Account {
fn is_initialized(&self) -> bool {
self.state != AccountState::Uninitialized
}
}
impl Pack for Account {
const LEN: usize = 165;
fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
let src = array_ref![src, 0, 165];
let (mint, owner, amount, delegate, state, is_native, delegated_amount, close_authority) =
array_refs![src, 32, 32, 8, 36, 1, 12, 8, 36];
Ok(Account {
mint: Pubkey::new_from_array(*mint),
owner: Pubkey::new_from_array(*owner),
amount: u64::from_le_bytes(*amount),
delegate: unpack_coption_key(delegate)?,
state: AccountState::try_from_primitive(state[0])
.or(Err(ProgramError::InvalidAccountData))?,
is_native: unpack_coption_u64(is_native)?,
delegated_amount: u64::from_le_bytes(*delegated_amount),
close_authority: unpack_coption_key(close_authority)?,
})
}
fn pack_into_slice(&self, dst: &mut [u8]) {
let dst = array_mut_ref![dst, 0, 165];
let (
mint_dst,
owner_dst,
amount_dst,
delegate_dst,
state_dst,
is_native_dst,
delegated_amount_dst,
close_authority_dst,
) = mut_array_refs![dst, 32, 32, 8, 36, 1, 12, 8, 36];
let &Account {
ref mint,
ref owner,
amount,
ref delegate,
state,
ref is_native,
delegated_amount,
ref close_authority,
} = self;
mint_dst.copy_from_slice(mint.as_ref());
owner_dst.copy_from_slice(owner.as_ref());
*amount_dst = amount.to_le_bytes();
pack_coption_key(delegate, delegate_dst);
state_dst[0] = state as u8;
pack_coption_u64(is_native, is_native_dst);
*delegated_amount_dst = delegated_amount.to_le_bytes();
pack_coption_key(close_authority, close_authority_dst);
}
}
/// Account state.
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Default, IntoPrimitive, TryFromPrimitive)]
pub enum AccountState {
/// Account is not yet initialized
#[default]
Uninitialized,
/// Account is initialized; the account owner and/or delegate may perform permitted operations
/// on this account
Initialized,
/// Account has been frozen by the mint freeze authority. Neither the account owner nor
/// the delegate are able to perform operations on this account.
Frozen,
}
/// Multisignature data.
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Multisig {
/// Number of signers required
pub m: u8,
/// Number of valid signers
pub n: u8,
/// Is `true` if this structure has been initialized
pub is_initialized: bool,
/// Signer public keys
pub signers: [Pubkey; MAX_SIGNERS],
}
impl Sealed for Multisig {}
impl IsInitialized for Multisig {
fn is_initialized(&self) -> bool {
self.is_initialized
}
}
impl Pack for Multisig {
const LEN: usize = 355;
fn unpack_from_slice(src: &[u8]) -> Result<Self, ProgramError> {
let src = array_ref![src, 0, 355];
#[allow(clippy::ptr_offset_with_cast)]
let (m, n, is_initialized, signers_flat) = array_refs![src, 1, 1, 1, 32 * MAX_SIGNERS];
let mut result = Multisig {
m: m[0],
n: n[0],
is_initialized: match is_initialized {
[0] => false,
[1] => true,
_ => return Err(ProgramError::InvalidAccountData),
},
signers: [Pubkey::new_from_array([0u8; 32]); MAX_SIGNERS],
};
for (src, dst) in signers_flat.chunks(32).zip(result.signers.iter_mut()) {
*dst = Pubkey::try_from(src).unwrap();
}
Ok(result)
}
fn pack_into_slice(&self, dst: &mut [u8]) {
let dst = array_mut_ref![dst, 0, 355];
#[allow(clippy::ptr_offset_with_cast)]
let (m, n, is_initialized, signers_flat) = mut_array_refs![dst, 1, 1, 1, 32 * MAX_SIGNERS];
*m = [self.m];
*n = [self.n];
*is_initialized = [self.is_initialized as u8];
for (i, src) in self.signers.iter().enumerate() {
let dst_array = array_mut_ref![signers_flat, 32 * i, 32];
dst_array.copy_from_slice(src.as_ref());
}
}
}
// Helpers
pub(crate) fn pack_coption_key(src: &COption<Pubkey>, dst: &mut [u8; 36]) {
let (tag, body) = mut_array_refs![dst, 4, 32];
match src {
COption::Some(key) => {
*tag = [1, 0, 0, 0];
body.copy_from_slice(key.as_ref());
}
COption::None => {
*tag = [0; 4];
}
}
}
pub(crate) fn unpack_coption_key(src: &[u8; 36]) -> Result<COption<Pubkey>, ProgramError> {
let (tag, body) = array_refs![src, 4, 32];
match *tag {
[0, 0, 0, 0] => Ok(COption::None),
[1, 0, 0, 0] => Ok(COption::Some(Pubkey::new_from_array(*body))),
_ => Err(ProgramError::InvalidAccountData),
}
}
fn pack_coption_u64(src: &COption<u64>, dst: &mut [u8; 12]) {
let (tag, body) = mut_array_refs![dst, 4, 8];
match src {
COption::Some(amount) => {
*tag = [1, 0, 0, 0];
*body = amount.to_le_bytes();
}
COption::None => {
*tag = [0; 4];
}
}
}
fn unpack_coption_u64(src: &[u8; 12]) -> Result<COption<u64>, ProgramError> {
let (tag, body) = array_refs![src, 4, 8];
match *tag {
[0, 0, 0, 0] => Ok(COption::None),
[1, 0, 0, 0] => Ok(COption::Some(u64::from_le_bytes(*body))),
_ => Err(ProgramError::InvalidAccountData),
}
}
// `spl_token_program_2022::extension::AccountType::Account` ordinal value
const ACCOUNTTYPE_ACCOUNT: u8 = AccountType::Account as u8;
impl GenericTokenAccount for Account {
fn valid_account_data(account_data: &[u8]) -> bool {
// Use spl_token::state::Account::valid_account_data once possible
account_data.len() == Account::LEN && is_initialized_account(account_data)
|| (account_data.len() >= Account::LEN
&& account_data.len() != Multisig::LEN
&& ACCOUNTTYPE_ACCOUNT
== *account_data
.get(spl_token::state::Account::get_packed_len())
.unwrap_or(&(AccountType::Uninitialized as u8))
&& is_initialized_account(account_data))
}
}
| 0
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program
|
solana_public_repos/solana-playground/solana-playground/wasm/utils/solana-extra/src/program/spl_token_2022/generic_token_account.rs
|
//! Generic Token Account, copied from spl_token::state
// Remove all of this and use spl-token's version once token 3.4.0 is released
use {
super::state::AccountState,
solana_sdk::pubkey::{Pubkey, PUBKEY_BYTES},
};
const SPL_TOKEN_ACCOUNT_MINT_OFFSET: usize = 0;
const SPL_TOKEN_ACCOUNT_OWNER_OFFSET: usize = 32;
/// A trait for token Account structs to enable efficiently unpacking various fields
/// without unpacking the complete state.
pub trait GenericTokenAccount {
/// Check if the account data is a valid token account
fn valid_account_data(account_data: &[u8]) -> bool;
/// Call after account length has already been verified to unpack the account owner
fn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey {
Self::unpack_pubkey_unchecked(account_data, SPL_TOKEN_ACCOUNT_OWNER_OFFSET)
}
/// Call after account length has already been verified to unpack the account mint
fn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey {
Self::unpack_pubkey_unchecked(account_data, SPL_TOKEN_ACCOUNT_MINT_OFFSET)
}
/// Call after account length has already been verified to unpack a Pubkey at
/// the specified offset. Panics if `account_data.len()` is less than `PUBKEY_BYTES`
fn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey {
bytemuck::from_bytes(&account_data[offset..offset + PUBKEY_BYTES])
}
/// Unpacks an account's owner from opaque account data.
fn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey> {
if Self::valid_account_data(account_data) {
Some(Self::unpack_account_owner_unchecked(account_data))
} else {
None
}
}
/// Unpacks an account's mint from opaque account data.
fn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey> {
if Self::valid_account_data(account_data) {
Some(Self::unpack_account_mint_unchecked(account_data))
} else {
None
}
}
}
/// The offset of state field in Account's C representation
pub const ACCOUNT_INITIALIZED_INDEX: usize = 108;
/// Check if the account data buffer represents an initialized account.
/// This is checking the `state` (AccountState) field of an Account object.
pub fn is_initialized_account(account_data: &[u8]) -> bool {
*account_data
.get(ACCOUNT_INITIALIZED_INDEX)
.unwrap_or(&(AccountState::Uninitialized as u8))
!= AccountState::Uninitialized as u8
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.