update to spl-token-2022 0.5.0
* support CpiGuard and PermanentDelegate extensions in transaction-status and account-decoder * update transaction-status and account-decoder to new ConfidentialTransfer interfaces
This commit is contained in:
parent
7d99cddb9f
commit
015784ad07
|
@ -4653,7 +4653,7 @@ dependencies = [
|
||||||
"solana-config-program",
|
"solana-config-program",
|
||||||
"solana-sdk 1.15.0",
|
"solana-sdk 1.15.0",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
@ -5335,9 +5335,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-frozen-abi"
|
name = "solana-frozen-abi"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f07a997db3dac7b9da06b007d4a8df6dbd8281182e6ebbbd8a56f935f540b0a"
|
checksum = "341bba362c91aedad2ad9fc0c28c2e39aaa606e6b9c049e8fbcc9f60675163ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"blake3",
|
"blake3",
|
||||||
|
@ -5362,7 +5362,7 @@ dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.5",
|
"sha2 0.10.5",
|
||||||
"solana-frozen-abi-macro 1.14.5",
|
"solana-frozen-abi-macro 1.14.8",
|
||||||
"subtle",
|
"subtle",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
@ -5402,9 +5402,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-frozen-abi-macro"
|
name = "solana-frozen-abi-macro"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dcd7d529da0fa5b3b5ca71645122fc94c2aaf867744497969c109e1d4b8ad02d"
|
checksum = "b6fae474ab37e2ccc4dfd33edd36a05d7df02b8531fa9870cb244f9491b64fe3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.41",
|
"proc-macro2 1.0.41",
|
||||||
"quote 1.0.18",
|
"quote 1.0.18",
|
||||||
|
@ -5633,7 +5633,7 @@ dependencies = [
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"test-case",
|
"test-case",
|
||||||
|
@ -5730,9 +5730,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-logger"
|
name = "solana-logger"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c690a6ae623bdd2d71229880a9f668ff714b5c6a9bc180a1abef4887da8b6f27"
|
checksum = "1ec82f7dedfee58ff2ac102b20a033a195950e7355fb29f1713f46cee629ffda"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -5906,9 +5906,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-program"
|
name = "solana-program"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f835be7a20e172209538241cdf46451c08b38eaaca65cf16e65658700c447b17"
|
checksum = "f480a0a440ea15d8436de1c9ac01501cb15979dae4a0a5fc8e33198949b38681"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -5944,9 +5944,9 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.5",
|
"sha2 0.10.5",
|
||||||
"sha3 0.10.4",
|
"sha3 0.10.4",
|
||||||
"solana-frozen-abi 1.14.5",
|
"solana-frozen-abi 1.14.8",
|
||||||
"solana-frozen-abi-macro 1.14.5",
|
"solana-frozen-abi-macro 1.14.8",
|
||||||
"solana-sdk-macro 1.14.5",
|
"solana-sdk-macro 1.14.8",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tiny-bip39",
|
"tiny-bip39",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
@ -6187,7 +6187,7 @@ dependencies = [
|
||||||
"solana-version",
|
"solana-version",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"stream-cancel",
|
"stream-cancel",
|
||||||
"symlink",
|
"symlink",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -6240,7 +6240,7 @@ dependencies = [
|
||||||
"solana-sdk 1.15.0",
|
"solana-sdk 1.15.0",
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6358,9 +6358,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-sdk"
|
name = "solana-sdk"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f74e8d699c3a441a5b0cd94c718e75b25c1a4295c2180a714b12fb1bcf66a51e"
|
checksum = "65641c3c87a81fbbf7663360a2d8d5e145280021c444220257f9975ff6cddc80"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assert_matches",
|
"assert_matches",
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
|
@ -6397,11 +6397,11 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.5",
|
"sha2 0.10.5",
|
||||||
"sha3 0.10.4",
|
"sha3 0.10.4",
|
||||||
"solana-frozen-abi 1.14.5",
|
"solana-frozen-abi 1.14.8",
|
||||||
"solana-frozen-abi-macro 1.14.5",
|
"solana-frozen-abi-macro 1.14.8",
|
||||||
"solana-logger 1.14.5",
|
"solana-logger 1.14.8",
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
"solana-sdk-macro 1.14.5",
|
"solana-sdk-macro 1.14.8",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"uriparse",
|
"uriparse",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
@ -6464,9 +6464,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-sdk-macro"
|
name = "solana-sdk-macro"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "92ffde9b5b7313629780baca10eaffec7421d53be725c76031ca409a5298705c"
|
checksum = "768f16d1a7315fc66ba835eebf9e95a83365ac94222551bc5cdcc6a74cb4a137"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"proc-macro2 1.0.41",
|
"proc-macro2 1.0.41",
|
||||||
|
@ -6782,7 +6782,7 @@ dependencies = [
|
||||||
"spl-associated-token-account",
|
"spl-associated-token-account",
|
||||||
"spl-memo",
|
"spl-memo",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6932,9 +6932,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-zk-token-sdk"
|
name = "solana-zk-token-sdk"
|
||||||
version = "1.14.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0a23a2c443027e8cc2981131a38928cb37e554970c497b5735e888049cc85d3f"
|
checksum = "ac5982ab9d8771b3d9bbef11ece78348c496a9f70a90a96225aee0a70bd13b9d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm-siv",
|
"aes-gcm-siv",
|
||||||
"arrayref",
|
"arrayref",
|
||||||
|
@ -6954,8 +6954,8 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha3 0.9.1",
|
"sha3 0.9.1",
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
"solana-sdk 1.14.5",
|
"solana-sdk 1.14.8",
|
||||||
"subtle",
|
"subtle",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
|
@ -7041,9 +7041,9 @@ dependencies = [
|
||||||
"borsh",
|
"borsh",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.4.3",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -7054,7 +7054,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8c5557ec281a34f7f9053feb6e0d795162ba0c6a52898b21c3d1e899481191d5"
|
checksum = "8c5557ec281a34f7f9053feb6e0d795162ba0c6a52898b21c3d1e899481191d5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -7063,7 +7063,7 @@ version = "3.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
|
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -7077,7 +7077,7 @@ dependencies = [
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -7092,8 +7092,26 @@ dependencies = [
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"solana-program 1.14.5",
|
"solana-program 1.14.8",
|
||||||
"solana-zk-token-sdk 1.14.5",
|
"solana-zk-token-sdk 1.14.8",
|
||||||
|
"spl-memo",
|
||||||
|
"spl-token",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "spl-token-2022"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0edb869dbe159b018f17fb9bfa67118c30f232d7f54a73742bc96794dff77ed8"
|
||||||
|
dependencies = [
|
||||||
|
"arrayref",
|
||||||
|
"bytemuck",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"num_enum",
|
||||||
|
"solana-program 1.14.8",
|
||||||
|
"solana-zk-token-sdk 1.14.8",
|
||||||
"spl-memo",
|
"spl-memo",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
|
|
@ -23,7 +23,7 @@ solana-address-lookup-table-program = { path = "../programs/address-lookup-table
|
||||||
solana-config-program = { path = "../programs/config", version = "=1.15.0" }
|
solana-config-program = { path = "../programs/config", version = "=1.15.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.15.0" }
|
solana-sdk = { path = "../sdk", version = "=1.15.0" }
|
||||||
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
||||||
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
|
spl-token-2022 = { version = "=0.5.0", features = ["no-entrypoint"] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
zstd = "0.11.2"
|
zstd = "0.11.2"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ use {
|
||||||
},
|
},
|
||||||
solana_sdk::pubkey::Pubkey,
|
solana_sdk::pubkey::Pubkey,
|
||||||
spl_token_2022::{
|
spl_token_2022::{
|
||||||
extension::StateWithExtensions,
|
extension::{BaseStateWithExtensions, StateWithExtensions},
|
||||||
generic_token_account::GenericTokenAccount,
|
generic_token_account::GenericTokenAccount,
|
||||||
solana_program::{
|
solana_program::{
|
||||||
program_option::COption, program_pack::Pack, pubkey::Pubkey as SplTokenPubkey,
|
program_option::COption, program_pack::Pack, pubkey::Pubkey as SplTokenPubkey,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use {
|
||||||
crate::parse_token::UiAccountState,
|
crate::parse_token::UiAccountState,
|
||||||
solana_sdk::clock::UnixTimestamp,
|
solana_sdk::clock::UnixTimestamp,
|
||||||
spl_token_2022::{
|
spl_token_2022::{
|
||||||
extension::{self, BaseState, ExtensionType, StateWithExtensions},
|
extension::{self, BaseState, BaseStateWithExtensions, ExtensionType, StateWithExtensions},
|
||||||
solana_program::pubkey::Pubkey,
|
solana_program::pubkey::Pubkey,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -21,6 +21,8 @@ pub enum UiExtension {
|
||||||
MemoTransfer(UiMemoTransfer),
|
MemoTransfer(UiMemoTransfer),
|
||||||
NonTransferable,
|
NonTransferable,
|
||||||
InterestBearingConfig(UiInterestBearingConfig),
|
InterestBearingConfig(UiInterestBearingConfig),
|
||||||
|
CpiGuard(UiCpiGuard),
|
||||||
|
PermanentDelegate(UiPermanentDelegate),
|
||||||
UnparseableExtension,
|
UnparseableExtension,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +66,14 @@ pub fn parse_extension<S: BaseState>(
|
||||||
.get_extension::<extension::interest_bearing_mint::InterestBearingConfig>()
|
.get_extension::<extension::interest_bearing_mint::InterestBearingConfig>()
|
||||||
.map(|&extension| UiExtension::InterestBearingConfig(extension.into()))
|
.map(|&extension| UiExtension::InterestBearingConfig(extension.into()))
|
||||||
.unwrap_or(UiExtension::UnparseableExtension),
|
.unwrap_or(UiExtension::UnparseableExtension),
|
||||||
|
ExtensionType::CpiGuard => account
|
||||||
|
.get_extension::<extension::cpi_guard::CpiGuard>()
|
||||||
|
.map(|&extension| UiExtension::CpiGuard(extension.into()))
|
||||||
|
.unwrap_or(UiExtension::UnparseableExtension),
|
||||||
|
ExtensionType::PermanentDelegate => account
|
||||||
|
.get_extension::<extension::permanent_delegate::PermanentDelegate>()
|
||||||
|
.map(|&extension| UiExtension::PermanentDelegate(extension.into()))
|
||||||
|
.unwrap_or(UiExtension::UnparseableExtension),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +214,35 @@ impl From<extension::interest_bearing_mint::InterestBearingConfig> for UiInteres
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct UiCpiGuard {
|
||||||
|
pub lock_cpi: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<extension::cpi_guard::CpiGuard> for UiCpiGuard {
|
||||||
|
fn from(cpi_guard: extension::cpi_guard::CpiGuard) -> Self {
|
||||||
|
Self {
|
||||||
|
lock_cpi: cpi_guard.lock_cpi.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct UiPermanentDelegate {
|
||||||
|
pub delegate: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<extension::permanent_delegate::PermanentDelegate> for UiPermanentDelegate {
|
||||||
|
fn from(permanent_delegate: extension::permanent_delegate::PermanentDelegate) -> Self {
|
||||||
|
let delegate: Option<Pubkey> = permanent_delegate.delegate.into();
|
||||||
|
Self {
|
||||||
|
delegate: delegate.map(|pubkey| pubkey.to_string()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UiConfidentialTransferMint {
|
pub struct UiConfidentialTransferMint {
|
||||||
|
@ -245,7 +284,8 @@ pub struct UiConfidentialTransferAccount {
|
||||||
pub pending_balance_hi: String,
|
pub pending_balance_hi: String,
|
||||||
pub available_balance: String,
|
pub available_balance: String,
|
||||||
pub decryptable_available_balance: String,
|
pub decryptable_available_balance: String,
|
||||||
pub allow_balance_credits: bool,
|
pub allow_confidential_credits: bool,
|
||||||
|
pub allow_non_confidential_credits: bool,
|
||||||
pub pending_balance_credit_counter: u64,
|
pub pending_balance_credit_counter: u64,
|
||||||
pub maximum_pending_balance_credit_counter: u64,
|
pub maximum_pending_balance_credit_counter: u64,
|
||||||
pub expected_pending_balance_credit_counter: u64,
|
pub expected_pending_balance_credit_counter: u64,
|
||||||
|
@ -269,7 +309,12 @@ impl From<extension::confidential_transfer::ConfidentialTransferAccount>
|
||||||
"{}",
|
"{}",
|
||||||
confidential_transfer_account.decryptable_available_balance
|
confidential_transfer_account.decryptable_available_balance
|
||||||
),
|
),
|
||||||
allow_balance_credits: confidential_transfer_account.allow_balance_credits.into(),
|
allow_confidential_credits: confidential_transfer_account
|
||||||
|
.allow_confidential_credits
|
||||||
|
.into(),
|
||||||
|
allow_non_confidential_credits: confidential_transfer_account
|
||||||
|
.allow_non_confidential_credits
|
||||||
|
.into(),
|
||||||
pending_balance_credit_counter: confidential_transfer_account
|
pending_balance_credit_counter: confidential_transfer_account
|
||||||
.pending_balance_credit_counter
|
.pending_balance_credit_counter
|
||||||
.into(),
|
.into(),
|
||||||
|
|
|
@ -53,7 +53,7 @@ solana-storage-proto = { path = "../storage-proto", version = "=1.15.0" }
|
||||||
solana-transaction-status = { path = "../transaction-status", version = "=1.15.0" }
|
solana-transaction-status = { path = "../transaction-status", version = "=1.15.0" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.15.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.15.0" }
|
||||||
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
||||||
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
|
spl-token-2022 = { version = "=0.5.0", features = ["no-entrypoint"] }
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
|
@ -4220,7 +4220,7 @@ dependencies = [
|
||||||
"solana-config-program",
|
"solana-config-program",
|
||||||
"solana-sdk 1.15.0",
|
"solana-sdk 1.15.0",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
@ -4566,9 +4566,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-frozen-abi"
|
name = "solana-frozen-abi"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28e4e35bc58c465f161bde764ebce41fdfcb503583cf3a77e0211274cc12b22d"
|
checksum = "341bba362c91aedad2ad9fc0c28c2e39aaa606e6b9c049e8fbcc9f60675163ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"blake3",
|
"blake3",
|
||||||
|
@ -4593,7 +4593,7 @@ dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.5",
|
"sha2 0.10.5",
|
||||||
"solana-frozen-abi-macro 1.11.5",
|
"solana-frozen-abi-macro 1.14.8",
|
||||||
"subtle",
|
"subtle",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
@ -4632,9 +4632,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-frozen-abi-macro"
|
name = "solana-frozen-abi-macro"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "708f837d748e574b1e53b250ab1f4a69ba330bbc10d041d02381165f0f36291a"
|
checksum = "b6fae474ab37e2ccc4dfd33edd36a05d7df02b8531fa9870cb244f9491b64fe3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.41",
|
"proc-macro2 1.0.41",
|
||||||
"quote 1.0.18",
|
"quote 1.0.18",
|
||||||
|
@ -4785,7 +4785,7 @@ dependencies = [
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -4796,9 +4796,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-logger"
|
name = "solana-logger"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e7ea6fc68d63d33d862d919d4c8ad7f613ec243ccf6762d595c660020b289b57"
|
checksum = "1ec82f7dedfee58ff2ac102b20a033a195950e7355fb29f1713f46cee629ffda"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -4907,9 +4907,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-program"
|
name = "solana-program"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bdd314d85b171bb20ccdcaf07346a9d52a012b10d84f4706f0628813d002fef8"
|
checksum = "f480a0a440ea15d8436de1c9ac01501cb15979dae4a0a5fc8e33198949b38681"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -4945,9 +4945,9 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.5",
|
"sha2 0.10.5",
|
||||||
"sha3 0.10.4",
|
"sha3 0.10.4",
|
||||||
"solana-frozen-abi 1.11.5",
|
"solana-frozen-abi 1.14.8",
|
||||||
"solana-frozen-abi-macro 1.11.5",
|
"solana-frozen-abi-macro 1.14.8",
|
||||||
"solana-sdk-macro 1.11.5",
|
"solana-sdk-macro 1.14.8",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tiny-bip39",
|
"tiny-bip39",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
@ -5175,7 +5175,7 @@ dependencies = [
|
||||||
"solana-version",
|
"solana-version",
|
||||||
"solana-vote-program",
|
"solana-vote-program",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"stream-cancel",
|
"stream-cancel",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -5222,7 +5222,7 @@ dependencies = [
|
||||||
"solana-sdk 1.15.0",
|
"solana-sdk 1.15.0",
|
||||||
"solana-transaction-status",
|
"solana-transaction-status",
|
||||||
"solana-version",
|
"solana-version",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5686,9 +5686,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-sdk"
|
name = "solana-sdk"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad7d954df63b267857e26670e3aacfd8e2943ca703653b0418e5afc85046c2f3"
|
checksum = "65641c3c87a81fbbf7663360a2d8d5e145280021c444220257f9975ff6cddc80"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assert_matches",
|
"assert_matches",
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
|
@ -5725,11 +5725,11 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.5",
|
"sha2 0.10.5",
|
||||||
"sha3 0.10.4",
|
"sha3 0.10.4",
|
||||||
"solana-frozen-abi 1.11.5",
|
"solana-frozen-abi 1.14.8",
|
||||||
"solana-frozen-abi-macro 1.11.5",
|
"solana-frozen-abi-macro 1.14.8",
|
||||||
"solana-logger 1.11.5",
|
"solana-logger 1.14.8",
|
||||||
"solana-program 1.11.5",
|
"solana-program 1.14.8",
|
||||||
"solana-sdk-macro 1.11.5",
|
"solana-sdk-macro 1.14.8",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"uriparse",
|
"uriparse",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
@ -5787,9 +5787,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-sdk-macro"
|
name = "solana-sdk-macro"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0d9e81bc46edcc517b2df504856d57a5101c7586ec63f3143ae11fbe2eba613"
|
checksum = "768f16d1a7315fc66ba835eebf9e95a83365ac94222551bc5cdcc6a74cb4a137"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"proc-macro2 1.0.41",
|
"proc-macro2 1.0.41",
|
||||||
|
@ -6008,7 +6008,7 @@ dependencies = [
|
||||||
"spl-associated-token-account",
|
"spl-associated-token-account",
|
||||||
"spl-memo",
|
"spl-memo",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.5.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6130,9 +6130,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-zk-token-sdk"
|
name = "solana-zk-token-sdk"
|
||||||
version = "1.11.5"
|
version = "1.14.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62415c05a9ebfffaf8befaa61b24492ebf88269cf84cbeba714bac4125ec4ea3"
|
checksum = "ac5982ab9d8771b3d9bbef11ece78348c496a9f70a90a96225aee0a70bd13b9d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm-siv",
|
"aes-gcm-siv",
|
||||||
"arrayref",
|
"arrayref",
|
||||||
|
@ -6143,6 +6143,7 @@ dependencies = [
|
||||||
"cipher 0.4.3",
|
"cipher 0.4.3",
|
||||||
"curve25519-dalek",
|
"curve25519-dalek",
|
||||||
"getrandom 0.1.14",
|
"getrandom 0.1.14",
|
||||||
|
"itertools",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"merlin",
|
"merlin",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
|
@ -6151,8 +6152,8 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha3 0.9.1",
|
"sha3 0.9.1",
|
||||||
"solana-program 1.11.5",
|
"solana-program 1.14.8",
|
||||||
"solana-sdk 1.11.5",
|
"solana-sdk 1.14.8",
|
||||||
"subtle",
|
"subtle",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
|
@ -6237,9 +6238,9 @@ dependencies = [
|
||||||
"borsh",
|
"borsh",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"solana-program 1.11.5",
|
"solana-program 1.14.8",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"spl-token-2022",
|
"spl-token-2022 0.4.3",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6249,7 +6250,7 @@ version = "3.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
|
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"solana-program 1.11.5",
|
"solana-program 1.14.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6263,7 +6264,7 @@ dependencies = [
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"solana-program 1.11.5",
|
"solana-program 1.14.8",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -6278,8 +6279,26 @@ dependencies = [
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"solana-program 1.11.5",
|
"solana-program 1.14.8",
|
||||||
"solana-zk-token-sdk 1.11.5",
|
"solana-zk-token-sdk 1.14.8",
|
||||||
|
"spl-memo",
|
||||||
|
"spl-token",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "spl-token-2022"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0edb869dbe159b018f17fb9bfa67118c30f232d7f54a73742bc96794dff77ed8"
|
||||||
|
dependencies = [
|
||||||
|
"arrayref",
|
||||||
|
"bytemuck",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"num_enum",
|
||||||
|
"solana-program 1.14.8",
|
||||||
|
"solana-zk-token-sdk 1.14.8",
|
||||||
"spl-memo",
|
"spl-memo",
|
||||||
"spl-token",
|
"spl-token",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
|
|
@ -22,7 +22,7 @@ solana-account-decoder = { path = "../account-decoder", version = "=1.15.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "=1.15.0" }
|
solana-sdk = { path = "../sdk", version = "=1.15.0" }
|
||||||
solana-transaction-status = { path = "../transaction-status", version = "=1.15.0" }
|
solana-transaction-status = { path = "../transaction-status", version = "=1.15.0" }
|
||||||
solana-version = { path = "../version", version = "=1.15.0" }
|
solana-version = { path = "../version", version = "=1.15.0" }
|
||||||
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
|
spl-token-2022 = { version = "=0.5.0", features = ["no-entrypoint"] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -52,7 +52,7 @@ solana-transaction-status = { path = "../transaction-status", version = "=1.15.0
|
||||||
solana-version = { path = "../version", version = "=1.15.0" }
|
solana-version = { path = "../version", version = "=1.15.0" }
|
||||||
solana-vote-program = { path = "../programs/vote", version = "=1.15.0" }
|
solana-vote-program = { path = "../programs/vote", version = "=1.15.0" }
|
||||||
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
||||||
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
|
spl-token-2022 = { version = "=0.5.0", features = ["no-entrypoint"] }
|
||||||
stream-cancel = "0.8.1"
|
stream-cancel = "0.8.1"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tokio = { version = "~1.14.1", features = ["full"] }
|
tokio = { version = "~1.14.1", features = ["full"] }
|
||||||
|
|
|
@ -26,7 +26,7 @@ solana-sdk = { path = "../sdk", version = "=1.15.0" }
|
||||||
spl-associated-token-account = { version = "=1.1.1", features = ["no-entrypoint"] }
|
spl-associated-token-account = { version = "=1.1.1", features = ["no-entrypoint"] }
|
||||||
spl-memo = { version = "=3.0.1", features = ["no-entrypoint"] }
|
spl-memo = { version = "=3.0.1", features = ["no-entrypoint"] }
|
||||||
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
|
||||||
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
|
spl-token-2022 = { version = "=0.5.0", features = ["no-entrypoint"] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|
|
@ -3,8 +3,9 @@ use {
|
||||||
check_num_accounts, ParsableProgram, ParseInstructionError, ParsedInstructionEnum,
|
check_num_accounts, ParsableProgram, ParseInstructionError, ParsedInstructionEnum,
|
||||||
},
|
},
|
||||||
extension::{
|
extension::{
|
||||||
confidential_transfer::*, default_account_state::*, interest_bearing_mint::*,
|
confidential_transfer::*, cpi_guard::*, default_account_state::*, interest_bearing_mint::*,
|
||||||
memo_transfer::*, mint_close_authority::*, reallocate::*, transfer_fee::*,
|
memo_transfer::*, mint_close_authority::*, permanent_delegate::*, reallocate::*,
|
||||||
|
transfer_fee::*,
|
||||||
},
|
},
|
||||||
serde_json::{json, Map, Value},
|
serde_json::{json, Map, Value},
|
||||||
solana_account_decoder::parse_token::{
|
solana_account_decoder::parse_token::{
|
||||||
|
@ -228,7 +229,8 @@ pub fn parse_token(
|
||||||
| AuthorityType::TransferFeeConfig
|
| AuthorityType::TransferFeeConfig
|
||||||
| AuthorityType::WithheldWithdraw
|
| AuthorityType::WithheldWithdraw
|
||||||
| AuthorityType::CloseMint
|
| AuthorityType::CloseMint
|
||||||
| AuthorityType::InterestRate => "mint",
|
| AuthorityType::InterestRate
|
||||||
|
| AuthorityType::PermanentDelegate => "mint",
|
||||||
AuthorityType::AccountOwner | AuthorityType::CloseAccount => "account",
|
AuthorityType::AccountOwner | AuthorityType::CloseAccount => "account",
|
||||||
};
|
};
|
||||||
let mut value = json!({
|
let mut value = json!({
|
||||||
|
@ -574,6 +576,21 @@ pub fn parse_token(
|
||||||
account_keys,
|
account_keys,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
TokenInstruction::CpiGuardExtension => {
|
||||||
|
if instruction.data.len() < 2 {
|
||||||
|
return Err(ParseInstructionError::InstructionNotParsable(
|
||||||
|
ParsableProgram::SplToken,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
parse_cpi_guard_instruction(&instruction.data[1..], &instruction.accounts, account_keys)
|
||||||
|
}
|
||||||
|
TokenInstruction::InitializePermanentDelegate { delegate } => {
|
||||||
|
parse_initialize_permanent_delegate_instruction(
|
||||||
|
delegate,
|
||||||
|
&instruction.accounts,
|
||||||
|
account_keys,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,6 +605,7 @@ pub enum UiAuthorityType {
|
||||||
WithheldWithdraw,
|
WithheldWithdraw,
|
||||||
CloseMint,
|
CloseMint,
|
||||||
InterestRate,
|
InterestRate,
|
||||||
|
PermanentDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<AuthorityType> for UiAuthorityType {
|
impl From<AuthorityType> for UiAuthorityType {
|
||||||
|
@ -601,6 +619,7 @@ impl From<AuthorityType> for UiAuthorityType {
|
||||||
AuthorityType::WithheldWithdraw => UiAuthorityType::WithheldWithdraw,
|
AuthorityType::WithheldWithdraw => UiAuthorityType::WithheldWithdraw,
|
||||||
AuthorityType::CloseMint => UiAuthorityType::CloseMint,
|
AuthorityType::CloseMint => UiAuthorityType::CloseMint,
|
||||||
AuthorityType::InterestRate => UiAuthorityType::InterestRate,
|
AuthorityType::InterestRate => UiAuthorityType::InterestRate,
|
||||||
|
AuthorityType::PermanentDelegate => UiAuthorityType::PermanentDelegate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,6 +638,8 @@ pub enum UiExtensionType {
|
||||||
MemoTransfer,
|
MemoTransfer,
|
||||||
NonTransferable,
|
NonTransferable,
|
||||||
InterestBearingConfig,
|
InterestBearingConfig,
|
||||||
|
CpiGuard,
|
||||||
|
PermanentDelegate,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ExtensionType> for UiExtensionType {
|
impl From<ExtensionType> for UiExtensionType {
|
||||||
|
@ -637,6 +658,8 @@ impl From<ExtensionType> for UiExtensionType {
|
||||||
ExtensionType::MemoTransfer => UiExtensionType::MemoTransfer,
|
ExtensionType::MemoTransfer => UiExtensionType::MemoTransfer,
|
||||||
ExtensionType::NonTransferable => UiExtensionType::NonTransferable,
|
ExtensionType::NonTransferable => UiExtensionType::NonTransferable,
|
||||||
ExtensionType::InterestBearingConfig => UiExtensionType::InterestBearingConfig,
|
ExtensionType::InterestBearingConfig => UiExtensionType::InterestBearingConfig,
|
||||||
|
ExtensionType::CpiGuard => UiExtensionType::CpiGuard,
|
||||||
|
ExtensionType::PermanentDelegate => UiExtensionType::PermanentDelegate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,36 +214,6 @@ pub(in crate::parse_token) fn parse_confidential_transfer_instruction(
|
||||||
info: value,
|
info: value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ConfidentialTransferInstruction::TransferWithFee => {
|
|
||||||
check_num_token_accounts(account_indexes, 5)?;
|
|
||||||
let transfer_data: TransferInstructionData = *decode_instruction_data(instruction_data)
|
|
||||||
.map_err(|_| {
|
|
||||||
ParseInstructionError::InstructionNotParsable(ParsableProgram::SplToken)
|
|
||||||
})?;
|
|
||||||
let proof_instruction_offset: i8 = transfer_data.proof_instruction_offset;
|
|
||||||
let mut value = json!({
|
|
||||||
"source": account_keys[account_indexes[0] as usize].to_string(),
|
|
||||||
"destination": account_keys[account_indexes[1] as usize].to_string(),
|
|
||||||
"mint": account_keys[account_indexes[2] as usize].to_string(),
|
|
||||||
"instructionsSysvar": account_keys[account_indexes[3] as usize].to_string(),
|
|
||||||
"newSourceDecryptableAvailableBalance": format!("{}", transfer_data.new_source_decryptable_available_balance),
|
|
||||||
"proofInstructionOffset": proof_instruction_offset,
|
|
||||||
|
|
||||||
});
|
|
||||||
let map = value.as_object_mut().unwrap();
|
|
||||||
parse_signers(
|
|
||||||
map,
|
|
||||||
4,
|
|
||||||
account_keys,
|
|
||||||
account_indexes,
|
|
||||||
"owner",
|
|
||||||
"multisigOwner",
|
|
||||||
);
|
|
||||||
Ok(ParsedInstructionEnum {
|
|
||||||
instruction_type: "confidentialTransferWithFee".to_string(),
|
|
||||||
info: value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
ConfidentialTransferInstruction::ApplyPendingBalance => {
|
ConfidentialTransferInstruction::ApplyPendingBalance => {
|
||||||
check_num_token_accounts(account_indexes, 2)?;
|
check_num_token_accounts(account_indexes, 2)?;
|
||||||
let apply_pending_balance_data: ApplyPendingBalanceData =
|
let apply_pending_balance_data: ApplyPendingBalanceData =
|
||||||
|
@ -273,7 +243,7 @@ pub(in crate::parse_token) fn parse_confidential_transfer_instruction(
|
||||||
info: value,
|
info: value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ConfidentialTransferInstruction::EnableBalanceCredits => {
|
ConfidentialTransferInstruction::EnableConfidentialCredits => {
|
||||||
check_num_token_accounts(account_indexes, 2)?;
|
check_num_token_accounts(account_indexes, 2)?;
|
||||||
let mut value = json!({
|
let mut value = json!({
|
||||||
"account": account_keys[account_indexes[0] as usize].to_string(),
|
"account": account_keys[account_indexes[0] as usize].to_string(),
|
||||||
|
@ -289,11 +259,11 @@ pub(in crate::parse_token) fn parse_confidential_transfer_instruction(
|
||||||
"multisigOwner",
|
"multisigOwner",
|
||||||
);
|
);
|
||||||
Ok(ParsedInstructionEnum {
|
Ok(ParsedInstructionEnum {
|
||||||
instruction_type: "enableConfidentialTransferBalanceCredits".to_string(),
|
instruction_type: "enableConfidentialTransferConfidentialCredits".to_string(),
|
||||||
info: value,
|
info: value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ConfidentialTransferInstruction::DisableBalanceCredits => {
|
ConfidentialTransferInstruction::DisableConfidentialCredits => {
|
||||||
check_num_token_accounts(account_indexes, 2)?;
|
check_num_token_accounts(account_indexes, 2)?;
|
||||||
let mut value = json!({
|
let mut value = json!({
|
||||||
"account": account_keys[account_indexes[0] as usize].to_string(),
|
"account": account_keys[account_indexes[0] as usize].to_string(),
|
||||||
|
@ -309,7 +279,47 @@ pub(in crate::parse_token) fn parse_confidential_transfer_instruction(
|
||||||
"multisigOwner",
|
"multisigOwner",
|
||||||
);
|
);
|
||||||
Ok(ParsedInstructionEnum {
|
Ok(ParsedInstructionEnum {
|
||||||
instruction_type: "disableConfidentialTransferBalanceCredits".to_string(),
|
instruction_type: "disableConfidentialTransferConfidentialCredits".to_string(),
|
||||||
|
info: value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ConfidentialTransferInstruction::EnableNonConfidentialCredits => {
|
||||||
|
check_num_token_accounts(account_indexes, 2)?;
|
||||||
|
let mut value = json!({
|
||||||
|
"account": account_keys[account_indexes[0] as usize].to_string(),
|
||||||
|
|
||||||
|
});
|
||||||
|
let map = value.as_object_mut().unwrap();
|
||||||
|
parse_signers(
|
||||||
|
map,
|
||||||
|
1,
|
||||||
|
account_keys,
|
||||||
|
account_indexes,
|
||||||
|
"owner",
|
||||||
|
"multisigOwner",
|
||||||
|
);
|
||||||
|
Ok(ParsedInstructionEnum {
|
||||||
|
instruction_type: "enableConfidentialTransferNonConfidentialCredits".to_string(),
|
||||||
|
info: value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ConfidentialTransferInstruction::DisableNonConfidentialCredits => {
|
||||||
|
check_num_token_accounts(account_indexes, 2)?;
|
||||||
|
let mut value = json!({
|
||||||
|
"account": account_keys[account_indexes[0] as usize].to_string(),
|
||||||
|
|
||||||
|
});
|
||||||
|
let map = value.as_object_mut().unwrap();
|
||||||
|
parse_signers(
|
||||||
|
map,
|
||||||
|
1,
|
||||||
|
account_keys,
|
||||||
|
account_indexes,
|
||||||
|
"owner",
|
||||||
|
"multisigOwner",
|
||||||
|
);
|
||||||
|
Ok(ParsedInstructionEnum {
|
||||||
|
instruction_type: "disableNonConfidentialTransferConfidentialCredits".to_string(),
|
||||||
info: value,
|
info: value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,176 @@
|
||||||
|
use {
|
||||||
|
super::*,
|
||||||
|
spl_token_2022::{
|
||||||
|
extension::cpi_guard::instruction::CpiGuardInstruction,
|
||||||
|
instruction::decode_instruction_type,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub(in crate::parse_token) fn parse_cpi_guard_instruction(
|
||||||
|
instruction_data: &[u8],
|
||||||
|
account_indexes: &[u8],
|
||||||
|
account_keys: &AccountKeys,
|
||||||
|
) -> Result<ParsedInstructionEnum, ParseInstructionError> {
|
||||||
|
check_num_token_accounts(account_indexes, 2)?;
|
||||||
|
let instruction_type_str = match decode_instruction_type(instruction_data)
|
||||||
|
.map_err(|_| ParseInstructionError::InstructionNotParsable(ParsableProgram::SplToken))?
|
||||||
|
{
|
||||||
|
CpiGuardInstruction::Enable => "enable",
|
||||||
|
CpiGuardInstruction::Disable => "disable",
|
||||||
|
};
|
||||||
|
let mut value = json!({
|
||||||
|
"account": account_keys[account_indexes[0] as usize].to_string(),
|
||||||
|
});
|
||||||
|
let map = value.as_object_mut().unwrap();
|
||||||
|
parse_signers(
|
||||||
|
map,
|
||||||
|
1,
|
||||||
|
account_keys,
|
||||||
|
account_indexes,
|
||||||
|
"owner",
|
||||||
|
"multisigOwner",
|
||||||
|
);
|
||||||
|
Ok(ParsedInstructionEnum {
|
||||||
|
instruction_type: format!("{}CpiGuard", instruction_type_str),
|
||||||
|
info: value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use {
|
||||||
|
super::*,
|
||||||
|
crate::parse_token::test::*,
|
||||||
|
solana_sdk::pubkey::Pubkey,
|
||||||
|
spl_token_2022::{
|
||||||
|
extension::cpi_guard::instruction::{disable_cpi_guard, enable_cpi_guard},
|
||||||
|
solana_program::message::Message,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse_cpi_guard_instruction() {
|
||||||
|
let account_pubkey = Pubkey::new_unique();
|
||||||
|
|
||||||
|
// Enable, single owner
|
||||||
|
let owner_pubkey = Pubkey::new_unique();
|
||||||
|
let enable_cpi_guard_ix = enable_cpi_guard(
|
||||||
|
&spl_token_2022::id(),
|
||||||
|
&convert_pubkey(account_pubkey),
|
||||||
|
&convert_pubkey(owner_pubkey),
|
||||||
|
&[],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let message = Message::new(&[enable_cpi_guard_ix], None);
|
||||||
|
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||||
|
assert_eq!(
|
||||||
|
parse_token(
|
||||||
|
&compiled_instruction,
|
||||||
|
&AccountKeys::new(&convert_account_keys(&message), None)
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
ParsedInstructionEnum {
|
||||||
|
instruction_type: "enableCpiGuard".to_string(),
|
||||||
|
info: json!({
|
||||||
|
"account": account_pubkey.to_string(),
|
||||||
|
"owner": owner_pubkey.to_string(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Enable, multisig owner
|
||||||
|
let multisig_pubkey = Pubkey::new_unique();
|
||||||
|
let multisig_signer0 = Pubkey::new_unique();
|
||||||
|
let multisig_signer1 = Pubkey::new_unique();
|
||||||
|
let enable_cpi_guard_ix = enable_cpi_guard(
|
||||||
|
&spl_token_2022::id(),
|
||||||
|
&convert_pubkey(account_pubkey),
|
||||||
|
&convert_pubkey(multisig_pubkey),
|
||||||
|
&[
|
||||||
|
&convert_pubkey(multisig_signer0),
|
||||||
|
&convert_pubkey(multisig_signer1),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let message = Message::new(&[enable_cpi_guard_ix], None);
|
||||||
|
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||||
|
assert_eq!(
|
||||||
|
parse_token(
|
||||||
|
&compiled_instruction,
|
||||||
|
&AccountKeys::new(&convert_account_keys(&message), None)
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
ParsedInstructionEnum {
|
||||||
|
instruction_type: "enableCpiGuard".to_string(),
|
||||||
|
info: json!({
|
||||||
|
"account": account_pubkey.to_string(),
|
||||||
|
"multisigOwner": multisig_pubkey.to_string(),
|
||||||
|
"signers": vec![
|
||||||
|
multisig_signer0.to_string(),
|
||||||
|
multisig_signer1.to_string(),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Disable, single owner
|
||||||
|
let enable_cpi_guard_ix = disable_cpi_guard(
|
||||||
|
&spl_token_2022::id(),
|
||||||
|
&convert_pubkey(account_pubkey),
|
||||||
|
&convert_pubkey(owner_pubkey),
|
||||||
|
&[],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let message = Message::new(&[enable_cpi_guard_ix], None);
|
||||||
|
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||||
|
assert_eq!(
|
||||||
|
parse_token(
|
||||||
|
&compiled_instruction,
|
||||||
|
&AccountKeys::new(&convert_account_keys(&message), None)
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
ParsedInstructionEnum {
|
||||||
|
instruction_type: "disableCpiGuard".to_string(),
|
||||||
|
info: json!({
|
||||||
|
"account": account_pubkey.to_string(),
|
||||||
|
"owner": owner_pubkey.to_string(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Enable, multisig owner
|
||||||
|
let multisig_pubkey = Pubkey::new_unique();
|
||||||
|
let multisig_signer0 = Pubkey::new_unique();
|
||||||
|
let multisig_signer1 = Pubkey::new_unique();
|
||||||
|
let enable_cpi_guard_ix = disable_cpi_guard(
|
||||||
|
&spl_token_2022::id(),
|
||||||
|
&convert_pubkey(account_pubkey),
|
||||||
|
&convert_pubkey(multisig_pubkey),
|
||||||
|
&[
|
||||||
|
&convert_pubkey(multisig_signer0),
|
||||||
|
&convert_pubkey(multisig_signer1),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let message = Message::new(&[enable_cpi_guard_ix], None);
|
||||||
|
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||||
|
assert_eq!(
|
||||||
|
parse_token(
|
||||||
|
&compiled_instruction,
|
||||||
|
&AccountKeys::new(&convert_account_keys(&message), None)
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
ParsedInstructionEnum {
|
||||||
|
instruction_type: "disableCpiGuard".to_string(),
|
||||||
|
info: json!({
|
||||||
|
"account": account_pubkey.to_string(),
|
||||||
|
"multisigOwner": multisig_pubkey.to_string(),
|
||||||
|
"signers": vec![
|
||||||
|
multisig_signer0.to_string(),
|
||||||
|
multisig_signer1.to_string(),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub(super) mod confidential_transfer;
|
pub(super) mod confidential_transfer;
|
||||||
|
pub(super) mod cpi_guard;
|
||||||
pub(super) mod default_account_state;
|
pub(super) mod default_account_state;
|
||||||
pub(super) mod interest_bearing_mint;
|
pub(super) mod interest_bearing_mint;
|
||||||
pub(super) mod memo_transfer;
|
pub(super) mod memo_transfer;
|
||||||
pub(super) mod mint_close_authority;
|
pub(super) mod mint_close_authority;
|
||||||
|
pub(super) mod permanent_delegate;
|
||||||
pub(super) mod reallocate;
|
pub(super) mod reallocate;
|
||||||
pub(super) mod transfer_fee;
|
pub(super) mod transfer_fee;
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
use {super::*, spl_token_2022::solana_program::pubkey::Pubkey};
|
||||||
|
|
||||||
|
pub(in crate::parse_token) fn parse_initialize_permanent_delegate_instruction(
|
||||||
|
delegate: Pubkey,
|
||||||
|
account_indexes: &[u8],
|
||||||
|
account_keys: &AccountKeys,
|
||||||
|
) -> Result<ParsedInstructionEnum, ParseInstructionError> {
|
||||||
|
check_num_token_accounts(account_indexes, 1)?;
|
||||||
|
Ok(ParsedInstructionEnum {
|
||||||
|
instruction_type: "initializePermanentDelegate".to_string(),
|
||||||
|
info: json!({
|
||||||
|
"mint": account_keys[account_indexes[0] as usize].to_string(),
|
||||||
|
"delegate": delegate.to_string(),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use {
|
||||||
|
super::*,
|
||||||
|
crate::parse_token::test::*,
|
||||||
|
solana_sdk::pubkey::Pubkey,
|
||||||
|
spl_token_2022::{instruction::*, solana_program::message::Message},
|
||||||
|
};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse_initialize_permanent_delegate_instruction() {
|
||||||
|
let mint_pubkey = Pubkey::new_unique();
|
||||||
|
let delegate = Pubkey::new_unique();
|
||||||
|
let permanent_delegate_ix = initialize_permanent_delegate(
|
||||||
|
&spl_token_2022::id(),
|
||||||
|
&convert_pubkey(mint_pubkey),
|
||||||
|
&convert_pubkey(delegate),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let message = Message::new(&[permanent_delegate_ix], None);
|
||||||
|
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
|
||||||
|
assert_eq!(
|
||||||
|
parse_token(
|
||||||
|
&compiled_instruction,
|
||||||
|
&AccountKeys::new(&convert_account_keys(&message), None)
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
ParsedInstructionEnum {
|
||||||
|
instruction_type: "initializePermanentDelegate".to_string(),
|
||||||
|
info: json!({
|
||||||
|
"mint": mint_pubkey.to_string(),
|
||||||
|
"delegate": delegate.to_string(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue