diff --git a/.gitignore b/.gitignore index e6c869b5..44ab60a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ target/ crates/mock/fixtures *.env* Vixen.toml + +pnpm-lock.yaml +node_modules \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 7281d655..ada3be73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9374,9 +9374,35 @@ dependencies = [ "tonic-reflection", ] +[[package]] +name = "yellowstone-vixen-pump-fees-parser" +version = "0.5.2" +dependencies = [ + "borsh 1.5.7", + "num-derive", + "num-traits", + "prost 0.13.5", + "prost-build 0.13.5", + "protobuf-src", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", + "strum", + "strum_macros", + "thiserror 1.0.69", + "tonic 0.12.3", + "tracing", + "yellowstone-vixen-core", +] + [[package]] name = "yellowstone-vixen-pump-swaps-parser" -version = "0.5.1" +version = "0.5.2" dependencies = [ "borsh 1.5.7", "num-derive", @@ -9402,7 +9428,7 @@ dependencies = [ [[package]] name = "yellowstone-vixen-pumpfun-parser" -version = "0.5.1" +version = "0.5.2" dependencies = [ "borsh 1.5.7", "num-derive", diff --git a/Cargo.toml b/Cargo.toml index d66c7319..3e6fcc4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,7 @@ yellowstone-vixen-proto = { path = "crates/proto", version = "0.5.1" } yellowstone-vixen-boop-parser = { path = "crates/boop-parser", version = "0.5.1" } yellowstone-vixen-meteora-parser = { path = "crates/meteora-parser", version = "0.5.1" } -yellowstone-vixen-pumpfun-parser = { path = "crates/pumpfun-parser", version = "0.5.1" } +yellowstone-vixen-pumpfun-parser = { path = "crates/pumpfun-parser", version = "0.5.2" } yellowstone-vixen-jupiter-swap-parser = { path = "crates/jupiter-swap-parser", version = "0.5.1" } yellowstone-vixen-meteora-amm-parser = { path = "crates/meteora-amm-parser", version = "0.5.1" } yellowstone-vixen-meteora-dbc-parser = { path = "crates/meteora-dbc-parser", version = "0.5.1" } @@ -92,12 +92,13 @@ yellowstone-vixen-meteora-vault-parser = { path = "crates/meteora-vault-parser", yellowstone-vixen-moonshot-parser = { path = "crates/moonshot-parser", version = "0.5.1" } yellowstone-vixen-orca-whirlpool-parser = { path = "crates/orca-whirlpool-parser", version = "0.5.1" } yellowstone-vixen-raydium-cpmm-parser = { path = "crates/raydium-cpmm-parser", version = "0.5.1" } -yellowstone-vixen-pump-swaps-parser = { path = "crates/pump-swaps-parser", version = "0.5.1" } +yellowstone-vixen-pump-swaps-parser = { path = "crates/pump-swaps-parser", version = "0.5.2" } yellowstone-vixen-raydium-clmm-parser = { path = "crates/raydium-clmm-parser", version = "0.5.1" } yellowstone-vixen-raydium-amm-v4-parser = { path = "crates/raydium-amm-v4-parser", version = "0.5.1" } yellowstone-vixen-kamino-limit-orders-parser = { path = "crates/kamino-limit-orders-parser", version = "0.5.1" } yellowstone-vixen-raydium-launchpad-parser = { path = "crates/raydium-launchpad-parser", version = "0.5.1" } yellowstone-vixen-virtuals-parser = { path = "crates/virtuals-parser", version = "0.5.1" } +yellowstone-vixen-pump-fees-parser = { path = "crates/pump-fees-parser", version = "0.5.2" } # Sources yellowstone-vixen-solana-rpc-source = { path = "crates/solana-rpc-source", version = "0.3.1" } diff --git a/crates/pump-fees-parser/Cargo.toml b/crates/pump-fees-parser/Cargo.toml new file mode 100644 index 00000000..b1410067 --- /dev/null +++ b/crates/pump-fees-parser/Cargo.toml @@ -0,0 +1,42 @@ +[package] +name = "yellowstone-vixen-pump-fees-parser" +version = "0.5.2" +edition.workspace = true +description = "Vixen program parser for Pump Fees program" +license.workspace = true +repository.workspace = true +authors.workspace = true + +[dependencies] +prost.workspace = true +yellowstone-vixen-core = { workspace = true, features = ["proto"] } +tonic = { workspace = true, features = ["gzip", "zstd"] } +solana-account-info.workspace = true +solana-cpi.workspace = true +solana-decode-error.workspace = true +solana-pubkey = { workspace = true, features = ["curve25519", "borsh"] } +solana-instruction.workspace = true +solana-msg.workspace = true +solana-program-entrypoint.workspace = true +solana-program-error.workspace = true +borsh.workspace = true +num-derive.workspace = true +thiserror.workspace = true +num-traits.workspace = true +tracing = { workspace = true, optional = true } +strum = { workspace = true, optional = true } +strum_macros = { workspace = true, optional = true } + +[features] +anchor = [] +anchor-idl-build = [] +serde = [] +test-sbf = [] +fetch = [] +tracing = ["dep:tracing", "dep:strum", "dep:strum_macros"] +# Exposes shared transaction data like tx signature, slot and more, to be available in Vixen Handlers +shared-data = [] + +[build-dependencies] +prost-build.workspace = true +protobuf-src.workspace = true \ No newline at end of file diff --git a/crates/pump-fees-parser/build.rs b/crates/pump-fees-parser/build.rs new file mode 100644 index 00000000..c61b8a3a --- /dev/null +++ b/crates/pump-fees-parser/build.rs @@ -0,0 +1,19 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use std::{env, path::PathBuf}; + +fn main() { + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + std::env::set_var("PROTOC", protobuf_src::protoc()); + // #[cfg(feature = "proto")] + prost_build::Config::new() + .enable_type_names() + .file_descriptor_set_path(out_dir.join("descriptor.bin")) + .compile_protos(&["proto/pump_fees.proto"], &["proto"]) + .unwrap(); +} diff --git a/crates/pump-fees-parser/codama.cjs b/crates/pump-fees-parser/codama.cjs new file mode 100644 index 00000000..13ac97ad --- /dev/null +++ b/crates/pump-fees-parser/codama.cjs @@ -0,0 +1,22 @@ +// codama.cjs +const path = require("node:path"); +const { rootNode } = require("@codama/nodes"); +const { rootNodeFromAnchor } = require("@codama/nodes-from-anchor"); +const { readJson } = require("@codama/renderers-core"); +const { visit } = require("@codama/visitors-core"); +const { renderVisitor } = require("@codama/renderers-vixen-parser"); + +const projectName = "example-parser"; +const idl = readJson(path.join(__dirname, "idl.json")); + +// Use the appropriate node constructor based on your IDL type: +const node = rootNodeFromAnchor(idl); // for Anchor/Shank idls +// const node = rootNode(idl.program); // for Codama idls + +visit( + node, + renderVisitor({ + projectFolder: __dirname, + projectName, + }), +); diff --git a/crates/pump-fees-parser/idl.json b/crates/pump-fees-parser/idl.json new file mode 100644 index 00000000..f036a081 --- /dev/null +++ b/crates/pump-fees-parser/idl.json @@ -0,0 +1,793 @@ +{ + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ", + "metadata": { + "name": "pump_fees", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "get_fees", + "docs": [ + "Get Fees" + ], + "discriminator": [ + 231, + 37, + 126, + 85, + 207, + 91, + 63, + 52 + ], + "accounts": [ + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "config_program_id" + } + ] + } + }, + { + "name": "config_program_id" + } + ], + "args": [ + { + "name": "is_pump_pool", + "type": "bool" + }, + { + "name": "market_cap_lamports", + "type": "u128" + }, + { + "name": "trade_size_lamports", + "type": "u64" + } + ], + "returns": { + "defined": { + "name": "Fees" + } + } + }, + { + "name": "initialize_fee_config", + "docs": [ + "Initialize FeeConfig admin" + ], + "discriminator": [ + 62, + 162, + 20, + 133, + 121, + 65, + 145, + 27 + ], + "accounts": [ + { + "name": "admin", + "writable": true, + "signer": true, + "address": "8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8" + }, + { + "name": "fee_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "config_program_id" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "config_program_id" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_admin", + "docs": [ + "Update admin (only callable by admin)" + ], + "discriminator": [ + 161, + 176, + 40, + 213, + 60, + 184, + 179, + 228 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "fee_config" + ] + }, + { + "name": "fee_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "config_program_id" + } + ] + } + }, + { + "name": "new_admin" + }, + { + "name": "config_program_id" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_fee_config", + "docs": [ + "Set/Replace fee parameters entirely (only callable by admin)" + ], + "discriminator": [ + 104, + 184, + 103, + 242, + 88, + 151, + 107, + 20 + ], + "accounts": [ + { + "name": "fee_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "config_program_id" + } + ] + } + }, + { + "name": "admin", + "signer": true, + "relations": [ + "fee_config" + ] + }, + { + "name": "config_program_id" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + }, + { + "name": "flat_fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + }, + { + "name": "upsert_fee_tiers", + "docs": [ + "Update or expand fee tiers (only callable by admin)" + ], + "discriminator": [ + 227, + 23, + 150, + 12, + 77, + 86, + 94, + 4 + ], + "accounts": [ + { + "name": "fee_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "config_program_id" + } + ] + } + }, + { + "name": "admin", + "signer": true, + "relations": [ + "fee_config" + ] + }, + { + "name": "config_program_id" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + }, + { + "name": "offset", + "type": "u8" + } + ] + } + ], + "accounts": [ + { + "name": "FeeConfig", + "discriminator": [ + 143, + 52, + 146, + 187, + 219, + 123, + 76, + 155 + ] + } + ], + "events": [ + { + "name": "InitializeFeeConfigEvent", + "discriminator": [ + 89, + 138, + 244, + 230, + 10, + 56, + 226, + 126 + ] + }, + { + "name": "UpdateAdminEvent", + "discriminator": [ + 225, + 152, + 171, + 87, + 246, + 63, + 66, + 234 + ] + }, + { + "name": "UpdateFeeConfigEvent", + "discriminator": [ + 90, + 23, + 65, + 35, + 62, + 244, + 188, + 208 + ] + }, + { + "name": "UpsertFeeTiersEvent", + "discriminator": [ + 171, + 89, + 169, + 187, + 122, + 186, + 33, + 204 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "UnauthorizedProgram", + "msg": "Only Pump and PumpSwap programs can call this instruction" + }, + { + "code": 6001, + "name": "InvalidAdmin", + "msg": "Invalid admin" + }, + { + "code": 6002, + "name": "NoFeeTiers", + "msg": "No fee tiers provided" + }, + { + "code": 6003, + "name": "TooManyFeeTiers", + "msg": "format" + }, + { + "code": 6004, + "name": "OffsetNotContinuous", + "msg": "The offset should be <= fee_config.fee_tiers.len()" + }, + { + "code": 6005, + "name": "FeeTiersNotSorted", + "msg": "Fee tiers must be sorted by market cap threshold (ascending)" + }, + { + "code": 6006, + "name": "InvalidFeeTotal", + "msg": "Fee total must not exceed 10_000bps" + }, + { + "code": 6007, + "name": "ZeroMarketCap", + "msg": "Market cap must be greater than 0" + }, + { + "code": 6008, + "name": "ZeroTradeSize", + "msg": "Trade size must be greater than 0" + } + ], + "types": [ + { + "name": "FeeConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "docs": [ + "The bump for the PDA" + ], + "type": "u8" + }, + { + "name": "admin", + "docs": [ + "The admin account that can update the fee config" + ], + "type": "pubkey" + }, + { + "name": "flat_fees", + "docs": [ + "The flat fees for non-pump pools" + ], + "type": { + "defined": { + "name": "Fees" + } + } + }, + { + "name": "fee_tiers", + "docs": [ + "The fee tiers" + ], + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + } + ] + } + }, + { + "name": "FeeTier", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market_cap_lamports_threshold", + "type": "u128" + }, + { + "name": "fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_fee_bps", + "type": "u64" + }, + { + "name": "protocol_fee_bps", + "type": "u64" + }, + { + "name": "creator_fee_bps", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeFeeConfigEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "fee_config", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateAdminEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "old_admin", + "type": "pubkey" + }, + { + "name": "new_admin", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateFeeConfigEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "fee_config", + "type": "pubkey" + }, + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + }, + { + "name": "flat_fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + } + }, + { + "name": "UpsertFeeTiersEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "fee_config", + "type": "pubkey" + }, + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + }, + { + "name": "offset", + "type": "u8" + } + ] + } + } + ], + "constants": [ + { + "name": "FEE_CONFIG_SEED", + "type": "bytes", + "value": "[102, 101, 101, 95, 99, 111, 110, 102, 105, 103]" + } + ] +} + diff --git a/crates/pump-fees-parser/package.json b/crates/pump-fees-parser/package.json new file mode 100644 index 00000000..f3c2e404 --- /dev/null +++ b/crates/pump-fees-parser/package.json @@ -0,0 +1,20 @@ +{ + "name": "pump-fees-parser", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "packageManager": "pnpm@10.17.0", + "dependencies": { + "@codama/nodes": "^1.3.7", + "@codama/nodes-from-anchor": "^1.2.9", + "@codama/renderers-core": "^1.2.2", + "@codama/renderers-vixen-parser": "^1.2.8", + "@codama/visitors-core": "^1.3.7" + } +} diff --git a/crates/pump-fees-parser/proto/pump_fees.proto b/crates/pump-fees-parser/proto/pump_fees.proto new file mode 100644 index 00000000..9bccc110 --- /dev/null +++ b/crates/pump-fees-parser/proto/pump_fees.proto @@ -0,0 +1,156 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! +syntax = "proto3"; + +package vixen.parser.pump_fees; + +message GetFeesIx { + GetFeesIxAccounts accounts = 1; + GetFeesIxData data = 2; +} + +message InitializeFeeConfigIx { + InitializeFeeConfigIxAccounts accounts = 1; +} + +message UpdateAdminIx { + UpdateAdminIxAccounts accounts = 1; +} + +message UpdateFeeConfigIx { + UpdateFeeConfigIxAccounts accounts = 1; + UpdateFeeConfigIxData data = 2; +} + +message UpsertFeeTiersIx { + UpsertFeeTiersIxAccounts accounts = 1; + UpsertFeeTiersIxData data = 2; +} + + +message FeeTier { + string market_cap_lamports_threshold = 1; + Fees fees = 2; +} + +message Fees { + uint64 lp_fee_bps = 1; + uint64 protocol_fee_bps = 2; + uint64 creator_fee_bps = 3; +} + +message InitializeFeeConfigEvent { + int64 timestamp = 1; + string admin = 2; + string fee_config = 3; +} + +message UpdateAdminEvent { + int64 timestamp = 1; + string old_admin = 2; + string new_admin = 3; +} + +message UpdateFeeConfigEvent { + int64 timestamp = 1; + string admin = 2; + string fee_config = 3; + repeated FeeTier fee_tiers = 4; + Fees flat_fees = 5; +} + +message UpsertFeeTiersEvent { + int64 timestamp = 1; + string admin = 2; + string fee_config = 3; + repeated FeeTier fee_tiers = 4; + uint32 offset = 5; +} + + +message FeeConfig { + uint32 bump = 1; + string admin = 2; + Fees flat_fees = 3; + repeated FeeTier fee_tiers = 4; +} + + +message GetFeesIxAccounts { + string fee_config = 1; + string config_program_id = 2; +} + +message GetFeesIxData { + bool is_pump_pool = 1; + string market_cap_lamports = 2; + uint64 trade_size_lamports = 3; +} + +message InitializeFeeConfigIxAccounts { + string admin = 1; + string fee_config = 2; + string system_program = 3; + string config_program_id = 4; + string event_authority = 5; + string program = 6; +} + + +message UpdateAdminIxAccounts { + string admin = 1; + string fee_config = 2; + string new_admin = 3; + string config_program_id = 4; + string event_authority = 5; + string program = 6; +} + + +message UpdateFeeConfigIxAccounts { + string fee_config = 1; + string admin = 2; + string config_program_id = 3; + string event_authority = 4; + string program = 5; +} + +message UpdateFeeConfigIxData { + repeated FeeTier fee_tiers = 1; + Fees flat_fees = 2; +} + +message UpsertFeeTiersIxAccounts { + string fee_config = 1; + string admin = 2; + string config_program_id = 3; + string event_authority = 4; + string program = 5; +} + +message UpsertFeeTiersIxData { + repeated FeeTier fee_tiers = 1; + uint32 offset = 2; +} + + +message ProgramState { + oneof state_oneof { + FeeConfig fee_config = 1; + } +} + +message ProgramIxs { + oneof ix_oneof { + GetFeesIx get_fees = 1; + InitializeFeeConfigIx initialize_fee_config = 2; + UpdateAdminIx update_admin = 3; + UpdateFeeConfigIx update_fee_config = 4; + UpsertFeeTiersIx upsert_fee_tiers = 5; + } +} + diff --git a/crates/pump-fees-parser/src/generated_parser/accounts_parser.rs b/crates/pump-fees-parser/src/generated_parser/accounts_parser.rs new file mode 100644 index 00000000..2b114f99 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_parser/accounts_parser.rs @@ -0,0 +1,150 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::accounts::FeeConfig; +use crate::ID; + +use crate::deserialize_checked; + +/// PumpFees Program State +#[allow(clippy::large_enum_variant)] +#[derive(Debug)] +#[cfg_attr(feature = "tracing", derive(strum_macros::Display))] +pub enum PumpFeesProgramState { + FeeConfig(FeeConfig), +} + +impl PumpFeesProgramState { + pub fn try_unpack(data_bytes: &[u8]) -> yellowstone_vixen_core::ParseResult { + let acc_discriminator: [u8; 8] = data_bytes[0..8].try_into()?; + let acc = match acc_discriminator { + [143, 52, 146, 187, 219, 123, 76, 155] => Ok(PumpFeesProgramState::FeeConfig( + deserialize_checked(data_bytes, &acc_discriminator)?, + )), + _ => Err(yellowstone_vixen_core::ParseError::from( + "Invalid Account discriminator".to_owned(), + )), + }; + + #[cfg(feature = "tracing")] + match &acc { + Ok(acc) => { + tracing::info!( + name: "correctly_parsed_account", + name = "account_update", + program = ID.to_string(), + account = acc.to_string() + ); + }, + Err(e) => { + tracing::info!( + name: "incorrectly_parsed_account", + name = "account_update", + program = ID.to_string(), + account = "error", + discriminator = ?acc_discriminator, + error = ?e + ); + }, + } + + acc + } +} + +#[derive(Debug, Copy, Clone)] +pub struct AccountParser; + +impl yellowstone_vixen_core::Parser for AccountParser { + type Input = yellowstone_vixen_core::AccountUpdate; + type Output = PumpFeesProgramState; + + fn id(&self) -> std::borrow::Cow<'static, str> { + "pump_fees::AccountParser".into() + } + + fn prefilter(&self) -> yellowstone_vixen_core::Prefilter { + yellowstone_vixen_core::Prefilter::builder() + .account_owners([ID]) + .build() + .unwrap() + } + + async fn parse( + &self, + acct: &yellowstone_vixen_core::AccountUpdate, + ) -> yellowstone_vixen_core::ParseResult { + let inner = acct + .account + .as_ref() + .ok_or(solana_program_error::ProgramError::InvalidArgument)?; + let res = PumpFeesProgramState::try_unpack(&inner.data); + + #[cfg(feature = "tracing")] + if let Err(e) = &res { + let acc_discriminator: [u8; 8] = inner.data[0..8].try_into()?; + tracing::info!( + name: "incorrectly_parsed_account", + name = "account_update", + program = ID.to_string(), + account = "deserialization_error", + discriminator = ?acc_discriminator, + error = ?e + ); + } + + res + } +} + +impl yellowstone_vixen_core::ProgramParser for AccountParser { + #[inline] + fn program_id(&self) -> yellowstone_vixen_core::Pubkey { + ID.to_bytes().into() + } +} + +// #[cfg(feature = "proto")] +mod proto_parser { + use super::{AccountParser, PumpFeesProgramState}; + use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; + use yellowstone_vixen_core::proto::ParseProto; + + use super::FeeConfig; + impl IntoProto for FeeConfig { + fn into_proto(self) -> proto_def::FeeConfig { + proto_def::FeeConfig { + bump: self.bump.into(), + admin: self.admin.to_string(), + flat_fees: Some(self.flat_fees.into_proto()), + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), + } + } + } + + impl IntoProto for PumpFeesProgramState { + fn into_proto(self) -> proto_def::ProgramState { + let state_oneof = match self { + PumpFeesProgramState::FeeConfig(data) => { + proto_def::program_state::StateOneof::FeeConfig(data.into_proto()) + }, + }; + + proto_def::ProgramState { + state_oneof: Some(state_oneof), + } + } + } + + impl ParseProto for AccountParser { + type Message = proto_def::ProgramState; + + fn output_into_message(value: Self::Output) -> Self::Message { + value.into_proto() + } + } +} diff --git a/crates/pump-fees-parser/src/generated_parser/instructions_parser.rs b/crates/pump-fees-parser/src/generated_parser/instructions_parser.rs new file mode 100644 index 00000000..b764a634 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_parser/instructions_parser.rs @@ -0,0 +1,416 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +#[cfg(feature = "shared-data")] +use std::sync::Arc; + +#[cfg(feature = "shared-data")] +use yellowstone_vixen_core::InstructionUpdateOutput; + +use crate::deserialize_checked; + +use crate::instructions::{ + GetFees as GetFeesIxAccounts, GetFeesInstructionArgs as GetFeesIxData, + InitializeFeeConfig as InitializeFeeConfigIxAccounts, UpdateAdmin as UpdateAdminIxAccounts, + UpdateFeeConfig as UpdateFeeConfigIxAccounts, + UpdateFeeConfigInstructionArgs as UpdateFeeConfigIxData, + UpsertFeeTiers as UpsertFeeTiersIxAccounts, + UpsertFeeTiersInstructionArgs as UpsertFeeTiersIxData, +}; +use crate::ID; + +/// PumpFees Instructions +#[derive(Debug)] +#[cfg_attr(feature = "tracing", derive(strum_macros::Display))] +pub enum PumpFeesProgramIx { + GetFees(GetFeesIxAccounts, GetFeesIxData), + InitializeFeeConfig(InitializeFeeConfigIxAccounts), + UpdateAdmin(UpdateAdminIxAccounts), + UpdateFeeConfig(UpdateFeeConfigIxAccounts, UpdateFeeConfigIxData), + UpsertFeeTiers(UpsertFeeTiersIxAccounts, UpsertFeeTiersIxData), +} + +#[derive(Debug, Copy, Clone)] +pub struct InstructionParser; + +impl yellowstone_vixen_core::Parser for InstructionParser { + type Input = yellowstone_vixen_core::instruction::InstructionUpdate; + + #[cfg(not(feature = "shared-data"))] + type Output = PumpFeesProgramIx; + + #[cfg(feature = "shared-data")] + type Output = InstructionUpdateOutput; + + fn id(&self) -> std::borrow::Cow<'static, str> { + "PumpFees::InstructionParser".into() + } + + fn prefilter(&self) -> yellowstone_vixen_core::Prefilter { + yellowstone_vixen_core::Prefilter::builder() + .transaction_accounts([ID]) + .build() + .unwrap() + } + + async fn parse( + &self, + ix_update: &yellowstone_vixen_core::instruction::InstructionUpdate, + ) -> yellowstone_vixen_core::ParseResult { + if ix_update.program.equals_ref(ID) { + let res = InstructionParser::parse_impl(ix_update); + + #[cfg(feature = "tracing")] + if let Err(e) = &res { + let ix_discriminator: [u8; 8] = ix_update.data[0..8].try_into()?; + + tracing::info!( + name: "incorrectly_parsed_instruction", + name = "ix_update", + program = ID.to_string(), + ix = "deserialization_error", + discriminator = ?ix_discriminator, + error = ?e + ); + } + + res + } else { + Err(yellowstone_vixen_core::ParseError::Filtered) + } + } +} + +impl yellowstone_vixen_core::ProgramParser for InstructionParser { + #[inline] + fn program_id(&self) -> yellowstone_vixen_core::Pubkey { + ID.to_bytes().into() + } +} + +impl InstructionParser { + pub(crate) fn parse_impl( + ix: &yellowstone_vixen_core::instruction::InstructionUpdate, + ) -> yellowstone_vixen_core::ParseResult<::Output> { + let accounts_len = ix.accounts.len(); + let accounts = &mut ix.accounts.iter(); + + #[cfg(feature = "shared-data")] + let shared_data = Arc::clone(&ix.shared); + + let ix_discriminator: [u8; 8] = ix.data[0..8].try_into()?; + let ix_data = &ix.data[8..]; + let ix = match ix_discriminator { + [231, 37, 126, 85, 207, 91, 63, 52] => { + let expected_accounts_len = 2; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = GetFeesIxAccounts { + fee_config: next_account(accounts)?, + config_program_id: next_account(accounts)?, + }; + let de_ix_data: GetFeesIxData = deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpFeesProgramIx::GetFees(ix_accounts, de_ix_data)) + }, + [62, 162, 20, 133, 121, 65, 145, 27] => { + let expected_accounts_len = 6; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = InitializeFeeConfigIxAccounts { + admin: next_account(accounts)?, + fee_config: next_account(accounts)?, + system_program: next_account(accounts)?, + config_program_id: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpFeesProgramIx::InitializeFeeConfig(ix_accounts)) + }, + [161, 176, 40, 213, 60, 184, 179, 228] => { + let expected_accounts_len = 6; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = UpdateAdminIxAccounts { + admin: next_account(accounts)?, + fee_config: next_account(accounts)?, + new_admin: next_account(accounts)?, + config_program_id: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpFeesProgramIx::UpdateAdmin(ix_accounts)) + }, + [104, 184, 103, 242, 88, 151, 107, 20] => { + let expected_accounts_len = 5; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = UpdateFeeConfigIxAccounts { + fee_config: next_account(accounts)?, + admin: next_account(accounts)?, + config_program_id: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: UpdateFeeConfigIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpFeesProgramIx::UpdateFeeConfig(ix_accounts, de_ix_data)) + }, + [227, 23, 150, 12, 77, 86, 94, 4] => { + let expected_accounts_len = 5; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = UpsertFeeTiersIxAccounts { + fee_config: next_account(accounts)?, + admin: next_account(accounts)?, + config_program_id: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: UpsertFeeTiersIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpFeesProgramIx::UpsertFeeTiers(ix_accounts, de_ix_data)) + }, + _ => Err(yellowstone_vixen_core::ParseError::from( + "Invalid Instruction discriminator".to_owned(), + )), + }; + + #[cfg(feature = "tracing")] + match &ix { + Ok(ix) => { + tracing::info!( + name: "correctly_parsed_instruction", + name = "ix_update", + program = ID.to_string(), + ix = ix.to_string() + ); + }, + Err(e) => { + tracing::info!( + name: "incorrectly_parsed_instruction", + name = "ix_update", + program = ID.to_string(), + ix = "error", + discriminator = ?ix_discriminator, + error = ?e + ); + }, + } + + #[cfg(not(feature = "shared-data"))] + return ix; + + #[cfg(feature = "shared-data")] + ix.map(|ix| InstructionUpdateOutput { + parsed_ix: ix, + shared_data, + }) + } +} + +pub fn check_min_accounts_req( + actual: usize, + expected: usize, +) -> yellowstone_vixen_core::ParseResult<()> { + if actual < expected { + Err(yellowstone_vixen_core::ParseError::from(format!( + "Too few accounts provided: expected {expected}, got {actual}" + ))) + } else { + Ok(()) + } +} + +fn next_account<'a, T: Iterator>>( + accounts: &mut T, +) -> Result { + accounts + .next() + .ok_or(yellowstone_vixen_core::ParseError::from( + "No more accounts to parse", + )) + .map(|acc| acc.0.into()) +} + +/// Gets the next optional account using the ommited account strategy (account is not passed at all at the instruction). +/// ### Be careful to use this function when more than one account is optional in the Instruction. +/// Only by order there is no way to which ones of the optional accounts are present. +pub fn next_optional_account<'a, T: Iterator>>( + accounts: &mut T, + actual_accounts_len: usize, + expected_accounts_len: &mut usize, +) -> Result, yellowstone_vixen_core::ParseError> { + if actual_accounts_len == *expected_accounts_len + 1 { + *expected_accounts_len += 1; + Ok(Some(next_account(accounts)?)) + } else { + Ok(None) + } +} + +/// Gets the next optional account using the traditional Program ID strategy. +/// (If account key is the program ID, means account is not present) +pub fn next_program_id_optional_account< + 'a, + T: Iterator>, +>( + accounts: &mut T, +) -> Result, yellowstone_vixen_core::ParseError> { + let account_key = next_account(accounts)?; + if account_key.eq(&ID) { + Ok(None) + } else { + Ok(Some(account_key)) + } +} + +// #[cfg(feature = "proto")] +mod proto_parser { + use super::{InstructionParser, PumpFeesProgramIx}; + use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; + use yellowstone_vixen_core::proto::ParseProto; + + use super::GetFeesIxAccounts; + impl IntoProto for GetFeesIxAccounts { + fn into_proto(self) -> proto_def::GetFeesIxAccounts { + proto_def::GetFeesIxAccounts { + fee_config: self.fee_config.to_string(), + config_program_id: self.config_program_id.to_string(), + } + } + } + use super::GetFeesIxData; + impl IntoProto for GetFeesIxData { + fn into_proto(self) -> proto_def::GetFeesIxData { + proto_def::GetFeesIxData { + is_pump_pool: self.is_pump_pool, + market_cap_lamports: self.market_cap_lamports.to_string(), + trade_size_lamports: self.trade_size_lamports, + } + } + } + use super::InitializeFeeConfigIxAccounts; + impl IntoProto for InitializeFeeConfigIxAccounts { + fn into_proto(self) -> proto_def::InitializeFeeConfigIxAccounts { + proto_def::InitializeFeeConfigIxAccounts { + admin: self.admin.to_string(), + fee_config: self.fee_config.to_string(), + system_program: self.system_program.to_string(), + config_program_id: self.config_program_id.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::UpdateAdminIxAccounts; + impl IntoProto for UpdateAdminIxAccounts { + fn into_proto(self) -> proto_def::UpdateAdminIxAccounts { + proto_def::UpdateAdminIxAccounts { + admin: self.admin.to_string(), + fee_config: self.fee_config.to_string(), + new_admin: self.new_admin.to_string(), + config_program_id: self.config_program_id.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::UpdateFeeConfigIxAccounts; + impl IntoProto for UpdateFeeConfigIxAccounts { + fn into_proto(self) -> proto_def::UpdateFeeConfigIxAccounts { + proto_def::UpdateFeeConfigIxAccounts { + fee_config: self.fee_config.to_string(), + admin: self.admin.to_string(), + config_program_id: self.config_program_id.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::UpdateFeeConfigIxData; + impl IntoProto for UpdateFeeConfigIxData { + fn into_proto(self) -> proto_def::UpdateFeeConfigIxData { + proto_def::UpdateFeeConfigIxData { + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), + flat_fees: Some(self.flat_fees.into_proto()), + } + } + } + use super::UpsertFeeTiersIxAccounts; + impl IntoProto for UpsertFeeTiersIxAccounts { + fn into_proto(self) -> proto_def::UpsertFeeTiersIxAccounts { + proto_def::UpsertFeeTiersIxAccounts { + fee_config: self.fee_config.to_string(), + admin: self.admin.to_string(), + config_program_id: self.config_program_id.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::UpsertFeeTiersIxData; + impl IntoProto for UpsertFeeTiersIxData { + fn into_proto(self) -> proto_def::UpsertFeeTiersIxData { + proto_def::UpsertFeeTiersIxData { + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), + offset: self.offset.into(), + } + } + } + + impl IntoProto for PumpFeesProgramIx { + fn into_proto(self) -> proto_def::ProgramIxs { + match self { + PumpFeesProgramIx::GetFees(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::GetFees( + proto_def::GetFeesIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpFeesProgramIx::InitializeFeeConfig(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::InitializeFeeConfig( + proto_def::InitializeFeeConfigIx { + accounts: Some(acc.into_proto()), + }, + )), + }, + PumpFeesProgramIx::UpdateAdmin(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::UpdateAdmin( + proto_def::UpdateAdminIx { + accounts: Some(acc.into_proto()), + }, + )), + }, + PumpFeesProgramIx::UpdateFeeConfig(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::UpdateFeeConfig( + proto_def::UpdateFeeConfigIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpFeesProgramIx::UpsertFeeTiers(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::UpsertFeeTiers( + proto_def::UpsertFeeTiersIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + } + } + } + + impl ParseProto for InstructionParser { + type Message = proto_def::ProgramIxs; + + fn output_into_message(value: Self::Output) -> Self::Message { + #[cfg(not(feature = "shared-data"))] + return value.into_proto(); + + #[cfg(feature = "shared-data")] + value.parsed_ix.into_proto() + } + } +} diff --git a/crates/pump-fees-parser/src/generated_parser/mod.rs b/crates/pump-fees-parser/src/generated_parser/mod.rs new file mode 100644 index 00000000..e4c7b5b2 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_parser/mod.rs @@ -0,0 +1,34 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub mod accounts_parser; + +pub mod instructions_parser; + +pub mod proto_helpers; + +/// Deserialize a Borsh-encoded account, checking that all significant bytes are read. +pub fn deserialize_checked( + data: &[u8], + _discriminator: &[u8], +) -> Result { + let mut data_bytes = data; + let account = T::deserialize(&mut data_bytes)?; + + if !data_bytes.is_empty() && data_bytes.iter().any(|b| *b != 0) { + #[cfg(feature = "tracing")] + tracing::warn!( + name: "non_zeroed_end_bytes", + name = "non_zeroed_end_bytes", + length = data_bytes.len(), + program = crate::ID.to_string(), + type_name = ?_discriminator, + ); + } + + Ok(account) +} diff --git a/crates/pump-fees-parser/src/generated_parser/proto_helpers.rs b/crates/pump-fees-parser/src/generated_parser/proto_helpers.rs new file mode 100644 index 00000000..84dde48f --- /dev/null +++ b/crates/pump-fees-parser/src/generated_parser/proto_helpers.rs @@ -0,0 +1,77 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +// #[cfg(feature = "proto")] +pub mod proto_types_parsers { + use yellowstone_vixen_core::proto_helper_traits; + proto_helper_traits!(); + use crate::proto_def; + + use crate::types::FeeTier; + impl IntoProto for FeeTier { + fn into_proto(self) -> proto_def::FeeTier { + proto_def::FeeTier { + market_cap_lamports_threshold: self.market_cap_lamports_threshold.to_string(), + fees: Some(self.fees.into_proto()), + } + } + } + use crate::types::Fees; + impl IntoProto for Fees { + fn into_proto(self) -> proto_def::Fees { + proto_def::Fees { + lp_fee_bps: self.lp_fee_bps, + protocol_fee_bps: self.protocol_fee_bps, + creator_fee_bps: self.creator_fee_bps, + } + } + } + use crate::types::InitializeFeeConfigEvent; + impl IntoProto for InitializeFeeConfigEvent { + fn into_proto(self) -> proto_def::InitializeFeeConfigEvent { + proto_def::InitializeFeeConfigEvent { + timestamp: self.timestamp, + admin: self.admin.to_string(), + fee_config: self.fee_config.to_string(), + } + } + } + use crate::types::UpdateAdminEvent; + impl IntoProto for UpdateAdminEvent { + fn into_proto(self) -> proto_def::UpdateAdminEvent { + proto_def::UpdateAdminEvent { + timestamp: self.timestamp, + old_admin: self.old_admin.to_string(), + new_admin: self.new_admin.to_string(), + } + } + } + use crate::types::UpdateFeeConfigEvent; + impl IntoProto for UpdateFeeConfigEvent { + fn into_proto(self) -> proto_def::UpdateFeeConfigEvent { + proto_def::UpdateFeeConfigEvent { + timestamp: self.timestamp, + admin: self.admin.to_string(), + fee_config: self.fee_config.to_string(), + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), + flat_fees: Some(self.flat_fees.into_proto()), + } + } + } + use crate::types::UpsertFeeTiersEvent; + impl IntoProto for UpsertFeeTiersEvent { + fn into_proto(self) -> proto_def::UpsertFeeTiersEvent { + proto_def::UpsertFeeTiersEvent { + timestamp: self.timestamp, + admin: self.admin.to_string(), + fee_config: self.fee_config.to_string(), + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), + offset: self.offset.into(), + } + } + } +} diff --git a/crates/pump-fees-parser/src/generated_sdk/accounts/fee_config.rs b/crates/pump-fees-parser/src/generated_sdk/accounts/fee_config.rs new file mode 100644 index 00000000..96896bd4 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/accounts/fee_config.rs @@ -0,0 +1,144 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FeeConfig { + pub discriminator: [u8; 8], + /// The bump for the PDA + pub bump: u8, + /// The admin account that can update the fee config + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin: Pubkey, + /// The flat fees for non-pump pools + pub flat_fees: Fees, + /// The fee tiers + pub fee_tiers: Vec, +} + +pub const FEE_CONFIG_DISCRIMINATOR: [u8; 8] = [143, 52, 146, 187, 219, 123, 76, 155]; + +impl FeeConfig { + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for FeeConfig { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_fee_config(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = FeeConfig::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_fee_config(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = FeeConfig::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for FeeConfig { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for FeeConfig {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for FeeConfig { + fn owner() -> Pubkey { + crate::PUMP_FEES_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for FeeConfig {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for FeeConfig { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pump-fees-parser/src/generated_sdk/accounts/mod.rs b/crates/pump-fees-parser/src/generated_sdk/accounts/mod.rs new file mode 100644 index 00000000..37828796 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/accounts/mod.rs @@ -0,0 +1,10 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod r#fee_config; + +pub use self::r#fee_config::*; diff --git a/crates/pump-fees-parser/src/generated_sdk/errors/mod.rs b/crates/pump-fees-parser/src/generated_sdk/errors/mod.rs new file mode 100644 index 00000000..fde169e2 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/errors/mod.rs @@ -0,0 +1,10 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod pump_fees; + +pub use self::pump_fees::PumpFeesError; diff --git a/crates/pump-fees-parser/src/generated_sdk/errors/pump_fees.rs b/crates/pump-fees-parser/src/generated_sdk/errors/pump_fees.rs new file mode 100644 index 00000000..93042df3 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/errors/pump_fees.rs @@ -0,0 +1,46 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use num_derive::FromPrimitive; +use thiserror::Error; + +#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] +pub enum PumpFeesError { + /// 6000 - Only Pump and PumpSwap programs can call this instruction + #[error("Only Pump and PumpSwap programs can call this instruction")] + UnauthorizedProgram = 0x1770, + /// 6001 - Invalid admin + #[error("Invalid admin")] + InvalidAdmin = 0x1771, + /// 6002 - No fee tiers provided + #[error("No fee tiers provided")] + NoFeeTiers = 0x1772, + /// 6003 - format + #[error("format")] + TooManyFeeTiers = 0x1773, + /// 6004 - The offset should be <= fee_config.fee_tiers.len() + #[error("The offset should be <= fee_config.fee_tiers.len()")] + OffsetNotContinuous = 0x1774, + /// 6005 - Fee tiers must be sorted by market cap threshold (ascending) + #[error("Fee tiers must be sorted by market cap threshold (ascending)")] + FeeTiersNotSorted = 0x1775, + /// 6006 - Fee total must not exceed 10_000bps + #[error("Fee total must not exceed 10_000bps")] + InvalidFeeTotal = 0x1776, + /// 6007 - Market cap must be greater than 0 + #[error("Market cap must be greater than 0")] + ZeroMarketCap = 0x1777, + /// 6008 - Trade size must be greater than 0 + #[error("Trade size must be greater than 0")] + ZeroTradeSize = 0x1778, +} + +impl From for solana_program_error::ProgramError { + fn from(e: PumpFeesError) -> Self { + solana_program_error::ProgramError::Custom(e as u32) + } +} diff --git a/crates/pump-fees-parser/src/generated_sdk/instructions/get_fees.rs b/crates/pump-fees-parser/src/generated_sdk/instructions/get_fees.rs new file mode 100644 index 00000000..13fb88ad --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/instructions/get_fees.rs @@ -0,0 +1,406 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const GET_FEES_DISCRIMINATOR: [u8; 8] = [231, 37, 126, 85, 207, 91, 63, 52]; + +/// Accounts. +#[derive(Debug)] +pub struct GetFees { + pub fee_config: solana_pubkey::Pubkey, + + pub config_program_id: solana_pubkey::Pubkey, +} + +impl GetFees { + pub fn instruction(&self, args: GetFeesInstructionArgs) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: GetFeesInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(2 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.config_program_id, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = GetFeesInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct GetFeesInstructionData { + discriminator: [u8; 8], +} + +impl GetFeesInstructionData { + pub fn new() -> Self { + Self { + discriminator: [231, 37, 126, 85, 207, 91, 63, 52], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for GetFeesInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct GetFeesInstructionArgs { + pub is_pump_pool: bool, + pub market_cap_lamports: u128, + pub trade_size_lamports: u64, +} + +impl GetFeesInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `GetFees`. +/// +/// ### Accounts: +/// +/// 0. `[]` fee_config +/// 1. `[]` config_program_id +#[derive(Clone, Debug, Default)] +pub struct GetFeesBuilder { + fee_config: Option, + config_program_id: Option, + is_pump_pool: Option, + market_cap_lamports: Option, + trade_size_lamports: Option, + __remaining_accounts: Vec, +} + +impl GetFeesBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn config_program_id(&mut self, config_program_id: solana_pubkey::Pubkey) -> &mut Self { + self.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn is_pump_pool(&mut self, is_pump_pool: bool) -> &mut Self { + self.is_pump_pool = Some(is_pump_pool); + self + } + #[inline(always)] + pub fn market_cap_lamports(&mut self, market_cap_lamports: u128) -> &mut Self { + self.market_cap_lamports = Some(market_cap_lamports); + self + } + #[inline(always)] + pub fn trade_size_lamports(&mut self, trade_size_lamports: u64) -> &mut Self { + self.trade_size_lamports = Some(trade_size_lamports); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = GetFees { + fee_config: self.fee_config.expect("fee_config is not set"), + config_program_id: self + .config_program_id + .expect("config_program_id is not set"), + }; + let args = GetFeesInstructionArgs { + is_pump_pool: self.is_pump_pool.clone().expect("is_pump_pool is not set"), + market_cap_lamports: self + .market_cap_lamports + .clone() + .expect("market_cap_lamports is not set"), + trade_size_lamports: self + .trade_size_lamports + .clone() + .expect("trade_size_lamports is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `get_fees` CPI accounts. +pub struct GetFeesCpiAccounts<'a, 'b> { + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, +} + +/// `get_fees` CPI instruction. +pub struct GetFeesCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: GetFeesInstructionArgs, +} + +impl<'a, 'b> GetFeesCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: GetFeesCpiAccounts<'a, 'b>, + args: GetFeesInstructionArgs, + ) -> Self { + Self { + __program: program, + fee_config: accounts.fee_config, + config_program_id: accounts.config_program_id, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(2 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.config_program_id.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = GetFeesInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(3 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.config_program_id.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `GetFees` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` fee_config +/// 1. `[]` config_program_id +#[derive(Clone, Debug)] +pub struct GetFeesCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> GetFeesCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(GetFeesCpiBuilderInstruction { + __program: program, + fee_config: None, + config_program_id: None, + is_pump_pool: None, + market_cap_lamports: None, + trade_size_lamports: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn config_program_id( + &mut self, + config_program_id: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn is_pump_pool(&mut self, is_pump_pool: bool) -> &mut Self { + self.instruction.is_pump_pool = Some(is_pump_pool); + self + } + #[inline(always)] + pub fn market_cap_lamports(&mut self, market_cap_lamports: u128) -> &mut Self { + self.instruction.market_cap_lamports = Some(market_cap_lamports); + self + } + #[inline(always)] + pub fn trade_size_lamports(&mut self, trade_size_lamports: u64) -> &mut Self { + self.instruction.trade_size_lamports = Some(trade_size_lamports); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = GetFeesInstructionArgs { + is_pump_pool: self + .instruction + .is_pump_pool + .clone() + .expect("is_pump_pool is not set"), + market_cap_lamports: self + .instruction + .market_cap_lamports + .clone() + .expect("market_cap_lamports is not set"), + trade_size_lamports: self + .instruction + .trade_size_lamports + .clone() + .expect("trade_size_lamports is not set"), + }; + let instruction = GetFeesCpi { + __program: self.instruction.__program, + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + config_program_id: self + .instruction + .config_program_id + .expect("config_program_id is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct GetFeesCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + config_program_id: Option<&'b solana_account_info::AccountInfo<'a>>, + is_pump_pool: Option, + market_cap_lamports: Option, + trade_size_lamports: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/instructions/initialize_fee_config.rs b/crates/pump-fees-parser/src/generated_sdk/instructions/initialize_fee_config.rs new file mode 100644 index 00000000..ee18fc6a --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/instructions/initialize_fee_config.rs @@ -0,0 +1,464 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const INITIALIZE_FEE_CONFIG_DISCRIMINATOR: [u8; 8] = [62, 162, 20, 133, 121, 65, 145, 27]; + +/// Accounts. +#[derive(Debug)] +pub struct InitializeFeeConfig { + pub admin: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub config_program_id: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl InitializeFeeConfig { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.admin, true)); + accounts.push(solana_instruction::AccountMeta::new(self.fee_config, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.config_program_id, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = InitializeFeeConfigInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitializeFeeConfigInstructionData { + discriminator: [u8; 8], +} + +impl InitializeFeeConfigInstructionData { + pub fn new() -> Self { + Self { + discriminator: [62, 162, 20, 133, 121, 65, 145, 27], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for InitializeFeeConfigInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `InitializeFeeConfig`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer, optional]` admin (default to `8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8`) +/// 1. `[writable]` fee_config +/// 2. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 3. `[]` config_program_id +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug, Default)] +pub struct InitializeFeeConfigBuilder { + admin: Option, + fee_config: Option, + system_program: Option, + config_program_id: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl InitializeFeeConfigBuilder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account, default to '8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8']` + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn config_program_id(&mut self, config_program_id: solana_pubkey::Pubkey) -> &mut Self { + self.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = InitializeFeeConfig { + admin: self.admin.unwrap_or(solana_pubkey::pubkey!( + "8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8" + )), + fee_config: self.fee_config.expect("fee_config is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + config_program_id: self + .config_program_id + .expect("config_program_id is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `initialize_fee_config` CPI accounts. +pub struct InitializeFeeConfigCpiAccounts<'a, 'b> { + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `initialize_fee_config` CPI instruction. +pub struct InitializeFeeConfigCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> InitializeFeeConfigCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: InitializeFeeConfigCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + admin: accounts.admin, + fee_config: accounts.fee_config, + system_program: accounts.system_program, + config_program_id: accounts.config_program_id, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.admin.key, true)); + accounts.push(solana_instruction::AccountMeta::new( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.config_program_id.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = InitializeFeeConfigInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.config_program_id.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `InitializeFeeConfig` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` admin +/// 1. `[writable]` fee_config +/// 2. `[]` system_program +/// 3. `[]` config_program_id +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug)] +pub struct InitializeFeeConfigCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> InitializeFeeConfigCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(InitializeFeeConfigCpiBuilderInstruction { + __program: program, + admin: None, + fee_config: None, + system_program: None, + config_program_id: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn config_program_id( + &mut self, + config_program_id: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = InitializeFeeConfigCpi { + __program: self.instruction.__program, + + admin: self.instruction.admin.expect("admin is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + config_program_id: self + .instruction + .config_program_id + .expect("config_program_id is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct InitializeFeeConfigCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + config_program_id: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/instructions/mod.rs b/crates/pump-fees-parser/src/generated_sdk/instructions/mod.rs new file mode 100644 index 00000000..4f003796 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/instructions/mod.rs @@ -0,0 +1,18 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod r#get_fees; +pub(crate) mod r#initialize_fee_config; +pub(crate) mod r#update_admin; +pub(crate) mod r#update_fee_config; +pub(crate) mod r#upsert_fee_tiers; + +pub use self::r#get_fees::*; +pub use self::r#initialize_fee_config::*; +pub use self::r#update_admin::*; +pub use self::r#update_fee_config::*; +pub use self::r#upsert_fee_tiers::*; diff --git a/crates/pump-fees-parser/src/generated_sdk/instructions/update_admin.rs b/crates/pump-fees-parser/src/generated_sdk/instructions/update_admin.rs new file mode 100644 index 00000000..66d0e547 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/instructions/update_admin.rs @@ -0,0 +1,453 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const UPDATE_ADMIN_DISCRIMINATOR: [u8; 8] = [161, 176, 40, 213, 60, 184, 179, 228]; + +/// Accounts. +#[derive(Debug)] +pub struct UpdateAdmin { + pub admin: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub new_admin: solana_pubkey::Pubkey, + + pub config_program_id: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl UpdateAdmin { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin, true, + )); + accounts.push(solana_instruction::AccountMeta::new(self.fee_config, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.new_admin, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.config_program_id, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = UpdateAdminInstructionData::new().try_to_vec().unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpdateAdminInstructionData { + discriminator: [u8; 8], +} + +impl UpdateAdminInstructionData { + pub fn new() -> Self { + Self { + discriminator: [161, 176, 40, 213, 60, 184, 179, 228], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for UpdateAdminInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `UpdateAdmin`. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin +/// 1. `[writable]` fee_config +/// 2. `[]` new_admin +/// 3. `[]` config_program_id +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug, Default)] +pub struct UpdateAdminBuilder { + admin: Option, + fee_config: Option, + new_admin: Option, + config_program_id: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl UpdateAdminBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn new_admin(&mut self, new_admin: solana_pubkey::Pubkey) -> &mut Self { + self.new_admin = Some(new_admin); + self + } + #[inline(always)] + pub fn config_program_id(&mut self, config_program_id: solana_pubkey::Pubkey) -> &mut Self { + self.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = UpdateAdmin { + admin: self.admin.expect("admin is not set"), + fee_config: self.fee_config.expect("fee_config is not set"), + new_admin: self.new_admin.expect("new_admin is not set"), + config_program_id: self + .config_program_id + .expect("config_program_id is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `update_admin` CPI accounts. +pub struct UpdateAdminCpiAccounts<'a, 'b> { + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub new_admin: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `update_admin` CPI instruction. +pub struct UpdateAdminCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub new_admin: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> UpdateAdminCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: UpdateAdminCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + admin: accounts.admin, + fee_config: accounts.fee_config, + new_admin: accounts.new_admin, + config_program_id: accounts.config_program_id, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.new_admin.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.config_program_id.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = UpdateAdminInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.new_admin.clone()); + account_infos.push(self.config_program_id.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `UpdateAdmin` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin +/// 1. `[writable]` fee_config +/// 2. `[]` new_admin +/// 3. `[]` config_program_id +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug)] +pub struct UpdateAdminCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> UpdateAdminCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAdminCpiBuilderInstruction { + __program: program, + admin: None, + fee_config: None, + new_admin: None, + config_program_id: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn new_admin(&mut self, new_admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.new_admin = Some(new_admin); + self + } + #[inline(always)] + pub fn config_program_id( + &mut self, + config_program_id: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = UpdateAdminCpi { + __program: self.instruction.__program, + + admin: self.instruction.admin.expect("admin is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + new_admin: self.instruction.new_admin.expect("new_admin is not set"), + + config_program_id: self + .instruction + .config_program_id + .expect("config_program_id is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct UpdateAdminCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + new_admin: Option<&'b solana_account_info::AccountInfo<'a>>, + config_program_id: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/instructions/update_fee_config.rs b/crates/pump-fees-parser/src/generated_sdk/instructions/update_fee_config.rs new file mode 100644 index 00000000..cf8d9964 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/instructions/update_fee_config.rs @@ -0,0 +1,489 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const UPDATE_FEE_CONFIG_DISCRIMINATOR: [u8; 8] = [104, 184, 103, 242, 88, 151, 107, 20]; + +/// Accounts. +#[derive(Debug)] +pub struct UpdateFeeConfig { + pub fee_config: solana_pubkey::Pubkey, + + pub admin: solana_pubkey::Pubkey, + + pub config_program_id: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl UpdateFeeConfig { + pub fn instruction( + &self, + args: UpdateFeeConfigInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: UpdateFeeConfigInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.fee_config, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin, true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.config_program_id, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = UpdateFeeConfigInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpdateFeeConfigInstructionData { + discriminator: [u8; 8], +} + +impl UpdateFeeConfigInstructionData { + pub fn new() -> Self { + Self { + discriminator: [104, 184, 103, 242, 88, 151, 107, 20], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for UpdateFeeConfigInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpdateFeeConfigInstructionArgs { + pub fee_tiers: Vec, + pub flat_fees: Fees, +} + +impl UpdateFeeConfigInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `UpdateFeeConfig`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` fee_config +/// 1. `[signer]` admin +/// 2. `[]` config_program_id +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug, Default)] +pub struct UpdateFeeConfigBuilder { + fee_config: Option, + admin: Option, + config_program_id: Option, + event_authority: Option, + program: Option, + fee_tiers: Option>, + flat_fees: Option, + __remaining_accounts: Vec, +} + +impl UpdateFeeConfigBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn config_program_id(&mut self, config_program_id: solana_pubkey::Pubkey) -> &mut Self { + self.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn fee_tiers(&mut self, fee_tiers: Vec) -> &mut Self { + self.fee_tiers = Some(fee_tiers); + self + } + #[inline(always)] + pub fn flat_fees(&mut self, flat_fees: Fees) -> &mut Self { + self.flat_fees = Some(flat_fees); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = UpdateFeeConfig { + fee_config: self.fee_config.expect("fee_config is not set"), + admin: self.admin.expect("admin is not set"), + config_program_id: self + .config_program_id + .expect("config_program_id is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = UpdateFeeConfigInstructionArgs { + fee_tiers: self.fee_tiers.clone().expect("fee_tiers is not set"), + flat_fees: self.flat_fees.clone().expect("flat_fees is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `update_fee_config` CPI accounts. +pub struct UpdateFeeConfigCpiAccounts<'a, 'b> { + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `update_fee_config` CPI instruction. +pub struct UpdateFeeConfigCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: UpdateFeeConfigInstructionArgs, +} + +impl<'a, 'b> UpdateFeeConfigCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: UpdateFeeConfigCpiAccounts<'a, 'b>, + args: UpdateFeeConfigInstructionArgs, + ) -> Self { + Self { + __program: program, + fee_config: accounts.fee_config, + admin: accounts.admin, + config_program_id: accounts.config_program_id, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.config_program_id.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = UpdateFeeConfigInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.config_program_id.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `UpdateFeeConfig` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` fee_config +/// 1. `[signer]` admin +/// 2. `[]` config_program_id +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug)] +pub struct UpdateFeeConfigCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateFeeConfigCpiBuilderInstruction { + __program: program, + fee_config: None, + admin: None, + config_program_id: None, + event_authority: None, + program: None, + fee_tiers: None, + flat_fees: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn config_program_id( + &mut self, + config_program_id: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn fee_tiers(&mut self, fee_tiers: Vec) -> &mut Self { + self.instruction.fee_tiers = Some(fee_tiers); + self + } + #[inline(always)] + pub fn flat_fees(&mut self, flat_fees: Fees) -> &mut Self { + self.instruction.flat_fees = Some(flat_fees); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = UpdateFeeConfigInstructionArgs { + fee_tiers: self + .instruction + .fee_tiers + .clone() + .expect("fee_tiers is not set"), + flat_fees: self + .instruction + .flat_fees + .clone() + .expect("flat_fees is not set"), + }; + let instruction = UpdateFeeConfigCpi { + __program: self.instruction.__program, + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + admin: self.instruction.admin.expect("admin is not set"), + + config_program_id: self + .instruction + .config_program_id + .expect("config_program_id is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct UpdateFeeConfigCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + config_program_id: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_tiers: Option>, + flat_fees: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/instructions/upsert_fee_tiers.rs b/crates/pump-fees-parser/src/generated_sdk/instructions/upsert_fee_tiers.rs new file mode 100644 index 00000000..71851376 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/instructions/upsert_fee_tiers.rs @@ -0,0 +1,484 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const UPSERT_FEE_TIERS_DISCRIMINATOR: [u8; 8] = [227, 23, 150, 12, 77, 86, 94, 4]; + +/// Accounts. +#[derive(Debug)] +pub struct UpsertFeeTiers { + pub fee_config: solana_pubkey::Pubkey, + + pub admin: solana_pubkey::Pubkey, + + pub config_program_id: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl UpsertFeeTiers { + pub fn instruction( + &self, + args: UpsertFeeTiersInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: UpsertFeeTiersInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.fee_config, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin, true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.config_program_id, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = UpsertFeeTiersInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpsertFeeTiersInstructionData { + discriminator: [u8; 8], +} + +impl UpsertFeeTiersInstructionData { + pub fn new() -> Self { + Self { + discriminator: [227, 23, 150, 12, 77, 86, 94, 4], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for UpsertFeeTiersInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpsertFeeTiersInstructionArgs { + pub fee_tiers: Vec, + pub offset: u8, +} + +impl UpsertFeeTiersInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `UpsertFeeTiers`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` fee_config +/// 1. `[signer]` admin +/// 2. `[]` config_program_id +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug, Default)] +pub struct UpsertFeeTiersBuilder { + fee_config: Option, + admin: Option, + config_program_id: Option, + event_authority: Option, + program: Option, + fee_tiers: Option>, + offset: Option, + __remaining_accounts: Vec, +} + +impl UpsertFeeTiersBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn config_program_id(&mut self, config_program_id: solana_pubkey::Pubkey) -> &mut Self { + self.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn fee_tiers(&mut self, fee_tiers: Vec) -> &mut Self { + self.fee_tiers = Some(fee_tiers); + self + } + #[inline(always)] + pub fn offset(&mut self, offset: u8) -> &mut Self { + self.offset = Some(offset); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = UpsertFeeTiers { + fee_config: self.fee_config.expect("fee_config is not set"), + admin: self.admin.expect("admin is not set"), + config_program_id: self + .config_program_id + .expect("config_program_id is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = UpsertFeeTiersInstructionArgs { + fee_tiers: self.fee_tiers.clone().expect("fee_tiers is not set"), + offset: self.offset.clone().expect("offset is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `upsert_fee_tiers` CPI accounts. +pub struct UpsertFeeTiersCpiAccounts<'a, 'b> { + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `upsert_fee_tiers` CPI instruction. +pub struct UpsertFeeTiersCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub config_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: UpsertFeeTiersInstructionArgs, +} + +impl<'a, 'b> UpsertFeeTiersCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: UpsertFeeTiersCpiAccounts<'a, 'b>, + args: UpsertFeeTiersInstructionArgs, + ) -> Self { + Self { + __program: program, + fee_config: accounts.fee_config, + admin: accounts.admin, + config_program_id: accounts.config_program_id, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.config_program_id.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = UpsertFeeTiersInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_FEES_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.config_program_id.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `UpsertFeeTiers` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` fee_config +/// 1. `[signer]` admin +/// 2. `[]` config_program_id +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug)] +pub struct UpsertFeeTiersCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> UpsertFeeTiersCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpsertFeeTiersCpiBuilderInstruction { + __program: program, + fee_config: None, + admin: None, + config_program_id: None, + event_authority: None, + program: None, + fee_tiers: None, + offset: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn config_program_id( + &mut self, + config_program_id: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.config_program_id = Some(config_program_id); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn fee_tiers(&mut self, fee_tiers: Vec) -> &mut Self { + self.instruction.fee_tiers = Some(fee_tiers); + self + } + #[inline(always)] + pub fn offset(&mut self, offset: u8) -> &mut Self { + self.instruction.offset = Some(offset); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = UpsertFeeTiersInstructionArgs { + fee_tiers: self + .instruction + .fee_tiers + .clone() + .expect("fee_tiers is not set"), + offset: self.instruction.offset.clone().expect("offset is not set"), + }; + let instruction = UpsertFeeTiersCpi { + __program: self.instruction.__program, + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + admin: self.instruction.admin.expect("admin is not set"), + + config_program_id: self + .instruction + .config_program_id + .expect("config_program_id is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct UpsertFeeTiersCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + config_program_id: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_tiers: Option>, + offset: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/mod.rs b/crates/pump-fees-parser/src/generated_sdk/mod.rs new file mode 100644 index 00000000..e0d740ad --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/mod.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub mod accounts; +pub mod errors; +pub mod instructions; +pub mod programs; +pub mod shared; +pub mod types; + +pub(crate) use programs::*; diff --git a/crates/pump-fees-parser/src/generated_sdk/programs.rs b/crates/pump-fees-parser/src/generated_sdk/programs.rs new file mode 100644 index 00000000..f4c169a0 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/programs.rs @@ -0,0 +1,11 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use solana_pubkey::{pubkey, Pubkey}; + +/// `pump_fees` program ID. +pub const PUMP_FEES_ID: Pubkey = pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"); diff --git a/crates/pump-fees-parser/src/generated_sdk/shared.rs b/crates/pump-fees-parser/src/generated_sdk/shared.rs new file mode 100644 index 00000000..71b906d0 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/shared.rs @@ -0,0 +1,21 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +#[cfg(feature = "fetch")] +#[derive(Debug, Clone)] +pub struct DecodedAccount { + pub address: solana_pubkey::Pubkey, + pub account: solana_account::Account, + pub data: T, +} + +#[cfg(feature = "fetch")] +#[derive(Debug, Clone)] +pub enum MaybeAccount { + Exists(DecodedAccount), + NotFound(solana_pubkey::Pubkey), +} diff --git a/crates/pump-fees-parser/src/generated_sdk/types/fee_tier.rs b/crates/pump-fees-parser/src/generated_sdk/types/fee_tier.rs new file mode 100644 index 00000000..7d52af95 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/fee_tier.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FeeTier { + pub market_cap_lamports_threshold: u128, + pub fees: Fees, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/types/fees.rs b/crates/pump-fees-parser/src/generated_sdk/types/fees.rs new file mode 100644 index 00000000..c248d91f --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/fees.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct Fees { + pub lp_fee_bps: u64, + pub protocol_fee_bps: u64, + pub creator_fee_bps: u64, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/types/initialize_fee_config_event.rs b/crates/pump-fees-parser/src/generated_sdk/types/initialize_fee_config_event.rs new file mode 100644 index 00000000..f151ed19 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/initialize_fee_config_event.rs @@ -0,0 +1,26 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitializeFeeConfigEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub fee_config: Pubkey, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/types/mod.rs b/crates/pump-fees-parser/src/generated_sdk/types/mod.rs new file mode 100644 index 00000000..1552cc5e --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/mod.rs @@ -0,0 +1,20 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod r#fee_tier; +pub(crate) mod r#fees; +pub(crate) mod r#initialize_fee_config_event; +pub(crate) mod r#update_admin_event; +pub(crate) mod r#update_fee_config_event; +pub(crate) mod r#upsert_fee_tiers_event; + +pub use self::r#fee_tier::*; +pub use self::r#fees::*; +pub use self::r#initialize_fee_config_event::*; +pub use self::r#update_admin_event::*; +pub use self::r#update_fee_config_event::*; +pub use self::r#upsert_fee_tiers_event::*; diff --git a/crates/pump-fees-parser/src/generated_sdk/types/update_admin_event.rs b/crates/pump-fees-parser/src/generated_sdk/types/update_admin_event.rs new file mode 100644 index 00000000..2e931e05 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/update_admin_event.rs @@ -0,0 +1,26 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpdateAdminEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub old_admin: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub new_admin: Pubkey, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/types/update_fee_config_event.rs b/crates/pump-fees-parser/src/generated_sdk/types/update_fee_config_event.rs new file mode 100644 index 00000000..28d25323 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/update_fee_config_event.rs @@ -0,0 +1,30 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpdateFeeConfigEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub fee_config: Pubkey, + pub fee_tiers: Vec, + pub flat_fees: Fees, +} diff --git a/crates/pump-fees-parser/src/generated_sdk/types/upsert_fee_tiers_event.rs b/crates/pump-fees-parser/src/generated_sdk/types/upsert_fee_tiers_event.rs new file mode 100644 index 00000000..33a93800 --- /dev/null +++ b/crates/pump-fees-parser/src/generated_sdk/types/upsert_fee_tiers_event.rs @@ -0,0 +1,29 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpsertFeeTiersEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub fee_config: Pubkey, + pub fee_tiers: Vec, + pub offset: u8, +} diff --git a/crates/pump-fees-parser/src/lib.rs b/crates/pump-fees-parser/src/lib.rs new file mode 100644 index 00000000..1377cf42 --- /dev/null +++ b/crates/pump-fees-parser/src/lib.rs @@ -0,0 +1,17 @@ +mod generated_parser; +mod generated_sdk; +pub use generated::*; +pub use generated_parser::*; +use generated_sdk as generated; +use solana_pubkey::Pubkey; + +pub const ID: Pubkey = PUMP_FEES_ID; + +// #[cfg(feature = "proto")] +pub mod proto_def { + #![allow(clippy::large_enum_variant)] + + tonic::include_proto!("vixen.parser.pump_fees"); + + pub const DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("descriptor"); +} diff --git a/crates/pump-swaps-parser/Cargo.toml b/crates/pump-swaps-parser/Cargo.toml index 83f5b024..1d5e8514 100644 --- a/crates/pump-swaps-parser/Cargo.toml +++ b/crates/pump-swaps-parser/Cargo.toml @@ -1,13 +1,12 @@ [package] name = "yellowstone-vixen-pump-swaps-parser" -version = "0.5.1" +version = "0.5.2" edition.workspace = true description = "Vixen program parser for Pump Swaps program" license.workspace = true repository.workspace = true authors.workspace = true - [dependencies] prost.workspace = true yellowstone-vixen-core = { workspace = true, features = ["proto"] } diff --git a/crates/pump-swaps-parser/codama.cjs b/crates/pump-swaps-parser/codama.cjs new file mode 100644 index 00000000..13ac97ad --- /dev/null +++ b/crates/pump-swaps-parser/codama.cjs @@ -0,0 +1,22 @@ +// codama.cjs +const path = require("node:path"); +const { rootNode } = require("@codama/nodes"); +const { rootNodeFromAnchor } = require("@codama/nodes-from-anchor"); +const { readJson } = require("@codama/renderers-core"); +const { visit } = require("@codama/visitors-core"); +const { renderVisitor } = require("@codama/renderers-vixen-parser"); + +const projectName = "example-parser"; +const idl = readJson(path.join(__dirname, "idl.json")); + +// Use the appropriate node constructor based on your IDL type: +const node = rootNodeFromAnchor(idl); // for Anchor/Shank idls +// const node = rootNode(idl.program); // for Codama idls + +visit( + node, + renderVisitor({ + projectFolder: __dirname, + projectName, + }), +); diff --git a/crates/pump-swaps-parser/codama.json b/crates/pump-swaps-parser/codama.json new file mode 100644 index 00000000..b2a2d3c1 --- /dev/null +++ b/crates/pump-swaps-parser/codama.json @@ -0,0 +1,16 @@ +{ + "idl": "idl.json", + "before": [], + "scripts": { + "rust": { + "from": "@codama/renderers-rust", + "args": [ + "clients/rust/src/generated", + { + "crateFolder": "clients/rust", + "formatCode": true + } + ] + } + } +} \ No newline at end of file diff --git a/crates/pump-swaps-parser/idl.json b/crates/pump-swaps-parser/idl.json index dd8bd93a..c9db1555 100644 --- a/crates/pump-swaps-parser/idl.json +++ b/crates/pump-swaps-parser/idl.json @@ -1,2152 +1,5318 @@ { - "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", - "metadata": { - "name": "pump_amm", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "buy", - "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], - "accounts": [ - { - "name": "pool" - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "global_config" - }, - { - "name": "base_mint", - "relations": ["pool"] - }, - { - "name": "quote_mint", - "relations": ["pool"] - }, - { - "name": "user_base_token_account", - "writable": true - }, - { - "name": "user_quote_token_account", - "writable": true - }, - { - "name": "pool_base_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "pool_quote_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "protocol_fee_recipient" - }, - { - "name": "protocol_fee_recipient_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "protocol_fee_recipient" - }, - { - "kind": "account", - "path": "quote_token_program" - }, - { - "kind": "account", - "path": "quote_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "base_token_program" - }, - { - "name": "quote_token_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "associated_token_program", - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - }, - { - "name": "coin_creator_vault_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "coin_creator_vault_authority" - }, - { - "kind": "account", - "path": "quote_token_program" - }, - { - "kind": "account", - "path": "quote_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "coin_creator_vault_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 99, 114, 101, 97, 116, 111, 114, 95, 118, - 97, 117, 108, 116 - ] - }, - { - "kind": "account", - "path": "pool.coin_creator", - "account": "Pool" - } - ] - } - } - ], - "args": [ - { - "name": "base_amount_out", - "type": "u64" - }, - { - "name": "max_quote_amount_in", - "type": "u64" - } - ] + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", + "metadata": { + "name": "pump_amm", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "admin_set_coin_creator", + "docs": [ + "Overrides the coin creator for a canonical pump pool" + ], + "discriminator": [ + 242, + 40, + 117, + 145, + 73, + 96, + 105, + 104 + ], + "accounts": [ + { + "name": "admin_set_coin_creator_authority", + "signer": true, + "relations": [ + "global_config" + ] }, { - "name": "collect_coin_creator_fee", - "discriminator": [160, 57, 89, 42, 181, 139, 43, 66], - "accounts": [ - { - "name": "quote_mint" - }, - { - "name": "quote_token_program" - }, - { - "name": "coin_creator", - "signer": true - }, - { - "name": "coin_creator_vault_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 99, 114, 101, 97, 116, 111, 114, 95, 118, - 97, 117, 108, 116 - ] - }, - { - "kind": "account", - "path": "coin_creator" - } - ] - } - }, - { - "name": "coin_creator_vault_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "coin_creator_vault_authority" - }, - { - "kind": "account", - "path": "quote_token_program" - }, - { - "kind": "account", - "path": "quote_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "coin_creator_token_account", - "writable": true - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "create_config", - "discriminator": [201, 207, 243, 114, 75, 111, 47, 189], - "accounts": [ - { - "name": "admin", - "writable": true, - "signer": true, - "address": "8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8" - }, - { - "name": "global_config", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 103, 108, 111, 98, 97, 108, 95, 99, 111, - 110, 102, 105, 103 - ] - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "lp_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_recipients", - "type": { - "array": ["pubkey", 8] - } - }, - { - "name": "coin_creator_fee_basis_points", - "type": "u64" - } - ] + "name": "global_config" }, { - "name": "create_pool", - "discriminator": [233, 146, 209, 142, 207, 104, 64, 188], - "accounts": [ - { - "name": "pool", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [112, 111, 111, 108] - }, - { - "kind": "arg", - "path": "index" - }, - { - "kind": "account", - "path": "creator" - }, - { - "kind": "account", - "path": "base_mint" - }, - { - "kind": "account", - "path": "quote_mint" - } - ] - } - }, - { - "name": "global_config" - }, - { - "name": "creator", - "writable": true, - "signer": true - }, - { - "name": "base_mint" - }, - { - "name": "quote_mint" - }, - { - "name": "lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, 111, 111, 108, 95, 108, 112, 95, 109, - 105, 110, 116 - ] - }, - { - "kind": "account", - "path": "pool" - } - ] - } - }, - { - "name": "user_base_token_account", - "writable": true - }, - { - "name": "user_quote_token_account", - "writable": true - }, - { - "name": "user_pool_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "creator" - }, - { - "kind": "account", - "path": "token_2022_program" - }, - { - "kind": "account", - "path": "lp_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "pool_base_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool" - }, - { - "kind": "account", - "path": "base_token_program" - }, - { - "kind": "account", - "path": "base_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "pool_quote_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool" - }, - { - "kind": "account", - "path": "quote_token_program" - }, - { - "kind": "account", - "path": "quote_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "token_2022_program", - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "base_token_program" - }, - { - "name": "quote_token_program" - }, - { - "name": "associated_token_program", - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "index", - "type": "u16" - }, - { - "name": "base_amount_in", - "type": "u64" - }, - { - "name": "quote_amount_in", - "type": "u64" - }, - { - "name": "coin_creator", - "type": "pubkey" - } - ] + "name": "pool", + "writable": true }, { - "name": "deposit", - "discriminator": [242, 35, 198, 137, 82, 225, 242, 182], - "accounts": [ - { - "name": "pool", - "writable": true - }, - { - "name": "global_config" - }, - { - "name": "user", - "signer": true - }, - { - "name": "base_mint", - "relations": ["pool"] - }, - { - "name": "quote_mint", - "relations": ["pool"] - }, - { - "name": "lp_mint", - "writable": true, - "relations": ["pool"] - }, - { - "name": "user_base_token_account", - "writable": true - }, - { - "name": "user_quote_token_account", - "writable": true - }, - { - "name": "user_pool_token_account", - "writable": true - }, - { - "name": "pool_base_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "pool_quote_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_2022_program", - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "lp_token_amount_out", - "type": "u64" - }, - { - "name": "max_base_amount_in", - "type": "u64" - }, - { - "name": "max_quote_amount_in", - "type": "u64" - } + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } ] + } }, { - "name": "disable", - "discriminator": [185, 173, 187, 90, 216, 15, 238, 233], - "accounts": [ - { - "name": "admin", - "signer": true, - "relations": ["global_config"] - }, - { - "name": "global_config", - "writable": true - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "disable_create_pool", - "type": "bool" - }, - { - "name": "disable_deposit", - "type": "bool" - }, - { - "name": "disable_withdraw", - "type": "bool" - }, - { - "name": "disable_buy", - "type": "bool" - }, - { - "name": "disable_sell", - "type": "bool" - } - ] + "name": "program" + } + ], + "args": [ + { + "name": "coin_creator", + "type": "pubkey" + } + ] + }, + { + "name": "admin_update_token_incentives", + "discriminator": [ + 209, + 11, + 115, + 87, + 213, + 23, + 124, + 204 + ], + "accounts": [ + { + "name": "admin", + "writable": true, + "signer": true, + "relations": [ + "global_config" + ] }, { - "name": "extend_account", - "discriminator": [234, 102, 194, 203, 150, 72, 62, 229], - "accounts": [ - { - "name": "account", - "writable": true - }, - { - "name": "user", - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "sell", - "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], - "accounts": [ - { - "name": "pool" - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "global_config" - }, - { - "name": "base_mint", - "relations": ["pool"] - }, - { - "name": "quote_mint", - "relations": ["pool"] - }, - { - "name": "user_base_token_account", - "writable": true - }, - { - "name": "user_quote_token_account", - "writable": true - }, - { - "name": "pool_base_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "pool_quote_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "protocol_fee_recipient" - }, - { - "name": "protocol_fee_recipient_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "protocol_fee_recipient" - }, - { - "kind": "account", - "path": "quote_token_program" - }, - { - "kind": "account", - "path": "quote_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "base_token_program" - }, - { - "name": "quote_token_program" - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "associated_token_program", - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - }, - { - "name": "coin_creator_vault_ata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "coin_creator_vault_authority" - }, - { - "kind": "account", - "path": "quote_token_program" - }, - { - "kind": "account", - "path": "quote_mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "coin_creator_vault_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 99, 114, 101, 97, 116, 111, 114, 95, 118, - 97, 117, 108, 116 - ] - }, - { - "kind": "account", - "path": "pool.coin_creator", - "account": "Pool" - } - ] - } - } - ], - "args": [ - { - "name": "base_amount_in", - "type": "u64" - }, - { - "name": "min_quote_amount_out", - "type": "u64" - } + "name": "global_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } ] + } }, { - "name": "set_coin_creator", - "docs": [ - "Sets Pool::coin_creator from Metaplex metadata creator or BondingCurve::creator" - ], - "discriminator": [210, 149, 128, 45, 188, 58, 78, 175], - "accounts": [ - { - "name": "pool", - "writable": true - }, - { - "name": "metadata", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [109, 101, 116, 97, 100, 97, 116, 97] - }, - { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, - 157, 82, 127, 107, 4, 195, 205, 88, 184, - 108, 115, 26, 160, 253, 181, 73, 182, 209, - 188, 3, 248, 41, 70 - ] - }, - { - "kind": "account", - "path": "pool.base_mint", - "account": "Pool" - } - ], - "program": { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, - 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, - 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, - 41, 70 - ] - } - } - }, - { - "name": "bonding_curve", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "pool.base_mint", - "account": "Pool" - } - ], - "program": { - "kind": "const", - "value": [ - 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, - 104, 191, 23, 91, 170, 81, 137, 203, 151, 245, - 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, - 176 - ] - } - } - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "update_admin", - "discriminator": [161, 176, 40, 213, 60, 184, 179, 228], - "accounts": [ - { - "name": "admin", - "signer": true, - "relations": ["global_config"] - }, - { - "name": "global_config", - "writable": true - }, - { - "name": "new_admin" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "update_fee_config", - "discriminator": [104, 184, 103, 242, 88, 151, 107, 20], - "accounts": [ - { - "name": "admin", - "signer": true, - "relations": ["global_config"] - }, - { - "name": "global_config", - "writable": true - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "lp_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_recipients", - "type": { - "array": ["pubkey", 8] - } - }, - { - "name": "coin_creator_fee_basis_points", - "type": "u64" - } + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } ] + } }, { - "name": "withdraw", - "discriminator": [183, 18, 70, 156, 148, 109, 161, 34], - "accounts": [ - { - "name": "pool", - "writable": true - }, - { - "name": "global_config" - }, - { - "name": "user", - "signer": true - }, - { - "name": "base_mint", - "relations": ["pool"] - }, - { - "name": "quote_mint", - "relations": ["pool"] - }, - { - "name": "lp_mint", - "writable": true, - "relations": ["pool"] - }, - { - "name": "user_base_token_account", - "writable": true - }, - { - "name": "user_quote_token_account", - "writable": true - }, - { - "name": "user_pool_token_account", - "writable": true - }, - { - "name": "pool_base_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "pool_quote_token_account", - "writable": true, - "relations": ["pool"] - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "token_2022_program", - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } + "name": "mint" + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } ], - "args": [ - { - "name": "lp_token_amount_in", - "type": "u64" - }, - { - "name": "min_base_amount_out", - "type": "u64" - }, - { - "name": "min_quote_amount_out", - "type": "u64" - } + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } ] + } + }, + { + "name": "program" } - ], - "accounts": [ + ], + "args": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, { - "name": "BondingCurve", - "discriminator": [23, 183, 248, 55, 96, 216, 172, 96] + "name": "seconds_in_a_day", + "type": "i64" }, { - "name": "GlobalConfig", - "discriminator": [149, 8, 156, 202, 160, 252, 176, 217] + "name": "day_number", + "type": "u64" }, { - "name": "Pool", - "discriminator": [241, 154, 109, 4, 17, 177, 109, 188] + "name": "token_supply_per_day", + "type": "u64" } - ], - "events": [ + ] + }, + { + "name": "buy", + "discriminator": [ + 102, + 6, + 61, + 18, + 1, + 218, + 235, + 234 + ], + "accounts": [ { - "name": "BuyEvent", - "discriminator": [103, 244, 82, 31, 44, 245, 119, 119] + "name": "pool", + "writable": true }, { - "name": "CollectCoinCreatorFeeEvent", - "discriminator": [232, 245, 194, 238, 234, 218, 58, 89] + "name": "user", + "writable": true, + "signer": true }, { - "name": "CreateConfigEvent", - "discriminator": [107, 52, 89, 129, 55, 226, 81, 22] + "name": "global_config" }, { - "name": "CreatePoolEvent", - "discriminator": [177, 49, 12, 210, 160, 118, 167, 116] + "name": "base_mint", + "relations": [ + "pool" + ] }, { - "name": "DepositEvent", - "discriminator": [120, 248, 61, 83, 31, 142, 107, 144] + "name": "quote_mint", + "relations": [ + "pool" + ] }, { - "name": "DisableEvent", - "discriminator": [107, 253, 193, 76, 228, 202, 27, 104] + "name": "user_base_token_account", + "writable": true }, { - "name": "ExtendAccountEvent", - "discriminator": [97, 97, 215, 144, 93, 146, 22, 124] + "name": "user_quote_token_account", + "writable": true }, { - "name": "SellEvent", - "discriminator": [62, 47, 55, 10, 165, 3, 220, 42] + "name": "pool_base_token_account", + "writable": true, + "relations": [ + "pool" + ] }, { - "name": "SetBondingCurveCoinCreatorEvent", - "discriminator": [242, 231, 235, 102, 65, 99, 189, 211] + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] }, { - "name": "SetMetaplexCoinCreatorEvent", - "discriminator": [150, 107, 199, 123, 124, 207, 102, 228] + "name": "protocol_fee_recipient" }, { - "name": "UpdateAdminEvent", - "discriminator": [225, 152, 171, 87, 246, 63, 66, 234] + "name": "protocol_fee_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "protocol_fee_recipient" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "name": "UpdateFeeConfigEvent", - "discriminator": [90, 23, 65, 35, 62, 244, 188, 208] + "name": "base_token_program" }, { - "name": "WithdrawEvent", - "discriminator": [22, 9, 133, 26, 160, 44, 71, 192] - } - ], - "errors": [ + "name": "quote_token_program" + }, { - "code": 6000, - "name": "FeeBasisPointsExceedsMaximum" + "name": "system_program", + "address": "11111111111111111111111111111111" }, { - "code": 6001, - "name": "ZeroBaseAmount" + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" }, { - "code": 6002, - "name": "ZeroQuoteAmount" + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "code": 6003, - "name": "TooLittlePoolTokenLiquidity" + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" }, { - "code": 6004, - "name": "ExceededSlippage" + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "code": 6005, - "name": "InvalidAdmin" + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool.coin_creator", + "account": "Pool" + } + ] + } }, { - "code": 6006, - "name": "UnsupportedBaseMint" + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } }, { - "code": 6007, - "name": "UnsupportedQuoteMint" + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "code": 6008, - "name": "InvalidBaseMint" + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 12, + 20, + 222, + 252, + 130, + 94, + 198, + 118, + 148, + 37, + 8, + 24, + 187, + 101, + 64, + 101, + 244, + 41, + 141, + 49, + 86, + 213, + 113, + 180, + 212, + 248, + 9, + 12, + 24, + 233, + 168, + 99 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } }, { - "code": 6009, - "name": "InvalidQuoteMint" + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "base_amount_out", + "type": "u64" }, { - "code": 6010, - "name": "InvalidLpMint" + "name": "max_quote_amount_in", + "type": "u64" + } + ] + }, + { + "name": "buy_exact_quote_in", + "docs": [ + "Given a budget of spendable_quote_in, buy at least min_base_amount_out", + "Fees will be deducted from spendable_quote_in", + "", + "f(quote) = tokens, where tokens >= min_base_amount_out", + "", + "Make sure the payer has enough SOL to cover creation of the following accounts (unless already created):", + "- protocol_fee_recipient_token_account: rent.minimum_balance(TokenAccount::LEN)", + "- coin_creator_vault_ata: rent.minimum_balance(TokenAccount::LEN)", + "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)" + ], + "discriminator": [ + 198, + 46, + 21, + 82, + 180, + 217, + 232, + 112 + ], + "accounts": [ + { + "name": "pool", + "writable": true }, { - "code": 6011, - "name": "AllProtocolFeeRecipientsShouldBeNonZero" + "name": "user", + "writable": true, + "signer": true }, { - "code": 6012, - "name": "UnsortedNotUniqueProtocolFeeRecipients" + "name": "global_config" }, { - "code": 6013, - "name": "InvalidProtocolFeeRecipient" + "name": "base_mint", + "relations": [ + "pool" + ] }, { - "code": 6014, - "name": "InvalidPoolBaseTokenAccount" + "name": "quote_mint", + "relations": [ + "pool" + ] }, { - "code": 6015, - "name": "InvalidPoolQuoteTokenAccount" + "name": "user_base_token_account", + "writable": true }, { - "code": 6016, - "name": "BuyMoreBaseAmountThanPoolReserves" + "name": "user_quote_token_account", + "writable": true }, { - "code": 6017, - "name": "DisabledCreatePool" + "name": "pool_base_token_account", + "writable": true, + "relations": [ + "pool" + ] }, { - "code": 6018, - "name": "DisabledDeposit" + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] }, { - "code": 6019, - "name": "DisabledWithdraw" + "name": "protocol_fee_recipient" }, { - "code": 6020, - "name": "DisabledBuy" + "name": "protocol_fee_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "protocol_fee_recipient" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "code": 6021, - "name": "DisabledSell" + "name": "base_token_program" }, { - "code": 6022, - "name": "SameMint" + "name": "quote_token_program" }, { - "code": 6023, - "name": "Overflow" + "name": "system_program", + "address": "11111111111111111111111111111111" }, { - "code": 6024, - "name": "Truncation" + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" }, { - "code": 6025, - "name": "DivisionByZero" + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "code": 6026, - "name": "NewSizeLessThanCurrentSize" + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" }, { - "code": 6027, - "name": "AccountTypeNotSupported" + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "code": 6028, - "name": "OnlyCanonicalPumpPoolsCanHaveCoinCreator" - } - ], - "types": [ + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool.coin_creator", + "account": "Pool" + } + ] + } + }, { - "name": "BondingCurve", - "type": { - "kind": "struct", - "fields": [ - { - "name": "virtual_token_reserves", - "type": "u64" - }, - { - "name": "virtual_sol_reserves", - "type": "u64" - }, - { - "name": "real_token_reserves", - "type": "u64" - }, - { - "name": "real_sol_reserves", - "type": "u64" - }, - { - "name": "token_total_supply", - "type": "u64" - }, - { - "name": "complete", - "type": "bool" - }, - { - "name": "creator", - "type": "pubkey" - } + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 ] - } + } + ] + } }, { - "name": "BuyEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "base_amount_out", - "type": "u64" - }, - { - "name": "max_quote_amount_in", - "type": "u64" - }, - { - "name": "user_base_token_reserves", - "type": "u64" - }, - { - "name": "user_quote_token_reserves", - "type": "u64" - }, - { - "name": "pool_base_token_reserves", - "type": "u64" - }, - { - "name": "pool_quote_token_reserves", - "type": "u64" - }, - { - "name": "quote_amount_in", - "type": "u64" - }, - { - "name": "lp_fee_basis_points", - "type": "u64" - }, - { - "name": "lp_fee", - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee", - "type": "u64" - }, - { - "name": "quote_amount_in_with_lp_fee", - "type": "u64" - }, - { - "name": "user_quote_amount_in", - "type": "u64" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "user_base_token_account", - "type": "pubkey" - }, - { - "name": "user_quote_token_account", - "type": "pubkey" - }, - { - "name": "protocol_fee_recipient", - "type": "pubkey" - }, - { - "name": "protocol_fee_recipient_token_account", - "type": "pubkey" - }, - { - "name": "coin_creator", - "type": "pubkey" - }, - { - "name": "coin_creator_fee_basis_points", - "type": "u64" - }, - { - "name": "coin_creator_fee", - "type": "u64" - } + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 ] - } + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "name": "CollectCoinCreatorFeeEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "coin_creator", - "type": "pubkey" - }, - { - "name": "coin_creator_fee", - "type": "u64" - }, - { - "name": "coin_creator_vault_ata", - "type": "pubkey" - }, - { - "name": "coin_creator_token_account", - "type": "pubkey" - } + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 12, + 20, + 222, + 252, + 130, + 94, + 198, + 118, + 148, + 37, + 8, + 24, + 187, + 101, + 64, + 101, + 244, + 41, + 141, + 49, + 86, + 213, + 113, + 180, + 212, + 248, + 9, + 12, + 24, + 233, + 168, + 99 ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" } + } }, { - "name": "CreateConfigEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "admin", - "type": "pubkey" - }, - { - "name": "lp_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_recipients", - "type": { - "array": ["pubkey", 8] - } - }, - { - "name": "coin_creator_fee_basis_points", - "type": "u64" - } - ] + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "spendable_quote_in", + "type": "u64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + } + ] + }, + { + "name": "claim_token_incentives", + "discriminator": [ + 16, + 4, + 71, + 28, + 204, + 1, + 40, + 27 + ], + "accounts": [ + { + "name": "user" + }, + { + "name": "user_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } }, { - "name": "CreatePoolEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "index", - "type": "u16" - }, - { - "name": "creator", - "type": "pubkey" - }, - { - "name": "base_mint", - "type": "pubkey" - }, - { - "name": "quote_mint", - "type": "pubkey" - }, - { - "name": "base_mint_decimals", - "type": "u8" - }, - { - "name": "quote_mint_decimals", - "type": "u8" - }, - { - "name": "base_amount_in", - "type": "u64" - }, - { - "name": "quote_amount_in", - "type": "u64" - }, - { - "name": "pool_base_amount", - "type": "u64" - }, - { - "name": "pool_quote_amount", - "type": "u64" - }, - { - "name": "minimum_liquidity", - "type": "u64" - }, - { - "name": "initial_liquidity", - "type": "u64" - }, - { - "name": "lp_token_amount_out", - "type": "u64" - }, - { - "name": "pool_bump", - "type": "u8" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "lp_mint", - "type": "pubkey" - }, - { - "name": "user_base_token_account", - "type": "pubkey" - }, - { - "name": "user_quote_token_account", - "type": "pubkey" - }, - { - "name": "coin_creator", - "type": "pubkey" - } + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 ] + } + ] + } + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } }, { - "name": "DepositEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "lp_token_amount_out", - "type": "u64" - }, - { - "name": "max_base_amount_in", - "type": "u64" - }, - { - "name": "max_quote_amount_in", - "type": "u64" - }, - { - "name": "user_base_token_reserves", - "type": "u64" - }, - { - "name": "user_quote_token_reserves", - "type": "u64" - }, - { - "name": "pool_base_token_reserves", - "type": "u64" - }, - { - "name": "pool_quote_token_reserves", - "type": "u64" - }, - { - "name": "base_amount_in", - "type": "u64" - }, - { - "name": "quote_amount_in", - "type": "u64" - }, - { - "name": "lp_mint_supply", - "type": "u64" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "user_base_token_account", - "type": "pubkey" - }, - { - "name": "user_quote_token_account", - "type": "pubkey" - }, - { - "name": "user_pool_token_account", - "type": "pubkey" - } + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 ] - } + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "name": "DisableEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "admin", - "type": "pubkey" - }, - { - "name": "disable_create_pool", - "type": "bool" - }, - { - "name": "disable_deposit", - "type": "bool" - }, - { - "name": "disable_withdraw", - "type": "bool" - }, - { - "name": "disable_buy", - "type": "bool" - }, - { - "name": "disable_sell", - "type": "bool" - } + "name": "mint", + "relations": [ + "global_volume_accumulator" + ] + }, + { + "name": "token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "ExtendAccountEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "account", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "current_size", - "type": "u64" - }, - { - "name": "new_size", - "type": "u64" - } + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "payer", + "writable": true, + "signer": true + } + ], + "args": [] + }, + { + "name": "close_user_volume_accumulator", + "discriminator": [ + 249, + 69, + 164, + 218, + 150, + 103, + 84, + 138 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 ] - } + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "name": "GlobalConfig", - "type": { - "kind": "struct", - "fields": [ - { - "name": "admin", - "docs": ["The admin pubkey"], - "type": "pubkey" - }, - { - "name": "lp_fee_basis_points", - "docs": ["The lp fee in basis points (0.01%)"], - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "docs": ["The protocol fee in basis points (0.01%)"], - "type": "u64" - }, - { - "name": "disable_flags", - "docs": [ - "Flags to disable certain functionality", - "bit 0 - Disable create pool", - "bit 1 - Disable deposit", - "bit 2 - Disable withdraw", - "bit 3 - Disable buy", - "bit 4 - Disable sell" - ], - "type": "u8" - }, - { - "name": "protocol_fee_recipients", - "docs": ["Addresses of the protocol fee recipients"], - "type": { - "array": ["pubkey", 8] - } - }, - { - "name": "coin_creator_fee_basis_points", - "docs": [ - "The coin creator fee in basis points (0.01%)" - ], - "type": "u64" - } + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "Pool", - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool_bump", - "type": "u8" - }, - { - "name": "index", - "type": "u16" - }, - { - "name": "creator", - "type": "pubkey" - }, - { - "name": "base_mint", - "type": "pubkey" - }, - { - "name": "quote_mint", - "type": "pubkey" - }, - { - "name": "lp_mint", - "type": "pubkey" - }, - { - "name": "pool_base_token_account", - "type": "pubkey" - }, - { - "name": "pool_quote_token_account", - "type": "pubkey" - }, - { - "name": "lp_supply", - "docs": [ - "True circulating supply without burns and lock-ups" - ], - "type": "u64" - }, - { - "name": "coin_creator", - "type": "pubkey" - } + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_coin_creator_fee", + "discriminator": [ + 160, + 57, + 89, + 42, + 181, + 139, + 43, + 66 + ], + "accounts": [ + { + "name": "quote_mint" + }, + { + "name": "quote_token_program" + }, + { + "name": "coin_creator" + }, + { + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 118, + 97, + 117, + 108, + 116 ] + }, + { + "kind": "account", + "path": "coin_creator" + } + ] + } + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } }, { - "name": "SellEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "base_amount_in", - "type": "u64" - }, - { - "name": "min_quote_amount_out", - "type": "u64" - }, - { - "name": "user_base_token_reserves", - "type": "u64" - }, - { - "name": "user_quote_token_reserves", - "type": "u64" - }, - { - "name": "pool_base_token_reserves", - "type": "u64" - }, - { - "name": "pool_quote_token_reserves", - "type": "u64" - }, - { - "name": "quote_amount_out", - "type": "u64" - }, - { - "name": "lp_fee_basis_points", - "type": "u64" - }, - { - "name": "lp_fee", - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee", - "type": "u64" - }, - { - "name": "quote_amount_out_without_lp_fee", - "type": "u64" - }, - { - "name": "user_quote_amount_out", - "type": "u64" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "user_base_token_account", - "type": "pubkey" - }, - { - "name": "user_quote_token_account", - "type": "pubkey" - }, - { - "name": "protocol_fee_recipient", - "type": "pubkey" - }, - { - "name": "protocol_fee_recipient_token_account", - "type": "pubkey" - }, - { - "name": "coin_creator", - "type": "pubkey" - }, - { - "name": "coin_creator_fee_basis_points", - "type": "u64" - }, - { - "name": "coin_creator_fee", - "type": "u64" - } + "name": "coin_creator_token_account", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "SetBondingCurveCoinCreatorEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "base_mint", - "type": "pubkey" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "bonding_curve", - "type": "pubkey" - }, - { - "name": "coin_creator", - "type": "pubkey" - } + "name": "program" + } + ], + "args": [] + }, + { + "name": "create_config", + "discriminator": [ + 201, + 207, + 243, + 114, + 75, + 111, + 47, + 189 + ], + "accounts": [ + { + "name": "admin", + "writable": true, + "signer": true, + "address": "8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8" + }, + { + "name": "global_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 ] - } + } + ] + } }, { - "name": "SetMetaplexCoinCreatorEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "base_mint", - "type": "pubkey" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "metadata", - "type": "pubkey" - }, - { - "name": "coin_creator", - "type": "pubkey" - } + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "UpdateAdminEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "admin", - "type": "pubkey" - }, - { - "name": "new_admin", - "type": "pubkey" - } + "name": "program" + } + ], + "args": [ + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + }, + { + "name": "create_pool", + "discriminator": [ + 233, + 146, + 209, + 142, + 207, + 104, + 64, + 188 + ], + "accounts": [ + { + "name": "pool", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 ] - } + }, + { + "kind": "arg", + "path": "index" + }, + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } }, { - "name": "UpdateFeeConfigEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "admin", - "type": "pubkey" - }, - { - "name": "lp_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_basis_points", - "type": "u64" - }, - { - "name": "protocol_fee_recipients", - "type": { - "array": ["pubkey", 8] - } - }, - { - "name": "coin_creator_fee_basis_points", - "type": "u64" - } + "name": "global_config" + }, + { + "name": "creator", + "writable": true, + "signer": true + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 108, + 112, + 95, + 109, + 105, + 110, + 116 ] + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "user_pool_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "token_2022_program" + }, + { + "kind": "account", + "path": "lp_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } }, { - "name": "WithdrawEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "lp_token_amount_in", - "type": "u64" - }, - { - "name": "min_base_amount_out", - "type": "u64" - }, - { - "name": "min_quote_amount_out", - "type": "u64" - }, - { - "name": "user_base_token_reserves", - "type": "u64" - }, - { - "name": "user_quote_token_reserves", - "type": "u64" - }, - { - "name": "pool_base_token_reserves", - "type": "u64" - }, - { - "name": "pool_quote_token_reserves", - "type": "u64" - }, - { - "name": "base_amount_out", - "type": "u64" - }, - { - "name": "quote_amount_out", - "type": "u64" - }, - { - "name": "lp_mint_supply", - "type": "u64" - }, - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "user_base_token_account", - "type": "pubkey" - }, - { - "name": "user_quote_token_account", - "type": "pubkey" - }, - { - "name": "user_pool_token_account", - "type": "pubkey" - } - ] + "name": "pool_base_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "base_token_program" + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "pool_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" } - ] -} + ], + "args": [ + { + "name": "index", + "type": "u16" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + }, + { + "name": "deposit", + "discriminator": [ + 242, + 35, + 198, + 137, + 82, + 225, + 242, + 182 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "global_config" + }, + { + "name": "user", + "signer": true + }, + { + "name": "base_mint", + "relations": [ + "pool" + ] + }, + { + "name": "quote_mint", + "relations": [ + "pool" + ] + }, + { + "name": "lp_mint", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "user_pool_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_token_amount_out", + "type": "u64" + }, + { + "name": "max_base_amount_in", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + } + ] + }, + { + "name": "disable", + "discriminator": [ + 185, + 173, + 187, + 90, + 216, + 15, + 238, + 233 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "disable_create_pool", + "type": "bool" + }, + { + "name": "disable_deposit", + "type": "bool" + }, + { + "name": "disable_withdraw", + "type": "bool" + }, + { + "name": "disable_buy", + "type": "bool" + }, + { + "name": "disable_sell", + "type": "bool" + } + ] + }, + { + "name": "extend_account", + "discriminator": [ + 234, + 102, + 194, + 203, + 150, + 72, + 62, + 229 + ], + "accounts": [ + { + "name": "account", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "init_user_volume_accumulator", + "discriminator": [ + 94, + 6, + 202, + 115, + 255, + 96, + 232, + 183 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "user" + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "sell", + "discriminator": [ + 51, + 230, + 133, + 164, + 1, + 127, + 131, + 173 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "global_config" + }, + { + "name": "base_mint", + "relations": [ + "pool" + ] + }, + { + "name": "quote_mint", + "relations": [ + "pool" + ] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "protocol_fee_recipient" + }, + { + "name": "protocol_fee_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "protocol_fee_recipient" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool.coin_creator", + "account": "Pool" + } + ] + } + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 12, + 20, + 222, + 252, + 130, + 94, + 198, + 118, + 148, + 37, + 8, + 24, + 187, + 101, + 64, + 101, + 244, + 41, + 141, + 49, + 86, + 213, + 113, + 180, + 212, + 248, + 9, + 12, + 24, + 233, + 168, + 99 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + } + ] + }, + { + "name": "set_coin_creator", + "docs": [ + "Sets Pool::coin_creator from Metaplex metadata creator or BondingCurve::creator" + ], + "discriminator": [ + 210, + 149, + 128, + 45, + 188, + 58, + 78, + 175 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "metadata", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "pool.base_mint", + "account": "Pool" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "bonding_curve", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "pool.base_mint", + "account": "Pool" + } + ], + "program": { + "kind": "const", + "value": [ + 1, + 86, + 224, + 246, + 147, + 102, + 90, + 207, + 68, + 219, + 21, + 104, + 191, + 23, + 91, + 170, + 81, + 137, + 203, + 151, + 245, + 210, + 255, + 59, + 101, + 93, + 43, + 182, + 253, + 109, + 24, + 176 + ] + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_reserved_fee_recipients", + "discriminator": [ + 111, + 172, + 162, + 232, + 114, + 89, + 213, + 142 + ], + "accounts": [ + { + "name": "global_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ] + } + }, + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "whitelist_pda", + "type": "pubkey" + } + ] + }, + { + "name": "sync_user_volume_accumulator", + "discriminator": [ + 86, + 31, + 192, + 87, + 163, + 87, + 79, + 238 + ], + "accounts": [ + { + "name": "user" + }, + { + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "toggle_mayhem_mode", + "discriminator": [ + 1, + 9, + 111, + 208, + 100, + 31, + 255, + 163 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "update_admin", + "discriminator": [ + 161, + 176, + 40, + 213, + 60, + 184, + 179, + 228 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "new_admin" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_fee_config", + "discriminator": [ + 104, + 184, + 103, + 242, + 88, + 151, + 107, + 20 + ], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": [ + "global_config" + ] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + }, + { + "name": "withdraw", + "discriminator": [ + 183, + 18, + 70, + 156, + 148, + 109, + 161, + 34 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "global_config" + }, + { + "name": "user", + "signer": true + }, + { + "name": "base_mint", + "relations": [ + "pool" + ] + }, + { + "name": "quote_mint", + "relations": [ + "pool" + ] + }, + { + "name": "lp_mint", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "user_pool_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_token_amount_in", + "type": "u64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "BondingCurve", + "discriminator": [ + 23, + 183, + 248, + 55, + 96, + 216, + 172, + 96 + ] + }, + { + "name": "FeeConfig", + "discriminator": [ + 143, + 52, + 146, + 187, + 219, + 123, + 76, + 155 + ] + }, + { + "name": "GlobalConfig", + "discriminator": [ + 149, + 8, + 156, + 202, + 160, + 252, + 176, + 217 + ] + }, + { + "name": "GlobalVolumeAccumulator", + "discriminator": [ + 202, + 42, + 246, + 43, + 142, + 190, + 30, + 255 + ] + }, + { + "name": "Pool", + "discriminator": [ + 241, + 154, + 109, + 4, + 17, + 177, + 109, + 188 + ] + }, + { + "name": "UserVolumeAccumulator", + "discriminator": [ + 86, + 255, + 112, + 14, + 102, + 53, + 154, + 250 + ] + } + ], + "events": [ + { + "name": "AdminSetCoinCreatorEvent", + "discriminator": [ + 45, + 220, + 93, + 24, + 25, + 97, + 172, + 104 + ] + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "discriminator": [ + 147, + 250, + 108, + 120, + 247, + 29, + 67, + 222 + ] + }, + { + "name": "BuyEvent", + "discriminator": [ + 103, + 244, + 82, + 31, + 44, + 245, + 119, + 119 + ] + }, + { + "name": "ClaimTokenIncentivesEvent", + "discriminator": [ + 79, + 172, + 246, + 49, + 205, + 91, + 206, + 232 + ] + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "discriminator": [ + 146, + 159, + 189, + 172, + 146, + 88, + 56, + 244 + ] + }, + { + "name": "CollectCoinCreatorFeeEvent", + "discriminator": [ + 232, + 245, + 194, + 238, + 234, + 218, + 58, + 89 + ] + }, + { + "name": "CreateConfigEvent", + "discriminator": [ + 107, + 52, + 89, + 129, + 55, + 226, + 81, + 22 + ] + }, + { + "name": "CreatePoolEvent", + "discriminator": [ + 177, + 49, + 12, + 210, + 160, + 118, + 167, + 116 + ] + }, + { + "name": "DepositEvent", + "discriminator": [ + 120, + 248, + 61, + 83, + 31, + 142, + 107, + 144 + ] + }, + { + "name": "DisableEvent", + "discriminator": [ + 107, + 253, + 193, + 76, + 228, + 202, + 27, + 104 + ] + }, + { + "name": "ExtendAccountEvent", + "discriminator": [ + 97, + 97, + 215, + 144, + 93, + 146, + 22, + 124 + ] + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "discriminator": [ + 134, + 36, + 13, + 72, + 232, + 101, + 130, + 216 + ] + }, + { + "name": "ReservedFeeRecipientsEvent", + "discriminator": [ + 43, + 188, + 250, + 18, + 221, + 75, + 187, + 95 + ] + }, + { + "name": "SellEvent", + "discriminator": [ + 62, + 47, + 55, + 10, + 165, + 3, + 220, + 42 + ] + }, + { + "name": "SetBondingCurveCoinCreatorEvent", + "discriminator": [ + 242, + 231, + 235, + 102, + 65, + 99, + 189, + 211 + ] + }, + { + "name": "SetMetaplexCoinCreatorEvent", + "discriminator": [ + 150, + 107, + 199, + 123, + 124, + 207, + 102, + 228 + ] + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "discriminator": [ + 197, + 122, + 167, + 124, + 116, + 81, + 91, + 255 + ] + }, + { + "name": "UpdateAdminEvent", + "discriminator": [ + 225, + 152, + 171, + 87, + 246, + 63, + 66, + 234 + ] + }, + { + "name": "UpdateFeeConfigEvent", + "discriminator": [ + 90, + 23, + 65, + 35, + 62, + 244, + 188, + 208 + ] + }, + { + "name": "WithdrawEvent", + "discriminator": [ + 22, + 9, + 133, + 26, + 160, + 44, + 71, + 192 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "FeeBasisPointsExceedsMaximum" + }, + { + "code": 6001, + "name": "ZeroBaseAmount" + }, + { + "code": 6002, + "name": "ZeroQuoteAmount" + }, + { + "code": 6003, + "name": "TooLittlePoolTokenLiquidity" + }, + { + "code": 6004, + "name": "ExceededSlippage" + }, + { + "code": 6005, + "name": "InvalidAdmin" + }, + { + "code": 6006, + "name": "UnsupportedBaseMint" + }, + { + "code": 6007, + "name": "UnsupportedQuoteMint" + }, + { + "code": 6008, + "name": "InvalidBaseMint" + }, + { + "code": 6009, + "name": "InvalidQuoteMint" + }, + { + "code": 6010, + "name": "InvalidLpMint" + }, + { + "code": 6011, + "name": "AllProtocolFeeRecipientsShouldBeNonZero" + }, + { + "code": 6012, + "name": "UnsortedNotUniqueProtocolFeeRecipients" + }, + { + "code": 6013, + "name": "InvalidProtocolFeeRecipient" + }, + { + "code": 6014, + "name": "InvalidPoolBaseTokenAccount" + }, + { + "code": 6015, + "name": "InvalidPoolQuoteTokenAccount" + }, + { + "code": 6016, + "name": "BuyMoreBaseAmountThanPoolReserves" + }, + { + "code": 6017, + "name": "DisabledCreatePool" + }, + { + "code": 6018, + "name": "DisabledDeposit" + }, + { + "code": 6019, + "name": "DisabledWithdraw" + }, + { + "code": 6020, + "name": "DisabledBuy" + }, + { + "code": 6021, + "name": "DisabledSell" + }, + { + "code": 6022, + "name": "SameMint" + }, + { + "code": 6023, + "name": "Overflow" + }, + { + "code": 6024, + "name": "Truncation" + }, + { + "code": 6025, + "name": "DivisionByZero" + }, + { + "code": 6026, + "name": "NewSizeLessThanCurrentSize" + }, + { + "code": 6027, + "name": "AccountTypeNotSupported" + }, + { + "code": 6028, + "name": "OnlyCanonicalPumpPoolsCanHaveCoinCreator" + }, + { + "code": 6029, + "name": "InvalidAdminSetCoinCreatorAuthority" + }, + { + "code": 6030, + "name": "StartTimeInThePast" + }, + { + "code": 6031, + "name": "EndTimeInThePast" + }, + { + "code": 6032, + "name": "EndTimeBeforeStartTime" + }, + { + "code": 6033, + "name": "TimeRangeTooLarge" + }, + { + "code": 6034, + "name": "EndTimeBeforeCurrentDay" + }, + { + "code": 6035, + "name": "SupplyUpdateForFinishedRange" + }, + { + "code": 6036, + "name": "DayIndexAfterEndIndex" + }, + { + "code": 6037, + "name": "DayInActiveRange" + }, + { + "code": 6038, + "name": "InvalidIncentiveMint" + }, + { + "code": 6039, + "name": "BuyNotEnoughQuoteTokensToCoverFees", + "msg": "buy: Not enough quote tokens to cover for fees." + }, + { + "code": 6040, + "name": "BuySlippageBelowMinBaseAmountOut", + "msg": "buy: slippage - would buy less tokens than expected min_base_amount_out" + }, + { + "code": 6041, + "name": "MayhemModeDisabled" + }, + { + "code": 6042, + "name": "OnlyPumpPoolsMayhemMode" + }, + { + "code": 6043, + "name": "MayhemModeInDesiredState" + }, + { + "code": 6044, + "name": "NotEnoughRemainingAccounts" + } + ], + "types": [ + { + "name": "AdminSetCoinCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "old_coin_creator", + "type": "pubkey" + }, + { + "name": "new_coin_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "day_number", + "type": "u64" + }, + { + "name": "token_supply_per_day", + "type": "u64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "BondingCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "real_sol_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "complete", + "type": "bool" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "BuyEvent", + "docs": [ + "ix_name: \"buy\" | \"buy_exact_quote_in\"" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_amount_out", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "lp_fee", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee", + "type": "u64" + }, + { + "name": "quote_amount_in_with_lp_fee", + "type": "u64" + }, + { + "name": "user_quote_amount_in", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient_token_account", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "coin_creator_fee", + "type": "u64" + }, + { + "name": "track_volume", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + }, + { + "name": "ix_name", + "type": "string" + } + ] + } + }, + { + "name": "ClaimTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + } + ] + } + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "CollectCoinCreatorFeeEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "coin_creator_fee", + "type": "u64" + }, + { + "name": "coin_creator_vault_ata", + "type": "pubkey" + }, + { + "name": "coin_creator_token_account", + "type": "pubkey" + } + ] + } + }, + { + "name": "CreateConfigEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "CreatePoolEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "index", + "type": "u16" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint_decimals", + "type": "u8" + }, + { + "name": "quote_mint_decimals", + "type": "u8" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "pool_base_amount", + "type": "u64" + }, + { + "name": "pool_quote_amount", + "type": "u64" + }, + { + "name": "minimum_liquidity", + "type": "u64" + }, + { + "name": "initial_liquidity", + "type": "u64" + }, + { + "name": "lp_token_amount_out", + "type": "u64" + }, + { + "name": "pool_bump", + "type": "u8" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "DepositEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "lp_token_amount_out", + "type": "u64" + }, + { + "name": "max_base_amount_in", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "lp_mint_supply", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "user_pool_token_account", + "type": "pubkey" + } + ] + } + }, + { + "name": "DisableEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "disable_create_pool", + "type": "bool" + }, + { + "name": "disable_deposit", + "type": "bool" + }, + { + "name": "disable_withdraw", + "type": "bool" + }, + { + "name": "disable_buy", + "type": "bool" + }, + { + "name": "disable_sell", + "type": "bool" + } + ] + } + }, + { + "name": "ExtendAccountEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "account", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "current_size", + "type": "u64" + }, + { + "name": "new_size", + "type": "u64" + } + ] + } + }, + { + "name": "FeeConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "flat_fees", + "type": { + "defined": { + "name": "Fees" + } + } + }, + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + } + ] + } + }, + { + "name": "FeeTier", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market_cap_lamports_threshold", + "type": "u128" + }, + { + "name": "fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_fee_bps", + "type": "u64" + }, + { + "name": "protocol_fee_bps", + "type": "u64" + }, + { + "name": "creator_fee_bps", + "type": "u64" + } + ] + } + }, + { + "name": "GlobalConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "admin", + "docs": [ + "The admin pubkey" + ], + "type": "pubkey" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "disable_flags", + "docs": [ + "Flags to disable certain functionality", + "bit 0 - Disable create pool", + "bit 1 - Disable deposit", + "bit 2 - Disable withdraw", + "bit 3 - Disable buy", + "bit 4 - Disable sell" + ], + "type": "u8" + }, + { + "name": "protocol_fee_recipients", + "docs": [ + "Addresses of the protocol fee recipients" + ], + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "docs": [ + "The admin authority for setting coin creators" + ], + "type": "pubkey" + }, + { + "name": "whitelist_pda", + "type": "pubkey" + }, + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "mayhem_mode_enabled", + "type": "bool" + }, + { + "name": "reserved_fee_recipients", + "type": { + "array": [ + "pubkey", + 7 + ] + } + } + ] + } + }, + { + "name": "GlobalVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "total_token_supply", + "type": { + "array": [ + "u64", + 30 + ] + } + }, + { + "name": "sol_volumes", + "type": { + "array": [ + "u64", + 30 + ] + } + } + ] + } + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "payer", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "Pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_bump", + "type": "u8" + }, + { + "name": "index", + "type": "u16" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "pool_base_token_account", + "type": "pubkey" + }, + { + "name": "pool_quote_token_account", + "type": "pubkey" + }, + { + "name": "lp_supply", + "docs": [ + "True circulating supply without burns and lock-ups" + ], + "type": "u64" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "ReservedFeeRecipientsEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "reserved_fee_recipients", + "type": { + "array": [ + "pubkey", + 7 + ] + } + } + ] + } + }, + { + "name": "SellEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "quote_amount_out", + "type": "u64" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "lp_fee", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee", + "type": "u64" + }, + { + "name": "quote_amount_out_without_lp_fee", + "type": "u64" + }, + { + "name": "user_quote_amount_out", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient_token_account", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "coin_creator_fee", + "type": "u64" + } + ] + } + }, + { + "name": "SetBondingCurveCoinCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetMetaplexCoinCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "metadata", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "total_claimed_tokens_before", + "type": "u64" + }, + { + "name": "total_claimed_tokens_after", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "UpdateAdminEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "new_admin", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateFeeConfigEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "UserVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "needs_claim", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "has_total_claimed_tokens", + "type": "bool" + } + ] + } + }, + { + "name": "WithdrawEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "lp_token_amount_in", + "type": "u64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "base_amount_out", + "type": "u64" + }, + { + "name": "quote_amount_out", + "type": "u64" + }, + { + "name": "lp_mint_supply", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "user_pool_token_account", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/crates/pump-swaps-parser/package.json b/crates/pump-swaps-parser/package.json new file mode 100644 index 00000000..ee420c99 --- /dev/null +++ b/crates/pump-swaps-parser/package.json @@ -0,0 +1,27 @@ +{ + "name": "pump-swaps-parser", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "packageManager": "pnpm@10.17.0", + "devDependencies": { + "@types/node": "^24.10.0", + "tsx": "^4.20.6", + "typescript": "^5.9.3" + }, + "dependencies": { + "@codama/nodes": "^1.3.7", + "@codama/nodes-from-anchor": "^1.2.9", + "@codama/renderers-core": "^1.2.2", + "@codama/renderers-js": "^1.4.3", + "@codama/renderers-rust": "^1.2.7", + "@codama/renderers-vixen-parser": "^1.2.8", + "@codama/visitors-core": "^1.3.7" + } +} diff --git a/crates/pump-swaps-parser/proto/pump_swaps.proto b/crates/pump-swaps-parser/proto/pump_swaps.proto index 703bc76a..461cf640 100644 --- a/crates/pump-swaps-parser/proto/pump_swaps.proto +++ b/crates/pump-swaps-parser/proto/pump_swaps.proto @@ -8,11 +8,34 @@ syntax = "proto3"; package vixen.parser.pump_swaps; +message AdminSetCoinCreatorIx { + AdminSetCoinCreatorIxAccounts accounts = 1; + AdminSetCoinCreatorIxData data = 2; +} + +message AdminUpdateTokenIncentivesIx { + AdminUpdateTokenIncentivesIxAccounts accounts = 1; + AdminUpdateTokenIncentivesIxData data = 2; +} + message BuyIx { BuyIxAccounts accounts = 1; BuyIxData data = 2; } +message BuyExactQuoteInIx { + BuyExactQuoteInIxAccounts accounts = 1; + BuyExactQuoteInIxData data = 2; +} + +message ClaimTokenIncentivesIx { + ClaimTokenIncentivesIxAccounts accounts = 1; +} + +message CloseUserVolumeAccumulatorIx { + CloseUserVolumeAccumulatorIxAccounts accounts = 1; +} + message CollectCoinCreatorFeeIx { CollectCoinCreatorFeeIxAccounts accounts = 1; } @@ -41,6 +64,10 @@ message ExtendAccountIx { ExtendAccountIxAccounts accounts = 1; } +message InitUserVolumeAccumulatorIx { + InitUserVolumeAccumulatorIxAccounts accounts = 1; +} + message SellIx { SellIxAccounts accounts = 1; SellIxData data = 2; @@ -50,6 +77,20 @@ message SetCoinCreatorIx { SetCoinCreatorIxAccounts accounts = 1; } +message SetReservedFeeRecipientsIx { + SetReservedFeeRecipientsIxAccounts accounts = 1; + SetReservedFeeRecipientsIxData data = 2; +} + +message SyncUserVolumeAccumulatorIx { + SyncUserVolumeAccumulatorIxAccounts accounts = 1; +} + +message ToggleMayhemModeIx { + ToggleMayhemModeIxAccounts accounts = 1; + ToggleMayhemModeIxData data = 2; +} + message UpdateAdminIx { UpdateAdminIxAccounts accounts = 1; } @@ -65,6 +106,25 @@ message WithdrawIx { } +message AdminSetCoinCreatorEvent { + int64 timestamp = 1; + string admin_set_coin_creator_authority = 2; + string base_mint = 3; + string pool = 4; + string old_coin_creator = 5; + string new_coin_creator = 6; +} + +message AdminUpdateTokenIncentivesEvent { + int64 start_time = 1; + int64 end_time = 2; + uint64 day_number = 3; + uint64 token_supply_per_day = 4; + string mint = 5; + int64 seconds_in_a_day = 6; + int64 timestamp = 7; +} + message BuyEvent { int64 timestamp = 1; uint64 base_amount_out = 2; @@ -89,6 +149,31 @@ message BuyEvent { string coin_creator = 21; uint64 coin_creator_fee_basis_points = 22; uint64 coin_creator_fee = 23; + bool track_volume = 24; + uint64 total_unclaimed_tokens = 25; + uint64 total_claimed_tokens = 26; + uint64 current_sol_volume = 27; + int64 last_update_timestamp = 28; + uint64 min_base_amount_out = 29; + string ix_name = 30; +} + +message ClaimTokenIncentivesEvent { + string user = 1; + string mint = 2; + uint64 amount = 3; + int64 timestamp = 4; + uint64 total_claimed_tokens = 5; + uint64 current_sol_volume = 6; +} + +message CloseUserVolumeAccumulatorEvent { + string user = 1; + int64 timestamp = 2; + uint64 total_unclaimed_tokens = 3; + uint64 total_claimed_tokens = 4; + uint64 current_sol_volume = 5; + int64 last_update_timestamp = 6; } message CollectCoinCreatorFeeEvent { @@ -106,6 +191,7 @@ message CreateConfigEvent { uint64 protocol_fee_basis_points = 4; repeated string protocol_fee_recipients = 5; uint64 coin_creator_fee_basis_points = 6; + string admin_set_coin_creator_authority = 7; } message CreatePoolEvent { @@ -129,6 +215,7 @@ message CreatePoolEvent { string user_base_token_account = 18; string user_quote_token_account = 19; string coin_creator = 20; + bool is_mayhem_mode = 21; } message DepositEvent { @@ -168,6 +255,29 @@ message ExtendAccountEvent { uint64 new_size = 5; } +message FeeTier { + string market_cap_lamports_threshold = 1; + Fees fees = 2; +} + +message Fees { + uint64 lp_fee_bps = 1; + uint64 protocol_fee_bps = 2; + uint64 creator_fee_bps = 3; +} + +message InitUserVolumeAccumulatorEvent { + string payer = 1; + string user = 2; + int64 timestamp = 3; +} + +message ReservedFeeRecipientsEvent { + int64 timestamp = 1; + string reserved_fee_recipient = 2; + repeated string reserved_fee_recipients = 3; +} + message SellEvent { int64 timestamp = 1; uint64 base_amount_in = 2; @@ -210,6 +320,13 @@ message SetMetaplexCoinCreatorEvent { string coin_creator = 5; } +message SyncUserVolumeAccumulatorEvent { + string user = 1; + uint64 total_claimed_tokens_before = 2; + uint64 total_claimed_tokens_after = 3; + int64 timestamp = 4; +} + message UpdateAdminEvent { int64 timestamp = 1; string admin = 2; @@ -223,6 +340,7 @@ message UpdateFeeConfigEvent { uint64 protocol_fee_basis_points = 4; repeated string protocol_fee_recipients = 5; uint64 coin_creator_fee_basis_points = 6; + string admin_set_coin_creator_authority = 7; } message WithdrawEvent { @@ -253,6 +371,14 @@ message BondingCurve { uint64 token_total_supply = 5; bool complete = 6; string creator = 7; + bool is_mayhem_mode = 8; +} + +message FeeConfig { + uint32 bump = 1; + string admin = 2; + Fees flat_fees = 3; + repeated FeeTier fee_tiers = 4; } message GlobalConfig { @@ -262,6 +388,20 @@ message GlobalConfig { uint32 disable_flags = 4; repeated string protocol_fee_recipients = 5; uint64 coin_creator_fee_basis_points = 6; + string admin_set_coin_creator_authority = 7; + string whitelist_pda = 8; + string reserved_fee_recipient = 9; + bool mayhem_mode_enabled = 10; + repeated string reserved_fee_recipients = 11; +} + +message GlobalVolumeAccumulator { + int64 start_time = 1; + int64 end_time = 2; + int64 seconds_in_a_day = 3; + string mint = 4; + repeated uint64 total_token_supply = 5; + repeated uint64 sol_volumes = 6; } message Pool { @@ -275,8 +415,52 @@ message Pool { string pool_quote_token_account = 8; uint64 lp_supply = 9; string coin_creator = 10; + bool is_mayhem_mode = 11; +} + +message UserVolumeAccumulator { + string user = 1; + bool needs_claim = 2; + uint64 total_unclaimed_tokens = 3; + uint64 total_claimed_tokens = 4; + uint64 current_sol_volume = 5; + int64 last_update_timestamp = 6; + bool has_total_claimed_tokens = 7; +} + + +message AdminSetCoinCreatorIxAccounts { + string admin_set_coin_creator_authority = 1; + string global_config = 2; + string pool = 3; + string event_authority = 4; + string program = 5; +} + +message AdminSetCoinCreatorIxData { + string coin_creator = 1; +} + +message AdminUpdateTokenIncentivesIxAccounts { + string admin = 1; + string global_config = 2; + string global_volume_accumulator = 3; + string mint = 4; + string global_incentive_token_account = 5; + string associated_token_program = 6; + string system_program = 7; + string token_program = 8; + string event_authority = 9; + string program = 10; } +message AdminUpdateTokenIncentivesIxData { + int64 start_time = 1; + int64 end_time = 2; + int64 seconds_in_a_day = 3; + uint64 day_number = 4; + uint64 token_supply_per_day = 5; +} message BuyIxAccounts { string pool = 1; @@ -298,6 +482,10 @@ message BuyIxAccounts { string program = 17; string coin_creator_vault_ata = 18; string coin_creator_vault_authority = 19; + string global_volume_accumulator = 20; + string user_volume_accumulator = 21; + string fee_config = 22; + string fee_program = 23; } message BuyIxData { @@ -305,6 +493,61 @@ message BuyIxData { uint64 max_quote_amount_in = 2; } +message BuyExactQuoteInIxAccounts { + string pool = 1; + string user = 2; + string global_config = 3; + string base_mint = 4; + string quote_mint = 5; + string user_base_token_account = 6; + string user_quote_token_account = 7; + string pool_base_token_account = 8; + string pool_quote_token_account = 9; + string protocol_fee_recipient = 10; + string protocol_fee_recipient_token_account = 11; + string base_token_program = 12; + string quote_token_program = 13; + string system_program = 14; + string associated_token_program = 15; + string event_authority = 16; + string program = 17; + string coin_creator_vault_ata = 18; + string coin_creator_vault_authority = 19; + string global_volume_accumulator = 20; + string user_volume_accumulator = 21; + string fee_config = 22; + string fee_program = 23; +} + +message BuyExactQuoteInIxData { + uint64 spendable_quote_in = 1; + uint64 min_base_amount_out = 2; +} + +message ClaimTokenIncentivesIxAccounts { + string user = 1; + string user_ata = 2; + string global_volume_accumulator = 3; + string global_incentive_token_account = 4; + string user_volume_accumulator = 5; + string mint = 6; + string token_program = 7; + string system_program = 8; + string associated_token_program = 9; + string event_authority = 10; + string program = 11; + string payer = 12; +} + + +message CloseUserVolumeAccumulatorIxAccounts { + string user = 1; + string user_volume_accumulator = 2; + string event_authority = 3; + string program = 4; +} + + message CollectCoinCreatorFeeIxAccounts { string quote_mint = 1; string quote_token_program = 2; @@ -330,6 +573,7 @@ message CreateConfigIxData { uint64 protocol_fee_basis_points = 2; repeated string protocol_fee_recipients = 3; uint64 coin_creator_fee_basis_points = 4; + string admin_set_coin_creator_authority = 5; } message CreatePoolIxAccounts { @@ -358,6 +602,7 @@ message CreatePoolIxData { uint64 base_amount_in = 2; uint64 quote_amount_in = 3; string coin_creator = 4; + bool is_mayhem_mode = 5; } message DepositIxAccounts { @@ -408,6 +653,16 @@ message ExtendAccountIxAccounts { } +message InitUserVolumeAccumulatorIxAccounts { + string payer = 1; + string user = 2; + string user_volume_accumulator = 3; + string system_program = 4; + string event_authority = 5; + string program = 6; +} + + message SellIxAccounts { string pool = 1; string user = 2; @@ -428,6 +683,8 @@ message SellIxAccounts { string program = 17; string coin_creator_vault_ata = 18; string coin_creator_vault_authority = 19; + string fee_config = 20; + string fee_program = 21; } message SellIxData { @@ -444,6 +701,37 @@ message SetCoinCreatorIxAccounts { } +message SetReservedFeeRecipientsIxAccounts { + string global_config = 1; + string admin = 2; + string event_authority = 3; + string program = 4; +} + +message SetReservedFeeRecipientsIxData { + string whitelist_pda = 1; +} + +message SyncUserVolumeAccumulatorIxAccounts { + string user = 1; + string global_volume_accumulator = 2; + string user_volume_accumulator = 3; + string event_authority = 4; + string program = 5; +} + + +message ToggleMayhemModeIxAccounts { + string admin = 1; + string global_config = 2; + string event_authority = 3; + string program = 4; +} + +message ToggleMayhemModeIxData { + bool enabled = 1; +} + message UpdateAdminIxAccounts { string admin = 1; string global_config = 2; @@ -465,6 +753,7 @@ message UpdateFeeConfigIxData { uint64 protocol_fee_basis_points = 2; repeated string protocol_fee_recipients = 3; uint64 coin_creator_fee_basis_points = 4; + string admin_set_coin_creator_authority = 5; } message WithdrawIxAccounts { @@ -495,25 +784,37 @@ message WithdrawIxData { message ProgramState { oneof state_oneof { BondingCurve bonding_curve = 1; - GlobalConfig global_config = 2; - Pool pool = 3; + FeeConfig fee_config = 2; + GlobalConfig global_config = 3; + GlobalVolumeAccumulator global_volume_accumulator = 4; + Pool pool = 5; + UserVolumeAccumulator user_volume_accumulator = 6; } } message ProgramIxs { oneof ix_oneof { - BuyIx buy = 1; - CollectCoinCreatorFeeIx collect_coin_creator_fee = 2; - CreateConfigIx create_config = 3; - CreatePoolIx create_pool = 4; - DepositIx deposit = 5; - DisableIx disable = 6; - ExtendAccountIx extend_account = 7; - SellIx sell = 8; - SetCoinCreatorIx set_coin_creator = 9; - UpdateAdminIx update_admin = 10; - UpdateFeeConfigIx update_fee_config = 11; - WithdrawIx withdraw = 12; + AdminSetCoinCreatorIx admin_set_coin_creator = 1; + AdminUpdateTokenIncentivesIx admin_update_token_incentives = 2; + BuyIx buy = 3; + BuyExactQuoteInIx buy_exact_quote_in = 4; + ClaimTokenIncentivesIx claim_token_incentives = 5; + CloseUserVolumeAccumulatorIx close_user_volume_accumulator = 6; + CollectCoinCreatorFeeIx collect_coin_creator_fee = 7; + CreateConfigIx create_config = 8; + CreatePoolIx create_pool = 9; + DepositIx deposit = 10; + DisableIx disable = 11; + ExtendAccountIx extend_account = 12; + InitUserVolumeAccumulatorIx init_user_volume_accumulator = 13; + SellIx sell = 14; + SetCoinCreatorIx set_coin_creator = 15; + SetReservedFeeRecipientsIx set_reserved_fee_recipients = 16; + SyncUserVolumeAccumulatorIx sync_user_volume_accumulator = 17; + ToggleMayhemModeIx toggle_mayhem_mode = 18; + UpdateAdminIx update_admin = 19; + UpdateFeeConfigIx update_fee_config = 20; + WithdrawIx withdraw = 21; } } diff --git a/crates/pump-swaps-parser/src/generated_parser/accounts_parser.rs b/crates/pump-swaps-parser/src/generated_parser/accounts_parser.rs index dcf9516a..b3c22b37 100644 --- a/crates/pump-swaps-parser/src/generated_parser/accounts_parser.rs +++ b/crates/pump-swaps-parser/src/generated_parser/accounts_parser.rs @@ -5,10 +5,15 @@ //! //! -use crate::{ - accounts::{BondingCurve, GlobalConfig, Pool}, - deserialize_checked, ID, -}; +use crate::accounts::BondingCurve; +use crate::accounts::FeeConfig; +use crate::accounts::GlobalConfig; +use crate::accounts::GlobalVolumeAccumulator; +use crate::accounts::Pool; +use crate::accounts::UserVolumeAccumulator; +use crate::ID; + +use crate::deserialize_checked; /// PumpAmm Program State #[allow(clippy::large_enum_variant)] @@ -16,8 +21,11 @@ use crate::{ #[cfg_attr(feature = "tracing", derive(strum_macros::Display))] pub enum PumpAmmProgramState { BondingCurve(BondingCurve), + FeeConfig(FeeConfig), GlobalConfig(GlobalConfig), + GlobalVolumeAccumulator(GlobalVolumeAccumulator), Pool(Pool), + UserVolumeAccumulator(UserVolumeAccumulator), } impl PumpAmmProgramState { @@ -27,12 +35,25 @@ impl PumpAmmProgramState { [23, 183, 248, 55, 96, 216, 172, 96] => Ok(PumpAmmProgramState::BondingCurve( deserialize_checked(data_bytes, &acc_discriminator)?, )), + [143, 52, 146, 187, 219, 123, 76, 155] => Ok(PumpAmmProgramState::FeeConfig( + deserialize_checked(data_bytes, &acc_discriminator)?, + )), [149, 8, 156, 202, 160, 252, 176, 217] => Ok(PumpAmmProgramState::GlobalConfig( deserialize_checked(data_bytes, &acc_discriminator)?, )), + [202, 42, 246, 43, 142, 190, 30, 255] => { + Ok(PumpAmmProgramState::GlobalVolumeAccumulator( + deserialize_checked(data_bytes, &acc_discriminator)?, + )) + }, [241, 154, 109, 4, 17, 177, 109, 188] => Ok(PumpAmmProgramState::Pool( deserialize_checked(data_bytes, &acc_discriminator)?, )), + [86, 255, 112, 14, 102, 53, 154, 250] => { + Ok(PumpAmmProgramState::UserVolumeAccumulator( + deserialize_checked(data_bytes, &acc_discriminator)?, + )) + }, _ => Err(yellowstone_vixen_core::ParseError::from( "Invalid Account discriminator".to_owned(), )), @@ -71,7 +92,9 @@ impl yellowstone_vixen_core::Parser for AccountParser { type Input = yellowstone_vixen_core::AccountUpdate; type Output = PumpAmmProgramState; - fn id(&self) -> std::borrow::Cow<'static, str> { "pump_amm::AccountParser".into() } + fn id(&self) -> std::borrow::Cow<'static, str> { + "pump_amm::AccountParser".into() + } fn prefilter(&self) -> yellowstone_vixen_core::Prefilter { yellowstone_vixen_core::Prefilter::builder() @@ -109,15 +132,18 @@ impl yellowstone_vixen_core::Parser for AccountParser { impl yellowstone_vixen_core::ProgramParser for AccountParser { #[inline] - fn program_id(&self) -> yellowstone_vixen_core::Pubkey { ID.to_bytes().into() } + fn program_id(&self) -> yellowstone_vixen_core::Pubkey { + ID.to_bytes().into() + } } // #[cfg(feature = "proto")] mod proto_parser { + use super::{AccountParser, PumpAmmProgramState}; + use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; use yellowstone_vixen_core::proto::ParseProto; - use super::{AccountParser, BondingCurve, PumpAmmProgramState}; - use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; + use super::BondingCurve; impl IntoProto for BondingCurve { fn into_proto(self) -> proto_def::BondingCurve { proto_def::BondingCurve { @@ -128,6 +154,18 @@ mod proto_parser { token_total_supply: self.token_total_supply, complete: self.complete, creator: self.creator.to_string(), + is_mayhem_mode: self.is_mayhem_mode, + } + } + } + use super::FeeConfig; + impl IntoProto for FeeConfig { + fn into_proto(self) -> proto_def::FeeConfig { + proto_def::FeeConfig { + bump: self.bump.into(), + admin: self.admin.to_string(), + flat_fees: Some(self.flat_fees.into_proto()), + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), } } } @@ -145,6 +183,28 @@ mod proto_parser { .map(|x| x.to_string()) .collect(), coin_creator_fee_basis_points: self.coin_creator_fee_basis_points, + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), + whitelist_pda: self.whitelist_pda.to_string(), + reserved_fee_recipient: self.reserved_fee_recipient.to_string(), + mayhem_mode_enabled: self.mayhem_mode_enabled, + reserved_fee_recipients: self + .reserved_fee_recipients + .into_iter() + .map(|x| x.to_string()) + .collect(), + } + } + } + use super::GlobalVolumeAccumulator; + impl IntoProto for GlobalVolumeAccumulator { + fn into_proto(self) -> proto_def::GlobalVolumeAccumulator { + proto_def::GlobalVolumeAccumulator { + start_time: self.start_time, + end_time: self.end_time, + seconds_in_a_day: self.seconds_in_a_day, + mint: self.mint.to_string(), + total_token_supply: self.total_token_supply.to_vec(), + sol_volumes: self.sol_volumes.to_vec(), } } } @@ -162,6 +222,21 @@ mod proto_parser { pool_quote_token_account: self.pool_quote_token_account.to_string(), lp_supply: self.lp_supply, coin_creator: self.coin_creator.to_string(), + is_mayhem_mode: self.is_mayhem_mode, + } + } + } + use super::UserVolumeAccumulator; + impl IntoProto for UserVolumeAccumulator { + fn into_proto(self) -> proto_def::UserVolumeAccumulator { + proto_def::UserVolumeAccumulator { + user: self.user.to_string(), + needs_claim: self.needs_claim, + total_unclaimed_tokens: self.total_unclaimed_tokens, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + last_update_timestamp: self.last_update_timestamp, + has_total_claimed_tokens: self.has_total_claimed_tokens, } } } @@ -172,12 +247,21 @@ mod proto_parser { PumpAmmProgramState::BondingCurve(data) => { proto_def::program_state::StateOneof::BondingCurve(data.into_proto()) }, + PumpAmmProgramState::FeeConfig(data) => { + proto_def::program_state::StateOneof::FeeConfig(data.into_proto()) + }, PumpAmmProgramState::GlobalConfig(data) => { proto_def::program_state::StateOneof::GlobalConfig(data.into_proto()) }, + PumpAmmProgramState::GlobalVolumeAccumulator(data) => { + proto_def::program_state::StateOneof::GlobalVolumeAccumulator(data.into_proto()) + }, PumpAmmProgramState::Pool(data) => { proto_def::program_state::StateOneof::Pool(data.into_proto()) }, + PumpAmmProgramState::UserVolumeAccumulator(data) => { + proto_def::program_state::StateOneof::UserVolumeAccumulator(data.into_proto()) + }, }; proto_def::ProgramState { @@ -189,6 +273,8 @@ mod proto_parser { impl ParseProto for AccountParser { type Message = proto_def::ProgramState; - fn output_into_message(value: Self::Output) -> Self::Message { value.into_proto() } + fn output_into_message(value: Self::Output) -> Self::Message { + value.into_proto() + } } } diff --git a/crates/pump-swaps-parser/src/generated_parser/instructions_parser.rs b/crates/pump-swaps-parser/src/generated_parser/instructions_parser.rs index 62dc4b43..b2139c5e 100644 --- a/crates/pump-swaps-parser/src/generated_parser/instructions_parser.rs +++ b/crates/pump-swaps-parser/src/generated_parser/instructions_parser.rs @@ -11,37 +11,64 @@ use std::sync::Arc; #[cfg(feature = "shared-data")] use yellowstone_vixen_core::InstructionUpdateOutput; -use crate::{ - deserialize_checked, - instructions::{ - Buy as BuyIxAccounts, BuyInstructionArgs as BuyIxData, - CollectCoinCreatorFee as CollectCoinCreatorFeeIxAccounts, - CreateConfig as CreateConfigIxAccounts, CreateConfigInstructionArgs as CreateConfigIxData, - CreatePool as CreatePoolIxAccounts, CreatePoolInstructionArgs as CreatePoolIxData, - Deposit as DepositIxAccounts, DepositInstructionArgs as DepositIxData, - Disable as DisableIxAccounts, DisableInstructionArgs as DisableIxData, - ExtendAccount as ExtendAccountIxAccounts, Sell as SellIxAccounts, - SellInstructionArgs as SellIxData, SetCoinCreator as SetCoinCreatorIxAccounts, - UpdateAdmin as UpdateAdminIxAccounts, UpdateFeeConfig as UpdateFeeConfigIxAccounts, - UpdateFeeConfigInstructionArgs as UpdateFeeConfigIxData, Withdraw as WithdrawIxAccounts, - WithdrawInstructionArgs as WithdrawIxData, - }, - ID, +use crate::deserialize_checked; + +use crate::instructions::{ + AdminSetCoinCreator as AdminSetCoinCreatorIxAccounts, + AdminSetCoinCreatorInstructionArgs as AdminSetCoinCreatorIxData, + AdminUpdateTokenIncentives as AdminUpdateTokenIncentivesIxAccounts, + AdminUpdateTokenIncentivesInstructionArgs as AdminUpdateTokenIncentivesIxData, + Buy as BuyIxAccounts, BuyExactQuoteIn as BuyExactQuoteInIxAccounts, + BuyExactQuoteInInstructionArgs as BuyExactQuoteInIxData, BuyInstructionArgs as BuyIxData, + ClaimTokenIncentives as ClaimTokenIncentivesIxAccounts, + CloseUserVolumeAccumulator as CloseUserVolumeAccumulatorIxAccounts, + CollectCoinCreatorFee as CollectCoinCreatorFeeIxAccounts, + CreateConfig as CreateConfigIxAccounts, CreateConfigInstructionArgs as CreateConfigIxData, + CreatePool as CreatePoolIxAccounts, CreatePoolInstructionArgs as CreatePoolIxData, + Deposit as DepositIxAccounts, DepositInstructionArgs as DepositIxData, + Disable as DisableIxAccounts, DisableInstructionArgs as DisableIxData, + ExtendAccount as ExtendAccountIxAccounts, + InitUserVolumeAccumulator as InitUserVolumeAccumulatorIxAccounts, Sell as SellIxAccounts, + SellInstructionArgs as SellIxData, SetCoinCreator as SetCoinCreatorIxAccounts, + SetReservedFeeRecipients as SetReservedFeeRecipientsIxAccounts, + SetReservedFeeRecipientsInstructionArgs as SetReservedFeeRecipientsIxData, + SyncUserVolumeAccumulator as SyncUserVolumeAccumulatorIxAccounts, + ToggleMayhemMode as ToggleMayhemModeIxAccounts, + ToggleMayhemModeInstructionArgs as ToggleMayhemModeIxData, + UpdateAdmin as UpdateAdminIxAccounts, UpdateFeeConfig as UpdateFeeConfigIxAccounts, + UpdateFeeConfigInstructionArgs as UpdateFeeConfigIxData, Withdraw as WithdrawIxAccounts, + WithdrawInstructionArgs as WithdrawIxData, }; +use crate::ID; /// PumpAmm Instructions #[derive(Debug)] #[cfg_attr(feature = "tracing", derive(strum_macros::Display))] pub enum PumpAmmProgramIx { + AdminSetCoinCreator(AdminSetCoinCreatorIxAccounts, AdminSetCoinCreatorIxData), + AdminUpdateTokenIncentives( + AdminUpdateTokenIncentivesIxAccounts, + AdminUpdateTokenIncentivesIxData, + ), Buy(BuyIxAccounts, BuyIxData), + BuyExactQuoteIn(BuyExactQuoteInIxAccounts, BuyExactQuoteInIxData), + ClaimTokenIncentives(ClaimTokenIncentivesIxAccounts), + CloseUserVolumeAccumulator(CloseUserVolumeAccumulatorIxAccounts), CollectCoinCreatorFee(CollectCoinCreatorFeeIxAccounts), CreateConfig(CreateConfigIxAccounts, CreateConfigIxData), CreatePool(CreatePoolIxAccounts, CreatePoolIxData), Deposit(DepositIxAccounts, DepositIxData), Disable(DisableIxAccounts, DisableIxData), ExtendAccount(ExtendAccountIxAccounts), + InitUserVolumeAccumulator(InitUserVolumeAccumulatorIxAccounts), Sell(SellIxAccounts, SellIxData), SetCoinCreator(SetCoinCreatorIxAccounts), + SetReservedFeeRecipients( + SetReservedFeeRecipientsIxAccounts, + SetReservedFeeRecipientsIxData, + ), + SyncUserVolumeAccumulator(SyncUserVolumeAccumulatorIxAccounts), + ToggleMayhemMode(ToggleMayhemModeIxAccounts, ToggleMayhemModeIxData), UpdateAdmin(UpdateAdminIxAccounts), UpdateFeeConfig(UpdateFeeConfigIxAccounts, UpdateFeeConfigIxData), Withdraw(WithdrawIxAccounts, WithdrawIxData), @@ -52,12 +79,16 @@ pub struct InstructionParser; impl yellowstone_vixen_core::Parser for InstructionParser { type Input = yellowstone_vixen_core::instruction::InstructionUpdate; + #[cfg(not(feature = "shared-data"))] type Output = PumpAmmProgramIx; + #[cfg(feature = "shared-data")] type Output = InstructionUpdateOutput; - fn id(&self) -> std::borrow::Cow<'static, str> { "PumpAmm::InstructionParser".into() } + fn id(&self) -> std::borrow::Cow<'static, str> { + "PumpAmm::InstructionParser".into() + } fn prefilter(&self) -> yellowstone_vixen_core::Prefilter { yellowstone_vixen_core::Prefilter::builder() @@ -96,7 +127,9 @@ impl yellowstone_vixen_core::Parser for InstructionParser { impl yellowstone_vixen_core::ProgramParser for InstructionParser { #[inline] - fn program_id(&self) -> yellowstone_vixen_core::Pubkey { ID.to_bytes().into() } + fn program_id(&self) -> yellowstone_vixen_core::Pubkey { + ID.to_bytes().into() + } } impl InstructionParser { @@ -112,8 +145,47 @@ impl InstructionParser { let ix_discriminator: [u8; 8] = ix.data[0..8].try_into()?; let ix_data = &ix.data[8..]; let ix = match ix_discriminator { + [242, 40, 117, 145, 73, 96, 105, 104] => { + let expected_accounts_len = 5; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = AdminSetCoinCreatorIxAccounts { + admin_set_coin_creator_authority: next_account(accounts)?, + global_config: next_account(accounts)?, + pool: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: AdminSetCoinCreatorIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpAmmProgramIx::AdminSetCoinCreator( + ix_accounts, + de_ix_data, + )) + }, + [209, 11, 115, 87, 213, 23, 124, 204] => { + let expected_accounts_len = 10; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = AdminUpdateTokenIncentivesIxAccounts { + admin: next_account(accounts)?, + global_config: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + mint: next_account(accounts)?, + global_incentive_token_account: next_account(accounts)?, + associated_token_program: next_account(accounts)?, + system_program: next_account(accounts)?, + token_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: AdminUpdateTokenIncentivesIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpAmmProgramIx::AdminUpdateTokenIncentives( + ix_accounts, + de_ix_data, + )) + }, [102, 6, 61, 18, 1, 218, 235, 234] => { - let expected_accounts_len = 19; + let expected_accounts_len = 23; check_min_accounts_req(accounts_len, expected_accounts_len)?; let ix_accounts = BuyIxAccounts { pool: next_account(accounts)?, @@ -135,10 +207,76 @@ impl InstructionParser { program: next_account(accounts)?, coin_creator_vault_ata: next_account(accounts)?, coin_creator_vault_authority: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + fee_config: next_account(accounts)?, + fee_program: next_account(accounts)?, }; let de_ix_data: BuyIxData = deserialize_checked(ix_data, &ix_discriminator)?; Ok(PumpAmmProgramIx::Buy(ix_accounts, de_ix_data)) }, + [198, 46, 21, 82, 180, 217, 232, 112] => { + let expected_accounts_len = 23; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = BuyExactQuoteInIxAccounts { + pool: next_account(accounts)?, + user: next_account(accounts)?, + global_config: next_account(accounts)?, + base_mint: next_account(accounts)?, + quote_mint: next_account(accounts)?, + user_base_token_account: next_account(accounts)?, + user_quote_token_account: next_account(accounts)?, + pool_base_token_account: next_account(accounts)?, + pool_quote_token_account: next_account(accounts)?, + protocol_fee_recipient: next_account(accounts)?, + protocol_fee_recipient_token_account: next_account(accounts)?, + base_token_program: next_account(accounts)?, + quote_token_program: next_account(accounts)?, + system_program: next_account(accounts)?, + associated_token_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + coin_creator_vault_ata: next_account(accounts)?, + coin_creator_vault_authority: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + fee_config: next_account(accounts)?, + fee_program: next_account(accounts)?, + }; + let de_ix_data: BuyExactQuoteInIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpAmmProgramIx::BuyExactQuoteIn(ix_accounts, de_ix_data)) + }, + [16, 4, 71, 28, 204, 1, 40, 27] => { + let expected_accounts_len = 12; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = ClaimTokenIncentivesIxAccounts { + user: next_account(accounts)?, + user_ata: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + global_incentive_token_account: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + mint: next_account(accounts)?, + token_program: next_account(accounts)?, + system_program: next_account(accounts)?, + associated_token_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + payer: next_account(accounts)?, + }; + Ok(PumpAmmProgramIx::ClaimTokenIncentives(ix_accounts)) + }, + [249, 69, 164, 218, 150, 103, 84, 138] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = CloseUserVolumeAccumulatorIxAccounts { + user: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpAmmProgramIx::CloseUserVolumeAccumulator(ix_accounts)) + }, [160, 57, 89, 42, 181, 139, 43, 66] => { let expected_accounts_len = 8; check_min_accounts_req(accounts_len, expected_accounts_len)?; @@ -241,8 +379,21 @@ impl InstructionParser { }; Ok(PumpAmmProgramIx::ExtendAccount(ix_accounts)) }, + [94, 6, 202, 115, 255, 96, 232, 183] => { + let expected_accounts_len = 6; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = InitUserVolumeAccumulatorIxAccounts { + payer: next_account(accounts)?, + user: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + system_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpAmmProgramIx::InitUserVolumeAccumulator(ix_accounts)) + }, [51, 230, 133, 164, 1, 127, 131, 173] => { - let expected_accounts_len = 19; + let expected_accounts_len = 21; check_min_accounts_req(accounts_len, expected_accounts_len)?; let ix_accounts = SellIxAccounts { pool: next_account(accounts)?, @@ -264,6 +415,8 @@ impl InstructionParser { program: next_account(accounts)?, coin_creator_vault_ata: next_account(accounts)?, coin_creator_vault_authority: next_account(accounts)?, + fee_config: next_account(accounts)?, + fee_program: next_account(accounts)?, }; let de_ix_data: SellIxData = deserialize_checked(ix_data, &ix_discriminator)?; Ok(PumpAmmProgramIx::Sell(ix_accounts, de_ix_data)) @@ -280,6 +433,47 @@ impl InstructionParser { }; Ok(PumpAmmProgramIx::SetCoinCreator(ix_accounts)) }, + [111, 172, 162, 232, 114, 89, 213, 142] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = SetReservedFeeRecipientsIxAccounts { + global_config: next_account(accounts)?, + admin: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: SetReservedFeeRecipientsIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpAmmProgramIx::SetReservedFeeRecipients( + ix_accounts, + de_ix_data, + )) + }, + [86, 31, 192, 87, 163, 87, 79, 238] => { + let expected_accounts_len = 5; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = SyncUserVolumeAccumulatorIxAccounts { + user: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpAmmProgramIx::SyncUserVolumeAccumulator(ix_accounts)) + }, + [1, 9, 111, 208, 100, 31, 255, 163] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = ToggleMayhemModeIxAccounts { + admin: next_account(accounts)?, + global_config: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: ToggleMayhemModeIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpAmmProgramIx::ToggleMayhemMode(ix_accounts, de_ix_data)) + }, [161, 176, 40, 213, 60, 184, 179, 228] => { let expected_accounts_len = 5; check_min_accounts_req(accounts_len, expected_accounts_len)?; @@ -424,10 +618,62 @@ pub fn next_program_id_optional_account< // #[cfg(feature = "proto")] mod proto_parser { + use super::{InstructionParser, PumpAmmProgramIx}; + use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; use yellowstone_vixen_core::proto::ParseProto; - use super::{BuyIxAccounts, InstructionParser, PumpAmmProgramIx}; - use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; + use super::AdminSetCoinCreatorIxAccounts; + impl IntoProto for AdminSetCoinCreatorIxAccounts { + fn into_proto(self) -> proto_def::AdminSetCoinCreatorIxAccounts { + proto_def::AdminSetCoinCreatorIxAccounts { + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), + global_config: self.global_config.to_string(), + pool: self.pool.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::AdminSetCoinCreatorIxData; + impl IntoProto for AdminSetCoinCreatorIxData { + fn into_proto(self) -> proto_def::AdminSetCoinCreatorIxData { + proto_def::AdminSetCoinCreatorIxData { + coin_creator: self.coin_creator.to_string(), + } + } + } + use super::AdminUpdateTokenIncentivesIxAccounts; + impl IntoProto + for AdminUpdateTokenIncentivesIxAccounts + { + fn into_proto(self) -> proto_def::AdminUpdateTokenIncentivesIxAccounts { + proto_def::AdminUpdateTokenIncentivesIxAccounts { + admin: self.admin.to_string(), + global_config: self.global_config.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + mint: self.mint.to_string(), + global_incentive_token_account: self.global_incentive_token_account.to_string(), + associated_token_program: self.associated_token_program.to_string(), + system_program: self.system_program.to_string(), + token_program: self.token_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::AdminUpdateTokenIncentivesIxData; + impl IntoProto for AdminUpdateTokenIncentivesIxData { + fn into_proto(self) -> proto_def::AdminUpdateTokenIncentivesIxData { + proto_def::AdminUpdateTokenIncentivesIxData { + start_time: self.start_time, + end_time: self.end_time, + seconds_in_a_day: self.seconds_in_a_day, + day_number: self.day_number, + token_supply_per_day: self.token_supply_per_day, + } + } + } + use super::BuyIxAccounts; impl IntoProto for BuyIxAccounts { fn into_proto(self) -> proto_def::BuyIxAccounts { proto_def::BuyIxAccounts { @@ -452,6 +698,10 @@ mod proto_parser { program: self.program.to_string(), coin_creator_vault_ata: self.coin_creator_vault_ata.to_string(), coin_creator_vault_authority: self.coin_creator_vault_authority.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + fee_config: self.fee_config.to_string(), + fee_program: self.fee_program.to_string(), } } } @@ -464,6 +714,79 @@ mod proto_parser { } } } + use super::BuyExactQuoteInIxAccounts; + impl IntoProto for BuyExactQuoteInIxAccounts { + fn into_proto(self) -> proto_def::BuyExactQuoteInIxAccounts { + proto_def::BuyExactQuoteInIxAccounts { + pool: self.pool.to_string(), + user: self.user.to_string(), + global_config: self.global_config.to_string(), + base_mint: self.base_mint.to_string(), + quote_mint: self.quote_mint.to_string(), + user_base_token_account: self.user_base_token_account.to_string(), + user_quote_token_account: self.user_quote_token_account.to_string(), + pool_base_token_account: self.pool_base_token_account.to_string(), + pool_quote_token_account: self.pool_quote_token_account.to_string(), + protocol_fee_recipient: self.protocol_fee_recipient.to_string(), + protocol_fee_recipient_token_account: self + .protocol_fee_recipient_token_account + .to_string(), + base_token_program: self.base_token_program.to_string(), + quote_token_program: self.quote_token_program.to_string(), + system_program: self.system_program.to_string(), + associated_token_program: self.associated_token_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + coin_creator_vault_ata: self.coin_creator_vault_ata.to_string(), + coin_creator_vault_authority: self.coin_creator_vault_authority.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + fee_config: self.fee_config.to_string(), + fee_program: self.fee_program.to_string(), + } + } + } + use super::BuyExactQuoteInIxData; + impl IntoProto for BuyExactQuoteInIxData { + fn into_proto(self) -> proto_def::BuyExactQuoteInIxData { + proto_def::BuyExactQuoteInIxData { + spendable_quote_in: self.spendable_quote_in, + min_base_amount_out: self.min_base_amount_out, + } + } + } + use super::ClaimTokenIncentivesIxAccounts; + impl IntoProto for ClaimTokenIncentivesIxAccounts { + fn into_proto(self) -> proto_def::ClaimTokenIncentivesIxAccounts { + proto_def::ClaimTokenIncentivesIxAccounts { + user: self.user.to_string(), + user_ata: self.user_ata.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + global_incentive_token_account: self.global_incentive_token_account.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + mint: self.mint.to_string(), + token_program: self.token_program.to_string(), + system_program: self.system_program.to_string(), + associated_token_program: self.associated_token_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + payer: self.payer.to_string(), + } + } + } + use super::CloseUserVolumeAccumulatorIxAccounts; + impl IntoProto + for CloseUserVolumeAccumulatorIxAccounts + { + fn into_proto(self) -> proto_def::CloseUserVolumeAccumulatorIxAccounts { + proto_def::CloseUserVolumeAccumulatorIxAccounts { + user: self.user.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } use super::CollectCoinCreatorFeeIxAccounts; impl IntoProto for CollectCoinCreatorFeeIxAccounts { fn into_proto(self) -> proto_def::CollectCoinCreatorFeeIxAccounts { @@ -503,6 +826,7 @@ mod proto_parser { .map(|x| x.to_string()) .collect(), coin_creator_fee_basis_points: self.coin_creator_fee_basis_points, + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), } } } @@ -539,6 +863,7 @@ mod proto_parser { base_amount_in: self.base_amount_in, quote_amount_in: self.quote_amount_in, coin_creator: self.coin_creator.to_string(), + is_mayhem_mode: self.is_mayhem_mode, } } } @@ -609,6 +934,21 @@ mod proto_parser { } } } + use super::InitUserVolumeAccumulatorIxAccounts; + impl IntoProto + for InitUserVolumeAccumulatorIxAccounts + { + fn into_proto(self) -> proto_def::InitUserVolumeAccumulatorIxAccounts { + proto_def::InitUserVolumeAccumulatorIxAccounts { + payer: self.payer.to_string(), + user: self.user.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + system_program: self.system_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } use super::SellIxAccounts; impl IntoProto for SellIxAccounts { fn into_proto(self) -> proto_def::SellIxAccounts { @@ -634,6 +974,8 @@ mod proto_parser { program: self.program.to_string(), coin_creator_vault_ata: self.coin_creator_vault_ata.to_string(), coin_creator_vault_authority: self.coin_creator_vault_authority.to_string(), + fee_config: self.fee_config.to_string(), + fee_program: self.fee_program.to_string(), } } } @@ -658,6 +1000,60 @@ mod proto_parser { } } } + use super::SetReservedFeeRecipientsIxAccounts; + impl IntoProto + for SetReservedFeeRecipientsIxAccounts + { + fn into_proto(self) -> proto_def::SetReservedFeeRecipientsIxAccounts { + proto_def::SetReservedFeeRecipientsIxAccounts { + global_config: self.global_config.to_string(), + admin: self.admin.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::SetReservedFeeRecipientsIxData; + impl IntoProto for SetReservedFeeRecipientsIxData { + fn into_proto(self) -> proto_def::SetReservedFeeRecipientsIxData { + proto_def::SetReservedFeeRecipientsIxData { + whitelist_pda: self.whitelist_pda.to_string(), + } + } + } + use super::SyncUserVolumeAccumulatorIxAccounts; + impl IntoProto + for SyncUserVolumeAccumulatorIxAccounts + { + fn into_proto(self) -> proto_def::SyncUserVolumeAccumulatorIxAccounts { + proto_def::SyncUserVolumeAccumulatorIxAccounts { + user: self.user.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::ToggleMayhemModeIxAccounts; + impl IntoProto for ToggleMayhemModeIxAccounts { + fn into_proto(self) -> proto_def::ToggleMayhemModeIxAccounts { + proto_def::ToggleMayhemModeIxAccounts { + admin: self.admin.to_string(), + global_config: self.global_config.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::ToggleMayhemModeIxData; + impl IntoProto for ToggleMayhemModeIxData { + fn into_proto(self) -> proto_def::ToggleMayhemModeIxData { + proto_def::ToggleMayhemModeIxData { + enabled: self.enabled, + } + } + } use super::UpdateAdminIxAccounts; impl IntoProto for UpdateAdminIxAccounts { fn into_proto(self) -> proto_def::UpdateAdminIxAccounts { @@ -693,6 +1089,7 @@ mod proto_parser { .map(|x| x.to_string()) .collect(), coin_creator_fee_basis_points: self.coin_creator_fee_basis_points, + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), } } } @@ -732,12 +1129,50 @@ mod proto_parser { impl IntoProto for PumpAmmProgramIx { fn into_proto(self) -> proto_def::ProgramIxs { match self { + PumpAmmProgramIx::AdminSetCoinCreator(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::AdminSetCoinCreator( + proto_def::AdminSetCoinCreatorIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpAmmProgramIx::AdminUpdateTokenIncentives(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::AdminUpdateTokenIncentives( + proto_def::AdminUpdateTokenIncentivesIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, PumpAmmProgramIx::Buy(acc, data) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::Buy(proto_def::BuyIx { accounts: Some(acc.into_proto()), data: Some(data.into_proto()), })), }, + PumpAmmProgramIx::BuyExactQuoteIn(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::BuyExactQuoteIn( + proto_def::BuyExactQuoteInIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpAmmProgramIx::ClaimTokenIncentives(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::ClaimTokenIncentives( + proto_def::ClaimTokenIncentivesIx { + accounts: Some(acc.into_proto()), + }, + )), + }, + PumpAmmProgramIx::CloseUserVolumeAccumulator(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::CloseUserVolumeAccumulator( + proto_def::CloseUserVolumeAccumulatorIx { + accounts: Some(acc.into_proto()), + }, + )), + }, PumpAmmProgramIx::CollectCoinCreatorFee(acc) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::CollectCoinCreatorFee( proto_def::CollectCoinCreatorFeeIx { @@ -784,6 +1219,13 @@ mod proto_parser { }, )), }, + PumpAmmProgramIx::InitUserVolumeAccumulator(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::InitUserVolumeAccumulator( + proto_def::InitUserVolumeAccumulatorIx { + accounts: Some(acc.into_proto()), + }, + )), + }, PumpAmmProgramIx::Sell(acc, data) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::Sell(proto_def::SellIx { accounts: Some(acc.into_proto()), @@ -797,6 +1239,29 @@ mod proto_parser { }, )), }, + PumpAmmProgramIx::SetReservedFeeRecipients(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::SetReservedFeeRecipients( + proto_def::SetReservedFeeRecipientsIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpAmmProgramIx::SyncUserVolumeAccumulator(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::SyncUserVolumeAccumulator( + proto_def::SyncUserVolumeAccumulatorIx { + accounts: Some(acc.into_proto()), + }, + )), + }, + PumpAmmProgramIx::ToggleMayhemMode(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::ToggleMayhemMode( + proto_def::ToggleMayhemModeIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, PumpAmmProgramIx::UpdateAdmin(acc) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::UpdateAdmin( proto_def::UpdateAdminIx { diff --git a/crates/pump-swaps-parser/src/generated_parser/proto_helpers.rs b/crates/pump-swaps-parser/src/generated_parser/proto_helpers.rs index edc05f5d..a53f4dcc 100644 --- a/crates/pump-swaps-parser/src/generated_parser/proto_helpers.rs +++ b/crates/pump-swaps-parser/src/generated_parser/proto_helpers.rs @@ -9,7 +9,36 @@ pub mod proto_types_parsers { use yellowstone_vixen_core::proto_helper_traits; proto_helper_traits!(); - use crate::{proto_def, types::BuyEvent}; + use crate::proto_def; + + use crate::types::AdminSetCoinCreatorEvent; + impl IntoProto for AdminSetCoinCreatorEvent { + fn into_proto(self) -> proto_def::AdminSetCoinCreatorEvent { + proto_def::AdminSetCoinCreatorEvent { + timestamp: self.timestamp, + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), + base_mint: self.base_mint.to_string(), + pool: self.pool.to_string(), + old_coin_creator: self.old_coin_creator.to_string(), + new_coin_creator: self.new_coin_creator.to_string(), + } + } + } + use crate::types::AdminUpdateTokenIncentivesEvent; + impl IntoProto for AdminUpdateTokenIncentivesEvent { + fn into_proto(self) -> proto_def::AdminUpdateTokenIncentivesEvent { + proto_def::AdminUpdateTokenIncentivesEvent { + start_time: self.start_time, + end_time: self.end_time, + day_number: self.day_number, + token_supply_per_day: self.token_supply_per_day, + mint: self.mint.to_string(), + seconds_in_a_day: self.seconds_in_a_day, + timestamp: self.timestamp, + } + } + } + use crate::types::BuyEvent; impl IntoProto for BuyEvent { fn into_proto(self) -> proto_def::BuyEvent { proto_def::BuyEvent { @@ -38,6 +67,39 @@ pub mod proto_types_parsers { coin_creator: self.coin_creator.to_string(), coin_creator_fee_basis_points: self.coin_creator_fee_basis_points, coin_creator_fee: self.coin_creator_fee, + track_volume: self.track_volume, + total_unclaimed_tokens: self.total_unclaimed_tokens, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + last_update_timestamp: self.last_update_timestamp, + min_base_amount_out: self.min_base_amount_out, + ix_name: self.ix_name, + } + } + } + use crate::types::ClaimTokenIncentivesEvent; + impl IntoProto for ClaimTokenIncentivesEvent { + fn into_proto(self) -> proto_def::ClaimTokenIncentivesEvent { + proto_def::ClaimTokenIncentivesEvent { + user: self.user.to_string(), + mint: self.mint.to_string(), + amount: self.amount, + timestamp: self.timestamp, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + } + } + } + use crate::types::CloseUserVolumeAccumulatorEvent; + impl IntoProto for CloseUserVolumeAccumulatorEvent { + fn into_proto(self) -> proto_def::CloseUserVolumeAccumulatorEvent { + proto_def::CloseUserVolumeAccumulatorEvent { + user: self.user.to_string(), + timestamp: self.timestamp, + total_unclaimed_tokens: self.total_unclaimed_tokens, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + last_update_timestamp: self.last_update_timestamp, } } } @@ -67,6 +129,7 @@ pub mod proto_types_parsers { .map(|x| x.to_string()) .collect(), coin_creator_fee_basis_points: self.coin_creator_fee_basis_points, + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), } } } @@ -94,6 +157,7 @@ pub mod proto_types_parsers { user_base_token_account: self.user_base_token_account.to_string(), user_quote_token_account: self.user_quote_token_account.to_string(), coin_creator: self.coin_creator.to_string(), + is_mayhem_mode: self.is_mayhem_mode, } } } @@ -146,6 +210,49 @@ pub mod proto_types_parsers { } } } + use crate::types::FeeTier; + impl IntoProto for FeeTier { + fn into_proto(self) -> proto_def::FeeTier { + proto_def::FeeTier { + market_cap_lamports_threshold: self.market_cap_lamports_threshold.to_string(), + fees: Some(self.fees.into_proto()), + } + } + } + use crate::types::Fees; + impl IntoProto for Fees { + fn into_proto(self) -> proto_def::Fees { + proto_def::Fees { + lp_fee_bps: self.lp_fee_bps, + protocol_fee_bps: self.protocol_fee_bps, + creator_fee_bps: self.creator_fee_bps, + } + } + } + use crate::types::InitUserVolumeAccumulatorEvent; + impl IntoProto for InitUserVolumeAccumulatorEvent { + fn into_proto(self) -> proto_def::InitUserVolumeAccumulatorEvent { + proto_def::InitUserVolumeAccumulatorEvent { + payer: self.payer.to_string(), + user: self.user.to_string(), + timestamp: self.timestamp, + } + } + } + use crate::types::ReservedFeeRecipientsEvent; + impl IntoProto for ReservedFeeRecipientsEvent { + fn into_proto(self) -> proto_def::ReservedFeeRecipientsEvent { + proto_def::ReservedFeeRecipientsEvent { + timestamp: self.timestamp, + reserved_fee_recipient: self.reserved_fee_recipient.to_string(), + reserved_fee_recipients: self + .reserved_fee_recipients + .into_iter() + .map(|x| x.to_string()) + .collect(), + } + } + } use crate::types::SellEvent; impl IntoProto for SellEvent { fn into_proto(self) -> proto_def::SellEvent { @@ -202,6 +309,17 @@ pub mod proto_types_parsers { } } } + use crate::types::SyncUserVolumeAccumulatorEvent; + impl IntoProto for SyncUserVolumeAccumulatorEvent { + fn into_proto(self) -> proto_def::SyncUserVolumeAccumulatorEvent { + proto_def::SyncUserVolumeAccumulatorEvent { + user: self.user.to_string(), + total_claimed_tokens_before: self.total_claimed_tokens_before, + total_claimed_tokens_after: self.total_claimed_tokens_after, + timestamp: self.timestamp, + } + } + } use crate::types::UpdateAdminEvent; impl IntoProto for UpdateAdminEvent { fn into_proto(self) -> proto_def::UpdateAdminEvent { @@ -226,6 +344,7 @@ pub mod proto_types_parsers { .map(|x| x.to_string()) .collect(), coin_creator_fee_basis_points: self.coin_creator_fee_basis_points, + admin_set_coin_creator_authority: self.admin_set_coin_creator_authority.to_string(), } } } diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/bonding_curve.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/bonding_curve.rs index 45c195a3..f509f4cf 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/accounts/bonding_curve.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/bonding_curve.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -23,10 +24,13 @@ pub struct BondingCurve { serde(with = "serde_with::As::") )] pub creator: Pubkey, + pub is_mayhem_mode: bool, } +pub const BONDING_CURVE_DISCRIMINATOR: [u8; 8] = [23, 183, 248, 55, 96, 216, 172, 96]; + impl BondingCurve { - pub const LEN: usize = 81; + pub const LEN: usize = 82; #[inline(always)] pub fn from_bytes(data: &[u8]) -> Result { @@ -126,7 +130,9 @@ impl anchor_lang::AccountSerialize for BondingCurve {} #[cfg(feature = "anchor")] impl anchor_lang::Owner for BondingCurve { - fn owner() -> Pubkey { crate::PUMP_AMM_ID } + fn owner() -> Pubkey { + crate::PUMP_AMM_ID + } } #[cfg(feature = "anchor-idl-build")] @@ -134,5 +140,5 @@ impl anchor_lang::IdlBuild for BondingCurve {} #[cfg(feature = "anchor-idl-build")] impl anchor_lang::Discriminator for BondingCurve { - const DISCRIMINATOR: [u8; 8] = [0; 8]; + const DISCRIMINATOR: &[u8] = &[0; 8]; } diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/fee_config.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/fee_config.rs new file mode 100644 index 00000000..4c2e1330 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/fee_config.rs @@ -0,0 +1,140 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FeeConfig { + pub discriminator: [u8; 8], + pub bump: u8, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin: Pubkey, + pub flat_fees: Fees, + pub fee_tiers: Vec, +} + +pub const FEE_CONFIG_DISCRIMINATOR: [u8; 8] = [143, 52, 146, 187, 219, 123, 76, 155]; + +impl FeeConfig { + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for FeeConfig { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_fee_config(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = FeeConfig::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_fee_config(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = FeeConfig::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for FeeConfig { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for FeeConfig {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for FeeConfig { + fn owner() -> Pubkey { + crate::PUMP_AMM_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for FeeConfig {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for FeeConfig { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/global_config.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/global_config.rs index 8ef420ee..3c59dc4f 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/accounts/global_config.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/global_config.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -18,9 +19,7 @@ pub struct GlobalConfig { serde(with = "serde_with::As::") )] pub admin: Pubkey, - /// The lp fee in basis points (0.01%) pub lp_fee_basis_points: u64, - /// The protocol fee in basis points (0.01%) pub protocol_fee_basis_points: u64, /// Flags to disable certain functionality /// bit 0 - Disable create pool @@ -31,12 +30,31 @@ pub struct GlobalConfig { pub disable_flags: u8, /// Addresses of the protocol fee recipients pub protocol_fee_recipients: [Pubkey; 8], - /// The coin creator fee in basis points (0.01%) pub coin_creator_fee_basis_points: u64, + /// The admin authority for setting coin creators + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_coin_creator_authority: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub whitelist_pda: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub reserved_fee_recipient: Pubkey, + pub mayhem_mode_enabled: bool, + pub reserved_fee_recipients: [Pubkey; 7], } +pub const GLOBAL_CONFIG_DISCRIMINATOR: [u8; 8] = [149, 8, 156, 202, 160, 252, 176, 217]; + impl GlobalConfig { - pub const LEN: usize = 321; + pub const LEN: usize = 642; #[inline(always)] pub fn from_bytes(data: &[u8]) -> Result { @@ -136,7 +154,9 @@ impl anchor_lang::AccountSerialize for GlobalConfig {} #[cfg(feature = "anchor")] impl anchor_lang::Owner for GlobalConfig { - fn owner() -> Pubkey { crate::PUMP_AMM_ID } + fn owner() -> Pubkey { + crate::PUMP_AMM_ID + } } #[cfg(feature = "anchor-idl-build")] @@ -144,5 +164,5 @@ impl anchor_lang::IdlBuild for GlobalConfig {} #[cfg(feature = "anchor-idl-build")] impl anchor_lang::Discriminator for GlobalConfig { - const DISCRIMINATOR: [u8; 8] = [0; 8]; + const DISCRIMINATOR: &[u8] = &[0; 8]; } diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/global_volume_accumulator.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/global_volume_accumulator.rs new file mode 100644 index 00000000..192f54b5 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/global_volume_accumulator.rs @@ -0,0 +1,144 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct GlobalVolumeAccumulator { + pub discriminator: [u8; 8], + pub start_time: i64, + pub end_time: i64, + pub seconds_in_a_day: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + pub total_token_supply: [u64; 30], + pub sol_volumes: [u64; 30], +} + +pub const GLOBAL_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = [202, 42, 246, 43, 142, 190, 30, 255]; + +impl GlobalVolumeAccumulator { + pub const LEN: usize = 544; + + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for GlobalVolumeAccumulator { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_global_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = + Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = GlobalVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_global_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = + Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = GlobalVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for GlobalVolumeAccumulator { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for GlobalVolumeAccumulator {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for GlobalVolumeAccumulator { + fn owner() -> Pubkey { + crate::PUMP_AMM_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for GlobalVolumeAccumulator {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for GlobalVolumeAccumulator { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/mod.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/mod.rs index ec4fa857..a1c47d59 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/accounts/mod.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/mod.rs @@ -6,7 +6,15 @@ //! pub(crate) mod r#bonding_curve; +pub(crate) mod r#fee_config; pub(crate) mod r#global_config; +pub(crate) mod r#global_volume_accumulator; pub(crate) mod r#pool; +pub(crate) mod r#user_volume_accumulator; -pub use self::{r#bonding_curve::*, r#global_config::*, r#pool::*}; +pub use self::r#bonding_curve::*; +pub use self::r#fee_config::*; +pub use self::r#global_config::*; +pub use self::r#global_volume_accumulator::*; +pub use self::r#pool::*; +pub use self::r#user_volume_accumulator::*; diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/pool.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/pool.rs index b8d42243..e0d04e0c 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/accounts/pool.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/pool.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -51,10 +52,13 @@ pub struct Pool { serde(with = "serde_with::As::") )] pub coin_creator: Pubkey, + pub is_mayhem_mode: bool, } +pub const POOL_DISCRIMINATOR: [u8; 8] = [241, 154, 109, 4, 17, 177, 109, 188]; + impl Pool { - pub const LEN: usize = 243; + pub const LEN: usize = 244; #[inline(always)] pub fn from_bytes(data: &[u8]) -> Result { @@ -154,7 +158,9 @@ impl anchor_lang::AccountSerialize for Pool {} #[cfg(feature = "anchor")] impl anchor_lang::Owner for Pool { - fn owner() -> Pubkey { crate::PUMP_AMM_ID } + fn owner() -> Pubkey { + crate::PUMP_AMM_ID + } } #[cfg(feature = "anchor-idl-build")] @@ -162,5 +168,5 @@ impl anchor_lang::IdlBuild for Pool {} #[cfg(feature = "anchor-idl-build")] impl anchor_lang::Discriminator for Pool { - const DISCRIMINATOR: [u8; 8] = [0; 8]; + const DISCRIMINATOR: &[u8] = &[0; 8]; } diff --git a/crates/pump-swaps-parser/src/generated_sdk/accounts/user_volume_accumulator.rs b/crates/pump-swaps-parser/src/generated_sdk/accounts/user_volume_accumulator.rs new file mode 100644 index 00000000..61c80bfe --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/accounts/user_volume_accumulator.rs @@ -0,0 +1,144 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UserVolumeAccumulator { + pub discriminator: [u8; 8], + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub needs_claim: bool, + pub total_unclaimed_tokens: u64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, + pub last_update_timestamp: i64, + pub has_total_claimed_tokens: bool, +} + +pub const USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = [86, 255, 112, 14, 102, 53, 154, 250]; + +impl UserVolumeAccumulator { + pub const LEN: usize = 74; + + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for UserVolumeAccumulator { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_user_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = + Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = UserVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_user_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = UserVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for UserVolumeAccumulator { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for UserVolumeAccumulator {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for UserVolumeAccumulator { + fn owner() -> Pubkey { + crate::PUMP_AMM_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for UserVolumeAccumulator {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for UserVolumeAccumulator { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/errors/pump_amm.rs b/crates/pump-swaps-parser/src/generated_sdk/errors/pump_amm.rs index a9147ede..0e86159b 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/errors/pump_amm.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/errors/pump_amm.rs @@ -42,22 +42,22 @@ pub enum PumpAmmError { InvalidQuoteMint = 0x1779, /// 6010 - #[error("")] - InvalidLpMint = 0x177a, + InvalidLpMint = 0x177A, /// 6011 - #[error("")] - AllProtocolFeeRecipientsShouldBeNonZero = 0x177b, + AllProtocolFeeRecipientsShouldBeNonZero = 0x177B, /// 6012 - #[error("")] - UnsortedNotUniqueProtocolFeeRecipients = 0x177c, + UnsortedNotUniqueProtocolFeeRecipients = 0x177C, /// 6013 - #[error("")] - InvalidProtocolFeeRecipient = 0x177d, + InvalidProtocolFeeRecipient = 0x177D, /// 6014 - #[error("")] - InvalidPoolBaseTokenAccount = 0x177e, + InvalidPoolBaseTokenAccount = 0x177E, /// 6015 - #[error("")] - InvalidPoolQuoteTokenAccount = 0x177f, + InvalidPoolQuoteTokenAccount = 0x177F, /// 6016 - #[error("")] BuyMoreBaseAmountThanPoolReserves = 0x1780, @@ -90,23 +90,65 @@ pub enum PumpAmmError { DivisionByZero = 0x1789, /// 6026 - #[error("")] - NewSizeLessThanCurrentSize = 0x178a, + NewSizeLessThanCurrentSize = 0x178A, /// 6027 - #[error("")] - AccountTypeNotSupported = 0x178b, + AccountTypeNotSupported = 0x178B, /// 6028 - #[error("")] - OnlyCanonicalPumpPoolsCanHaveCoinCreator = 0x178c, + OnlyCanonicalPumpPoolsCanHaveCoinCreator = 0x178C, + /// 6029 - + #[error("")] + InvalidAdminSetCoinCreatorAuthority = 0x178D, + /// 6030 - + #[error("")] + StartTimeInThePast = 0x178E, + /// 6031 - + #[error("")] + EndTimeInThePast = 0x178F, + /// 6032 - + #[error("")] + EndTimeBeforeStartTime = 0x1790, + /// 6033 - + #[error("")] + TimeRangeTooLarge = 0x1791, + /// 6034 - + #[error("")] + EndTimeBeforeCurrentDay = 0x1792, + /// 6035 - + #[error("")] + SupplyUpdateForFinishedRange = 0x1793, + /// 6036 - + #[error("")] + DayIndexAfterEndIndex = 0x1794, + /// 6037 - + #[error("")] + DayInActiveRange = 0x1795, + /// 6038 - + #[error("")] + InvalidIncentiveMint = 0x1796, + /// 6039 - buy: Not enough quote tokens to cover for fees. + #[error("buy: Not enough quote tokens to cover for fees.")] + BuyNotEnoughQuoteTokensToCoverFees = 0x1797, + /// 6040 - buy: slippage - would buy less tokens than expected min_base_amount_out + #[error("buy: slippage - would buy less tokens than expected min_base_amount_out")] + BuySlippageBelowMinBaseAmountOut = 0x1798, + /// 6041 - + #[error("")] + MayhemModeDisabled = 0x1799, + /// 6042 - + #[error("")] + OnlyPumpPoolsMayhemMode = 0x179A, + /// 6043 - + #[error("")] + MayhemModeInDesiredState = 0x179B, + /// 6044 - + #[error("")] + NotEnoughRemainingAccounts = 0x179C, } -#[allow(deprecated)] -impl solana_program_error::PrintProgramError for PumpAmmError { - fn print(&self) { - solana_msg::msg!(&self.to_string()); +impl From for solana_program_error::ProgramError { + fn from(e: PumpAmmError) -> Self { + solana_program_error::ProgramError::Custom(e as u32) } } - -#[allow(deprecated)] -impl solana_decode_error::DecodeError for PumpAmmError { - fn type_of() -> &'static str { "PumpAmmError" } -} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/admin_set_coin_creator.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/admin_set_coin_creator.rs new file mode 100644 index 00000000..b05989bb --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/admin_set_coin_creator.rs @@ -0,0 +1,476 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +pub const ADMIN_SET_COIN_CREATOR_DISCRIMINATOR: [u8; 8] = [242, 40, 117, 145, 73, 96, 105, 104]; + +/// Accounts. +#[derive(Debug)] +pub struct AdminSetCoinCreator { + pub admin_set_coin_creator_authority: solana_pubkey::Pubkey, + + pub global_config: solana_pubkey::Pubkey, + + pub pool: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl AdminSetCoinCreator { + pub fn instruction( + &self, + args: AdminSetCoinCreatorInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AdminSetCoinCreatorInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin_set_coin_creator_authority, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.pool, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AdminSetCoinCreatorInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetCoinCreatorInstructionData { + discriminator: [u8; 8], +} + +impl AdminSetCoinCreatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [242, 40, 117, 145, 73, 96, 105, 104], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for AdminSetCoinCreatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetCoinCreatorInstructionArgs { + pub coin_creator: Pubkey, +} + +impl AdminSetCoinCreatorInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `AdminSetCoinCreator`. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin_set_coin_creator_authority +/// 1. `[]` global_config +/// 2. `[writable]` pool +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug, Default)] +pub struct AdminSetCoinCreatorBuilder { + admin_set_coin_creator_authority: Option, + global_config: Option, + pool: Option, + event_authority: Option, + program: Option, + coin_creator: Option, + __remaining_accounts: Vec, +} + +impl AdminSetCoinCreatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn admin_set_coin_creator_authority( + &mut self, + admin_set_coin_creator_authority: solana_pubkey::Pubkey, + ) -> &mut Self { + self.admin_set_coin_creator_authority = Some(admin_set_coin_creator_authority); + self + } + #[inline(always)] + pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { + self.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { + self.pool = Some(pool); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn coin_creator(&mut self, coin_creator: Pubkey) -> &mut Self { + self.coin_creator = Some(coin_creator); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = AdminSetCoinCreator { + admin_set_coin_creator_authority: self + .admin_set_coin_creator_authority + .expect("admin_set_coin_creator_authority is not set"), + global_config: self.global_config.expect("global_config is not set"), + pool: self.pool.expect("pool is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = AdminSetCoinCreatorInstructionArgs { + coin_creator: self.coin_creator.clone().expect("coin_creator is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `admin_set_coin_creator` CPI accounts. +pub struct AdminSetCoinCreatorCpiAccounts<'a, 'b> { + pub admin_set_coin_creator_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub pool: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `admin_set_coin_creator` CPI instruction. +pub struct AdminSetCoinCreatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub admin_set_coin_creator_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub pool: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AdminSetCoinCreatorInstructionArgs, +} + +impl<'a, 'b> AdminSetCoinCreatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: AdminSetCoinCreatorCpiAccounts<'a, 'b>, + args: AdminSetCoinCreatorInstructionArgs, + ) -> Self { + Self { + __program: program, + admin_set_coin_creator_authority: accounts.admin_set_coin_creator_authority, + global_config: accounts.global_config, + pool: accounts.pool, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin_set_coin_creator_authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AdminSetCoinCreatorInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.admin_set_coin_creator_authority.clone()); + account_infos.push(self.global_config.clone()); + account_infos.push(self.pool.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AdminSetCoinCreator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin_set_coin_creator_authority +/// 1. `[]` global_config +/// 2. `[writable]` pool +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug)] +pub struct AdminSetCoinCreatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AdminSetCoinCreatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AdminSetCoinCreatorCpiBuilderInstruction { + __program: program, + admin_set_coin_creator_authority: None, + global_config: None, + pool: None, + event_authority: None, + program: None, + coin_creator: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn admin_set_coin_creator_authority( + &mut self, + admin_set_coin_creator_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.admin_set_coin_creator_authority = Some(admin_set_coin_creator_authority); + self + } + #[inline(always)] + pub fn global_config( + &mut self, + global_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.pool = Some(pool); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn coin_creator(&mut self, coin_creator: Pubkey) -> &mut Self { + self.instruction.coin_creator = Some(coin_creator); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = AdminSetCoinCreatorInstructionArgs { + coin_creator: self + .instruction + .coin_creator + .clone() + .expect("coin_creator is not set"), + }; + let instruction = AdminSetCoinCreatorCpi { + __program: self.instruction.__program, + + admin_set_coin_creator_authority: self + .instruction + .admin_set_coin_creator_authority + .expect("admin_set_coin_creator_authority is not set"), + + global_config: self + .instruction + .global_config + .expect("global_config is not set"), + + pool: self.instruction.pool.expect("pool is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct AdminSetCoinCreatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + admin_set_coin_creator_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + global_config: Option<&'b solana_account_info::AccountInfo<'a>>, + pool: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + coin_creator: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/admin_update_token_incentives.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/admin_update_token_incentives.rs new file mode 100644 index 00000000..bae1dc24 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/admin_update_token_incentives.rs @@ -0,0 +1,772 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const ADMIN_UPDATE_TOKEN_INCENTIVES_DISCRIMINATOR: [u8; 8] = + [209, 11, 115, 87, 213, 23, 124, 204]; + +/// Accounts. +#[derive(Debug)] +pub struct AdminUpdateTokenIncentives { + pub admin: solana_pubkey::Pubkey, + + pub global_config: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub mint: solana_pubkey::Pubkey, + + pub global_incentive_token_account: solana_pubkey::Pubkey, + + pub associated_token_program: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub token_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl AdminUpdateTokenIncentives { + pub fn instruction( + &self, + args: AdminUpdateTokenIncentivesInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AdminUpdateTokenIncentivesInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(10 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.admin, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_incentive_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AdminUpdateTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminUpdateTokenIncentivesInstructionData { + discriminator: [u8; 8], +} + +impl AdminUpdateTokenIncentivesInstructionData { + pub fn new() -> Self { + Self { + discriminator: [209, 11, 115, 87, 213, 23, 124, 204], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for AdminUpdateTokenIncentivesInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminUpdateTokenIncentivesInstructionArgs { + pub start_time: i64, + pub end_time: i64, + pub seconds_in_a_day: i64, + pub day_number: u64, + pub token_supply_per_day: u64, +} + +impl AdminUpdateTokenIncentivesInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `AdminUpdateTokenIncentives`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` admin +/// 1. `[]` global_config +/// 2. `[writable]` global_volume_accumulator +/// 3. `[]` mint +/// 4. `[writable]` global_incentive_token_account +/// 5. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 6. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 7. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 8. `[]` event_authority +/// 9. `[]` program +#[derive(Clone, Debug, Default)] +pub struct AdminUpdateTokenIncentivesBuilder { + admin: Option, + global_config: Option, + global_volume_accumulator: Option, + mint: Option, + global_incentive_token_account: Option, + associated_token_program: Option, + system_program: Option, + token_program: Option, + event_authority: Option, + program: Option, + start_time: Option, + end_time: Option, + seconds_in_a_day: Option, + day_number: Option, + token_supply_per_day: Option, + __remaining_accounts: Vec, +} + +impl AdminUpdateTokenIncentivesBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { + self.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_incentive_token_account = Some(global_incentive_token_account); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn start_time(&mut self, start_time: i64) -> &mut Self { + self.start_time = Some(start_time); + self + } + #[inline(always)] + pub fn end_time(&mut self, end_time: i64) -> &mut Self { + self.end_time = Some(end_time); + self + } + #[inline(always)] + pub fn seconds_in_a_day(&mut self, seconds_in_a_day: i64) -> &mut Self { + self.seconds_in_a_day = Some(seconds_in_a_day); + self + } + #[inline(always)] + pub fn day_number(&mut self, day_number: u64) -> &mut Self { + self.day_number = Some(day_number); + self + } + #[inline(always)] + pub fn token_supply_per_day(&mut self, token_supply_per_day: u64) -> &mut Self { + self.token_supply_per_day = Some(token_supply_per_day); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = AdminUpdateTokenIncentives { + admin: self.admin.expect("admin is not set"), + global_config: self.global_config.expect("global_config is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + mint: self.mint.expect("mint is not set"), + global_incentive_token_account: self + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + associated_token_program: self.associated_token_program.unwrap_or( + solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = AdminUpdateTokenIncentivesInstructionArgs { + start_time: self.start_time.clone().expect("start_time is not set"), + end_time: self.end_time.clone().expect("end_time is not set"), + seconds_in_a_day: self + .seconds_in_a_day + .clone() + .expect("seconds_in_a_day is not set"), + day_number: self.day_number.clone().expect("day_number is not set"), + token_supply_per_day: self + .token_supply_per_day + .clone() + .expect("token_supply_per_day is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `admin_update_token_incentives` CPI accounts. +pub struct AdminUpdateTokenIncentivesCpiAccounts<'a, 'b> { + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `admin_update_token_incentives` CPI instruction. +pub struct AdminUpdateTokenIncentivesCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AdminUpdateTokenIncentivesInstructionArgs, +} + +impl<'a, 'b> AdminUpdateTokenIncentivesCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: AdminUpdateTokenIncentivesCpiAccounts<'a, 'b>, + args: AdminUpdateTokenIncentivesInstructionArgs, + ) -> Self { + Self { + __program: program, + admin: accounts.admin, + global_config: accounts.global_config, + global_volume_accumulator: accounts.global_volume_accumulator, + mint: accounts.mint, + global_incentive_token_account: accounts.global_incentive_token_account, + associated_token_program: accounts.associated_token_program, + system_program: accounts.system_program, + token_program: accounts.token_program, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(10 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.admin.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_incentive_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AdminUpdateTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.global_config.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.global_incentive_token_account.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AdminUpdateTokenIncentives` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` admin +/// 1. `[]` global_config +/// 2. `[writable]` global_volume_accumulator +/// 3. `[]` mint +/// 4. `[writable]` global_incentive_token_account +/// 5. `[]` associated_token_program +/// 6. `[]` system_program +/// 7. `[]` token_program +/// 8. `[]` event_authority +/// 9. `[]` program +#[derive(Clone, Debug)] +pub struct AdminUpdateTokenIncentivesCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AdminUpdateTokenIncentivesCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AdminUpdateTokenIncentivesCpiBuilderInstruction { + __program: program, + admin: None, + global_config: None, + global_volume_accumulator: None, + mint: None, + global_incentive_token_account: None, + associated_token_program: None, + system_program: None, + token_program: None, + event_authority: None, + program: None, + start_time: None, + end_time: None, + seconds_in_a_day: None, + day_number: None, + token_supply_per_day: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn global_config( + &mut self, + global_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_incentive_token_account = Some(global_incentive_token_account); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn start_time(&mut self, start_time: i64) -> &mut Self { + self.instruction.start_time = Some(start_time); + self + } + #[inline(always)] + pub fn end_time(&mut self, end_time: i64) -> &mut Self { + self.instruction.end_time = Some(end_time); + self + } + #[inline(always)] + pub fn seconds_in_a_day(&mut self, seconds_in_a_day: i64) -> &mut Self { + self.instruction.seconds_in_a_day = Some(seconds_in_a_day); + self + } + #[inline(always)] + pub fn day_number(&mut self, day_number: u64) -> &mut Self { + self.instruction.day_number = Some(day_number); + self + } + #[inline(always)] + pub fn token_supply_per_day(&mut self, token_supply_per_day: u64) -> &mut Self { + self.instruction.token_supply_per_day = Some(token_supply_per_day); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = AdminUpdateTokenIncentivesInstructionArgs { + start_time: self + .instruction + .start_time + .clone() + .expect("start_time is not set"), + end_time: self + .instruction + .end_time + .clone() + .expect("end_time is not set"), + seconds_in_a_day: self + .instruction + .seconds_in_a_day + .clone() + .expect("seconds_in_a_day is not set"), + day_number: self + .instruction + .day_number + .clone() + .expect("day_number is not set"), + token_supply_per_day: self + .instruction + .token_supply_per_day + .clone() + .expect("token_supply_per_day is not set"), + }; + let instruction = AdminUpdateTokenIncentivesCpi { + __program: self.instruction.__program, + + admin: self.instruction.admin.expect("admin is not set"), + + global_config: self + .instruction + .global_config + .expect("global_config is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + global_incentive_token_account: self + .instruction + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct AdminUpdateTokenIncentivesCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + global_config: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + global_incentive_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + start_time: Option, + end_time: Option, + seconds_in_a_day: Option, + day_number: Option, + token_supply_per_day: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/buy.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/buy.rs index f7158361..0673335e 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/buy.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/buy.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const BUY_DISCRIMINATOR: [u8; 8] = [102, 6, 61, 18, 1, 218, 235, 234]; /// Accounts. #[derive(Debug)] @@ -47,13 +50,20 @@ pub struct Buy { pub coin_creator_vault_ata: solana_pubkey::Pubkey, pub coin_creator_vault_authority: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub fee_program: solana_pubkey::Pubkey, } impl Buy { pub fn instruction(&self, args: BuyInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -61,10 +71,8 @@ impl Buy { args: BuyInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta], ) -> solana_instruction::Instruction { - let mut accounts = Vec::with_capacity(19 + remaining_accounts.len()); - accounts.push(solana_instruction::AccountMeta::new_readonly( - self.pool, false, - )); + let mut accounts = Vec::with_capacity(23 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.pool, false)); accounts.push(solana_instruction::AccountMeta::new(self.user, true)); accounts.push(solana_instruction::AccountMeta::new_readonly( self.global_config, @@ -134,9 +142,25 @@ impl Buy { self.coin_creator_vault_authority, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_program, + false, + )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&BuyInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = BuyInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -159,10 +183,16 @@ impl BuyInstructionData { discriminator: [102, 6, 61, 18, 1, 218, 235, 234], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for BuyInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -172,11 +202,17 @@ pub struct BuyInstructionArgs { pub max_quote_amount_in: u64, } +impl BuyInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Buy`. /// /// ### Accounts: /// -/// 0. `[]` pool +/// 0. `[writable]` pool /// 1. `[writable, signer]` user /// 2. `[]` global_config /// 3. `[]` base_mint @@ -192,9 +228,13 @@ pub struct BuyInstructionArgs { /// 13. `[optional]` system_program (default to `11111111111111111111111111111111`) /// 14. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) /// 15. `[]` event_authority -/// 16. `[]` program +/// 16. `[optional]` program (default to `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA`) /// 17. `[writable]` coin_creator_vault_ata /// 18. `[]` coin_creator_vault_authority +/// 19. `[]` global_volume_accumulator +/// 20. `[writable]` user_volume_accumulator +/// 21. `[]` fee_config +/// 22. `[optional]` fee_program (default to `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`) #[derive(Clone, Debug, Default)] pub struct BuyBuilder { pool: Option, @@ -216,44 +256,44 @@ pub struct BuyBuilder { program: Option, coin_creator_vault_ata: Option, coin_creator_vault_authority: Option, + global_volume_accumulator: Option, + user_volume_accumulator: Option, + fee_config: Option, + fee_program: Option, base_amount_out: Option, max_quote_amount_in: Option, __remaining_accounts: Vec, } impl BuyBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: solana_pubkey::Pubkey) -> &mut Self { self.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { self.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -262,7 +302,6 @@ impl BuyBuilder { self.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -271,7 +310,6 @@ impl BuyBuilder { self.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -280,7 +318,6 @@ impl BuyBuilder { self.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -289,7 +326,6 @@ impl BuyBuilder { self.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn protocol_fee_recipient( &mut self, @@ -298,7 +334,6 @@ impl BuyBuilder { self.protocol_fee_recipient = Some(protocol_fee_recipient); self } - #[inline(always)] pub fn protocol_fee_recipient_token_account( &mut self, @@ -307,26 +342,22 @@ impl BuyBuilder { self.protocol_fee_recipient_token_account = Some(protocol_fee_recipient_token_account); self } - #[inline(always)] pub fn base_token_program(&mut self, base_token_program: solana_pubkey::Pubkey) -> &mut Self { self.base_token_program = Some(base_token_program); self } - #[inline(always)] pub fn quote_token_program(&mut self, quote_token_program: solana_pubkey::Pubkey) -> &mut Self { self.quote_token_program = Some(quote_token_program); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` #[inline(always)] pub fn associated_token_program( @@ -336,19 +367,17 @@ impl BuyBuilder { self.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - + /// `[optional account, default to 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA']` #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn coin_creator_vault_ata( &mut self, @@ -357,7 +386,6 @@ impl BuyBuilder { self.coin_creator_vault_ata = Some(coin_creator_vault_ata); self } - #[inline(always)] pub fn coin_creator_vault_authority( &mut self, @@ -366,26 +394,49 @@ impl BuyBuilder { self.coin_creator_vault_authority = Some(coin_creator_vault_authority); self } - + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to 'pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ']` + #[inline(always)] + pub fn fee_program(&mut self, fee_program: solana_pubkey::Pubkey) -> &mut Self { + self.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn base_amount_out(&mut self, base_amount_out: u64) -> &mut Self { self.base_amount_out = Some(base_amount_out); self } - #[inline(always)] pub fn max_quote_amount_in(&mut self, max_quote_amount_in: u64) -> &mut Self { self.max_quote_amount_in = Some(max_quote_amount_in); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -395,7 +446,6 @@ impl BuyBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Buy { @@ -435,13 +485,25 @@ impl BuyBuilder { solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), ), event_authority: self.event_authority.expect("event_authority is not set"), - program: self.program.expect("program is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + )), coin_creator_vault_ata: self .coin_creator_vault_ata .expect("coin_creator_vault_ata is not set"), coin_creator_vault_authority: self .coin_creator_vault_authority .expect("coin_creator_vault_authority is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + fee_config: self.fee_config.expect("fee_config is not set"), + fee_program: self.fee_program.unwrap_or(solana_pubkey::pubkey!( + "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + )), }; let args = BuyInstructionArgs { base_amount_out: self @@ -497,6 +559,14 @@ pub struct BuyCpiAccounts<'a, 'b> { pub coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, pub coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, } /// `buy` CPI instruction. @@ -541,6 +611,14 @@ pub struct BuyCpi<'a, 'b> { pub coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, pub coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, /// The arguments for the instruction. pub __args: BuyInstructionArgs, } @@ -572,31 +650,28 @@ impl<'a, 'b> BuyCpi<'a, 'b> { program: accounts.program, coin_creator_vault_ata: accounts.coin_creator_vault_ata, coin_creator_vault_authority: accounts.coin_creator_vault_authority, + global_volume_accumulator: accounts.global_volume_accumulator, + user_volume_accumulator: accounts.user_volume_accumulator, + fee_config: accounts.fee_config, + fee_program: accounts.fee_program, __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -604,12 +679,9 @@ impl<'a, 'b> BuyCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(19 + remaining_accounts.len()); - accounts.push(solana_instruction::AccountMeta::new_readonly( - *self.pool.key, - false, - )); + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(23 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.global_config.key, @@ -679,6 +751,22 @@ impl<'a, 'b> BuyCpi<'a, 'b> { *self.coin_creator_vault_authority.key, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_program.key, + false, + )); remaining_accounts.iter().for_each(|remaining_account| { accounts.push(solana_instruction::AccountMeta { pubkey: *remaining_account.0.key, @@ -686,8 +774,8 @@ impl<'a, 'b> BuyCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&BuyInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = BuyInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -695,7 +783,7 @@ impl<'a, 'b> BuyCpi<'a, 'b> { accounts, data, }; - let mut account_infos = Vec::with_capacity(20 + remaining_accounts.len()); + let mut account_infos = Vec::with_capacity(24 + remaining_accounts.len()); account_infos.push(self.__program.clone()); account_infos.push(self.pool.clone()); account_infos.push(self.user.clone()); @@ -716,6 +804,10 @@ impl<'a, 'b> BuyCpi<'a, 'b> { account_infos.push(self.program.clone()); account_infos.push(self.coin_creator_vault_ata.clone()); account_infos.push(self.coin_creator_vault_authority.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.fee_program.clone()); remaining_accounts .iter() .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); @@ -732,7 +824,7 @@ impl<'a, 'b> BuyCpi<'a, 'b> { /// /// ### Accounts: /// -/// 0. `[]` pool +/// 0. `[writable]` pool /// 1. `[writable, signer]` user /// 2. `[]` global_config /// 3. `[]` base_mint @@ -751,6 +843,10 @@ impl<'a, 'b> BuyCpi<'a, 'b> { /// 16. `[]` program /// 17. `[writable]` coin_creator_vault_ata /// 18. `[]` coin_creator_vault_authority +/// 19. `[]` global_volume_accumulator +/// 20. `[writable]` user_volume_accumulator +/// 21. `[]` fee_config +/// 22. `[]` fee_program #[derive(Clone, Debug)] pub struct BuyCpiBuilder<'a, 'b> { instruction: Box>, @@ -779,25 +875,26 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { program: None, coin_creator_vault_ata: None, coin_creator_vault_authority: None, + global_volume_accumulator: None, + user_volume_accumulator: None, + fee_config: None, + fee_program: None, base_amount_out: None, max_quote_amount_in: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn global_config( &mut self, @@ -806,13 +903,11 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint( &mut self, @@ -821,7 +916,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -830,7 +924,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -839,7 +932,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -848,7 +940,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -857,7 +948,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn protocol_fee_recipient( &mut self, @@ -866,7 +956,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.protocol_fee_recipient = Some(protocol_fee_recipient); self } - #[inline(always)] pub fn protocol_fee_recipient_token_account( &mut self, @@ -876,7 +965,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { Some(protocol_fee_recipient_token_account); self } - #[inline(always)] pub fn base_token_program( &mut self, @@ -885,7 +973,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.base_token_program = Some(base_token_program); self } - #[inline(always)] pub fn quote_token_program( &mut self, @@ -894,7 +981,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.quote_token_program = Some(quote_token_program); self } - #[inline(always)] pub fn system_program( &mut self, @@ -903,7 +989,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn associated_token_program( &mut self, @@ -912,7 +997,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -921,13 +1005,11 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn coin_creator_vault_ata( &mut self, @@ -936,7 +1018,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.coin_creator_vault_ata = Some(coin_creator_vault_ata); self } - #[inline(always)] pub fn coin_creator_vault_authority( &mut self, @@ -945,19 +1026,48 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.coin_creator_vault_authority = Some(coin_creator_vault_authority); self } - + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn fee_program( + &mut self, + fee_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn base_amount_out(&mut self, base_amount_out: u64) -> &mut Self { self.instruction.base_amount_out = Some(base_amount_out); self } - #[inline(always)] pub fn max_quote_amount_in(&mut self, max_quote_amount_in: u64) -> &mut Self { self.instruction.max_quote_amount_in = Some(max_quote_amount_in); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -971,7 +1081,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -986,16 +1095,13 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = BuyInstructionArgs { base_amount_out: self .instruction @@ -1090,6 +1196,23 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { .instruction .coin_creator_vault_authority .expect("coin_creator_vault_authority is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + fee_program: self + .instruction + .fee_program + .expect("fee_program is not set"), __args: args, }; instruction.invoke_signed_with_remaining_accounts( @@ -1121,6 +1244,10 @@ struct BuyCpiBuilderInstruction<'a, 'b> { program: Option<&'b solana_account_info::AccountInfo<'a>>, coin_creator_vault_ata: Option<&'b solana_account_info::AccountInfo<'a>>, coin_creator_vault_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_program: Option<&'b solana_account_info::AccountInfo<'a>>, base_amount_out: Option, max_quote_amount_in: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/buy_exact_quote_in.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/buy_exact_quote_in.rs new file mode 100644 index 00000000..88a1a1e7 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/buy_exact_quote_in.rs @@ -0,0 +1,1258 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const BUY_EXACT_QUOTE_IN_DISCRIMINATOR: [u8; 8] = [198, 46, 21, 82, 180, 217, 232, 112]; + +/// Accounts. +#[derive(Debug)] +pub struct BuyExactQuoteIn { + pub pool: solana_pubkey::Pubkey, + + pub user: solana_pubkey::Pubkey, + + pub global_config: solana_pubkey::Pubkey, + + pub base_mint: solana_pubkey::Pubkey, + + pub quote_mint: solana_pubkey::Pubkey, + + pub user_base_token_account: solana_pubkey::Pubkey, + + pub user_quote_token_account: solana_pubkey::Pubkey, + + pub pool_base_token_account: solana_pubkey::Pubkey, + + pub pool_quote_token_account: solana_pubkey::Pubkey, + + pub protocol_fee_recipient: solana_pubkey::Pubkey, + + pub protocol_fee_recipient_token_account: solana_pubkey::Pubkey, + + pub base_token_program: solana_pubkey::Pubkey, + + pub quote_token_program: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub associated_token_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, + + pub coin_creator_vault_ata: solana_pubkey::Pubkey, + + pub coin_creator_vault_authority: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub fee_program: solana_pubkey::Pubkey, +} + +impl BuyExactQuoteIn { + pub fn instruction( + &self, + args: BuyExactQuoteInInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: BuyExactQuoteInInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(23 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.pool, false)); + accounts.push(solana_instruction::AccountMeta::new(self.user, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.base_mint, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.quote_mint, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_base_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_quote_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.pool_base_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.pool_quote_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.protocol_fee_recipient, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.protocol_fee_recipient_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.base_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.quote_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.coin_creator_vault_ata, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.coin_creator_vault_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = BuyExactQuoteInInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct BuyExactQuoteInInstructionData { + discriminator: [u8; 8], +} + +impl BuyExactQuoteInInstructionData { + pub fn new() -> Self { + Self { + discriminator: [198, 46, 21, 82, 180, 217, 232, 112], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for BuyExactQuoteInInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct BuyExactQuoteInInstructionArgs { + pub spendable_quote_in: u64, + pub min_base_amount_out: u64, +} + +impl BuyExactQuoteInInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `BuyExactQuoteIn`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` pool +/// 1. `[writable, signer]` user +/// 2. `[]` global_config +/// 3. `[]` base_mint +/// 4. `[]` quote_mint +/// 5. `[writable]` user_base_token_account +/// 6. `[writable]` user_quote_token_account +/// 7. `[writable]` pool_base_token_account +/// 8. `[writable]` pool_quote_token_account +/// 9. `[]` protocol_fee_recipient +/// 10. `[writable]` protocol_fee_recipient_token_account +/// 11. `[]` base_token_program +/// 12. `[]` quote_token_program +/// 13. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 14. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 15. `[]` event_authority +/// 16. `[optional]` program (default to `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA`) +/// 17. `[writable]` coin_creator_vault_ata +/// 18. `[]` coin_creator_vault_authority +/// 19. `[]` global_volume_accumulator +/// 20. `[writable]` user_volume_accumulator +/// 21. `[]` fee_config +/// 22. `[optional]` fee_program (default to `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`) +#[derive(Clone, Debug, Default)] +pub struct BuyExactQuoteInBuilder { + pool: Option, + user: Option, + global_config: Option, + base_mint: Option, + quote_mint: Option, + user_base_token_account: Option, + user_quote_token_account: Option, + pool_base_token_account: Option, + pool_quote_token_account: Option, + protocol_fee_recipient: Option, + protocol_fee_recipient_token_account: Option, + base_token_program: Option, + quote_token_program: Option, + system_program: Option, + associated_token_program: Option, + event_authority: Option, + program: Option, + coin_creator_vault_ata: Option, + coin_creator_vault_authority: Option, + global_volume_accumulator: Option, + user_volume_accumulator: Option, + fee_config: Option, + fee_program: Option, + spendable_quote_in: Option, + min_base_amount_out: Option, + __remaining_accounts: Vec, +} + +impl BuyExactQuoteInBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { + self.pool = Some(pool); + self + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { + self.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn base_mint(&mut self, base_mint: solana_pubkey::Pubkey) -> &mut Self { + self.base_mint = Some(base_mint); + self + } + #[inline(always)] + pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { + self.quote_mint = Some(quote_mint); + self + } + #[inline(always)] + pub fn user_base_token_account( + &mut self, + user_base_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_base_token_account = Some(user_base_token_account); + self + } + #[inline(always)] + pub fn user_quote_token_account( + &mut self, + user_quote_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_quote_token_account = Some(user_quote_token_account); + self + } + #[inline(always)] + pub fn pool_base_token_account( + &mut self, + pool_base_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.pool_base_token_account = Some(pool_base_token_account); + self + } + #[inline(always)] + pub fn pool_quote_token_account( + &mut self, + pool_quote_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.pool_quote_token_account = Some(pool_quote_token_account); + self + } + #[inline(always)] + pub fn protocol_fee_recipient( + &mut self, + protocol_fee_recipient: solana_pubkey::Pubkey, + ) -> &mut Self { + self.protocol_fee_recipient = Some(protocol_fee_recipient); + self + } + #[inline(always)] + pub fn protocol_fee_recipient_token_account( + &mut self, + protocol_fee_recipient_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.protocol_fee_recipient_token_account = Some(protocol_fee_recipient_token_account); + self + } + #[inline(always)] + pub fn base_token_program(&mut self, base_token_program: solana_pubkey::Pubkey) -> &mut Self { + self.base_token_program = Some(base_token_program); + self + } + #[inline(always)] + pub fn quote_token_program(&mut self, quote_token_program: solana_pubkey::Pubkey) -> &mut Self { + self.quote_token_program = Some(quote_token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + /// `[optional account, default to 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA']` + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn coin_creator_vault_ata( + &mut self, + coin_creator_vault_ata: solana_pubkey::Pubkey, + ) -> &mut Self { + self.coin_creator_vault_ata = Some(coin_creator_vault_ata); + self + } + #[inline(always)] + pub fn coin_creator_vault_authority( + &mut self, + coin_creator_vault_authority: solana_pubkey::Pubkey, + ) -> &mut Self { + self.coin_creator_vault_authority = Some(coin_creator_vault_authority); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to 'pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ']` + #[inline(always)] + pub fn fee_program(&mut self, fee_program: solana_pubkey::Pubkey) -> &mut Self { + self.fee_program = Some(fee_program); + self + } + #[inline(always)] + pub fn spendable_quote_in(&mut self, spendable_quote_in: u64) -> &mut Self { + self.spendable_quote_in = Some(spendable_quote_in); + self + } + #[inline(always)] + pub fn min_base_amount_out(&mut self, min_base_amount_out: u64) -> &mut Self { + self.min_base_amount_out = Some(min_base_amount_out); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = BuyExactQuoteIn { + pool: self.pool.expect("pool is not set"), + user: self.user.expect("user is not set"), + global_config: self.global_config.expect("global_config is not set"), + base_mint: self.base_mint.expect("base_mint is not set"), + quote_mint: self.quote_mint.expect("quote_mint is not set"), + user_base_token_account: self + .user_base_token_account + .expect("user_base_token_account is not set"), + user_quote_token_account: self + .user_quote_token_account + .expect("user_quote_token_account is not set"), + pool_base_token_account: self + .pool_base_token_account + .expect("pool_base_token_account is not set"), + pool_quote_token_account: self + .pool_quote_token_account + .expect("pool_quote_token_account is not set"), + protocol_fee_recipient: self + .protocol_fee_recipient + .expect("protocol_fee_recipient is not set"), + protocol_fee_recipient_token_account: self + .protocol_fee_recipient_token_account + .expect("protocol_fee_recipient_token_account is not set"), + base_token_program: self + .base_token_program + .expect("base_token_program is not set"), + quote_token_program: self + .quote_token_program + .expect("quote_token_program is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + associated_token_program: self.associated_token_program.unwrap_or( + solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + )), + coin_creator_vault_ata: self + .coin_creator_vault_ata + .expect("coin_creator_vault_ata is not set"), + coin_creator_vault_authority: self + .coin_creator_vault_authority + .expect("coin_creator_vault_authority is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + fee_config: self.fee_config.expect("fee_config is not set"), + fee_program: self.fee_program.unwrap_or(solana_pubkey::pubkey!( + "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + )), + }; + let args = BuyExactQuoteInInstructionArgs { + spendable_quote_in: self + .spendable_quote_in + .clone() + .expect("spendable_quote_in is not set"), + min_base_amount_out: self + .min_base_amount_out + .clone() + .expect("min_base_amount_out is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `buy_exact_quote_in` CPI accounts. +pub struct BuyExactQuoteInCpiAccounts<'a, 'b> { + pub pool: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub base_mint: &'b solana_account_info::AccountInfo<'a>, + + pub quote_mint: &'b solana_account_info::AccountInfo<'a>, + + pub user_base_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub user_quote_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub pool_base_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub pool_quote_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub protocol_fee_recipient: &'b solana_account_info::AccountInfo<'a>, + + pub protocol_fee_recipient_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub base_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub quote_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, + + pub coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `buy_exact_quote_in` CPI instruction. +pub struct BuyExactQuoteInCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub pool: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub base_mint: &'b solana_account_info::AccountInfo<'a>, + + pub quote_mint: &'b solana_account_info::AccountInfo<'a>, + + pub user_base_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub user_quote_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub pool_base_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub pool_quote_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub protocol_fee_recipient: &'b solana_account_info::AccountInfo<'a>, + + pub protocol_fee_recipient_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub base_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub quote_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, + + pub coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: BuyExactQuoteInInstructionArgs, +} + +impl<'a, 'b> BuyExactQuoteInCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: BuyExactQuoteInCpiAccounts<'a, 'b>, + args: BuyExactQuoteInInstructionArgs, + ) -> Self { + Self { + __program: program, + pool: accounts.pool, + user: accounts.user, + global_config: accounts.global_config, + base_mint: accounts.base_mint, + quote_mint: accounts.quote_mint, + user_base_token_account: accounts.user_base_token_account, + user_quote_token_account: accounts.user_quote_token_account, + pool_base_token_account: accounts.pool_base_token_account, + pool_quote_token_account: accounts.pool_quote_token_account, + protocol_fee_recipient: accounts.protocol_fee_recipient, + protocol_fee_recipient_token_account: accounts.protocol_fee_recipient_token_account, + base_token_program: accounts.base_token_program, + quote_token_program: accounts.quote_token_program, + system_program: accounts.system_program, + associated_token_program: accounts.associated_token_program, + event_authority: accounts.event_authority, + program: accounts.program, + coin_creator_vault_ata: accounts.coin_creator_vault_ata, + coin_creator_vault_authority: accounts.coin_creator_vault_authority, + global_volume_accumulator: accounts.global_volume_accumulator, + user_volume_accumulator: accounts.user_volume_accumulator, + fee_config: accounts.fee_config, + fee_program: accounts.fee_program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(23 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); + accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.base_mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.quote_mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_base_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_quote_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.pool_base_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.pool_quote_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.protocol_fee_recipient.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.protocol_fee_recipient_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.base_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.quote_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.coin_creator_vault_ata.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.coin_creator_vault_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = BuyExactQuoteInInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(24 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.pool.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.global_config.clone()); + account_infos.push(self.base_mint.clone()); + account_infos.push(self.quote_mint.clone()); + account_infos.push(self.user_base_token_account.clone()); + account_infos.push(self.user_quote_token_account.clone()); + account_infos.push(self.pool_base_token_account.clone()); + account_infos.push(self.pool_quote_token_account.clone()); + account_infos.push(self.protocol_fee_recipient.clone()); + account_infos.push(self.protocol_fee_recipient_token_account.clone()); + account_infos.push(self.base_token_program.clone()); + account_infos.push(self.quote_token_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + account_infos.push(self.coin_creator_vault_ata.clone()); + account_infos.push(self.coin_creator_vault_authority.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.fee_program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `BuyExactQuoteIn` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` pool +/// 1. `[writable, signer]` user +/// 2. `[]` global_config +/// 3. `[]` base_mint +/// 4. `[]` quote_mint +/// 5. `[writable]` user_base_token_account +/// 6. `[writable]` user_quote_token_account +/// 7. `[writable]` pool_base_token_account +/// 8. `[writable]` pool_quote_token_account +/// 9. `[]` protocol_fee_recipient +/// 10. `[writable]` protocol_fee_recipient_token_account +/// 11. `[]` base_token_program +/// 12. `[]` quote_token_program +/// 13. `[]` system_program +/// 14. `[]` associated_token_program +/// 15. `[]` event_authority +/// 16. `[]` program +/// 17. `[writable]` coin_creator_vault_ata +/// 18. `[]` coin_creator_vault_authority +/// 19. `[]` global_volume_accumulator +/// 20. `[writable]` user_volume_accumulator +/// 21. `[]` fee_config +/// 22. `[]` fee_program +#[derive(Clone, Debug)] +pub struct BuyExactQuoteInCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> BuyExactQuoteInCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(BuyExactQuoteInCpiBuilderInstruction { + __program: program, + pool: None, + user: None, + global_config: None, + base_mint: None, + quote_mint: None, + user_base_token_account: None, + user_quote_token_account: None, + pool_base_token_account: None, + pool_quote_token_account: None, + protocol_fee_recipient: None, + protocol_fee_recipient_token_account: None, + base_token_program: None, + quote_token_program: None, + system_program: None, + associated_token_program: None, + event_authority: None, + program: None, + coin_creator_vault_ata: None, + coin_creator_vault_authority: None, + global_volume_accumulator: None, + user_volume_accumulator: None, + fee_config: None, + fee_program: None, + spendable_quote_in: None, + min_base_amount_out: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.pool = Some(pool); + self + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn global_config( + &mut self, + global_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn base_mint(&mut self, base_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.base_mint = Some(base_mint); + self + } + #[inline(always)] + pub fn quote_mint( + &mut self, + quote_mint: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.quote_mint = Some(quote_mint); + self + } + #[inline(always)] + pub fn user_base_token_account( + &mut self, + user_base_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_base_token_account = Some(user_base_token_account); + self + } + #[inline(always)] + pub fn user_quote_token_account( + &mut self, + user_quote_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_quote_token_account = Some(user_quote_token_account); + self + } + #[inline(always)] + pub fn pool_base_token_account( + &mut self, + pool_base_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.pool_base_token_account = Some(pool_base_token_account); + self + } + #[inline(always)] + pub fn pool_quote_token_account( + &mut self, + pool_quote_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.pool_quote_token_account = Some(pool_quote_token_account); + self + } + #[inline(always)] + pub fn protocol_fee_recipient( + &mut self, + protocol_fee_recipient: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.protocol_fee_recipient = Some(protocol_fee_recipient); + self + } + #[inline(always)] + pub fn protocol_fee_recipient_token_account( + &mut self, + protocol_fee_recipient_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.protocol_fee_recipient_token_account = + Some(protocol_fee_recipient_token_account); + self + } + #[inline(always)] + pub fn base_token_program( + &mut self, + base_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.base_token_program = Some(base_token_program); + self + } + #[inline(always)] + pub fn quote_token_program( + &mut self, + quote_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.quote_token_program = Some(quote_token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn coin_creator_vault_ata( + &mut self, + coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.coin_creator_vault_ata = Some(coin_creator_vault_ata); + self + } + #[inline(always)] + pub fn coin_creator_vault_authority( + &mut self, + coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.coin_creator_vault_authority = Some(coin_creator_vault_authority); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn fee_program( + &mut self, + fee_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_program = Some(fee_program); + self + } + #[inline(always)] + pub fn spendable_quote_in(&mut self, spendable_quote_in: u64) -> &mut Self { + self.instruction.spendable_quote_in = Some(spendable_quote_in); + self + } + #[inline(always)] + pub fn min_base_amount_out(&mut self, min_base_amount_out: u64) -> &mut Self { + self.instruction.min_base_amount_out = Some(min_base_amount_out); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = BuyExactQuoteInInstructionArgs { + spendable_quote_in: self + .instruction + .spendable_quote_in + .clone() + .expect("spendable_quote_in is not set"), + min_base_amount_out: self + .instruction + .min_base_amount_out + .clone() + .expect("min_base_amount_out is not set"), + }; + let instruction = BuyExactQuoteInCpi { + __program: self.instruction.__program, + + pool: self.instruction.pool.expect("pool is not set"), + + user: self.instruction.user.expect("user is not set"), + + global_config: self + .instruction + .global_config + .expect("global_config is not set"), + + base_mint: self.instruction.base_mint.expect("base_mint is not set"), + + quote_mint: self.instruction.quote_mint.expect("quote_mint is not set"), + + user_base_token_account: self + .instruction + .user_base_token_account + .expect("user_base_token_account is not set"), + + user_quote_token_account: self + .instruction + .user_quote_token_account + .expect("user_quote_token_account is not set"), + + pool_base_token_account: self + .instruction + .pool_base_token_account + .expect("pool_base_token_account is not set"), + + pool_quote_token_account: self + .instruction + .pool_quote_token_account + .expect("pool_quote_token_account is not set"), + + protocol_fee_recipient: self + .instruction + .protocol_fee_recipient + .expect("protocol_fee_recipient is not set"), + + protocol_fee_recipient_token_account: self + .instruction + .protocol_fee_recipient_token_account + .expect("protocol_fee_recipient_token_account is not set"), + + base_token_program: self + .instruction + .base_token_program + .expect("base_token_program is not set"), + + quote_token_program: self + .instruction + .quote_token_program + .expect("quote_token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + + coin_creator_vault_ata: self + .instruction + .coin_creator_vault_ata + .expect("coin_creator_vault_ata is not set"), + + coin_creator_vault_authority: self + .instruction + .coin_creator_vault_authority + .expect("coin_creator_vault_authority is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + fee_program: self + .instruction + .fee_program + .expect("fee_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct BuyExactQuoteInCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + pool: Option<&'b solana_account_info::AccountInfo<'a>>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + global_config: Option<&'b solana_account_info::AccountInfo<'a>>, + base_mint: Option<&'b solana_account_info::AccountInfo<'a>>, + quote_mint: Option<&'b solana_account_info::AccountInfo<'a>>, + user_base_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + user_quote_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + pool_base_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + pool_quote_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + protocol_fee_recipient: Option<&'b solana_account_info::AccountInfo<'a>>, + protocol_fee_recipient_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + base_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + quote_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + coin_creator_vault_ata: Option<&'b solana_account_info::AccountInfo<'a>>, + coin_creator_vault_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_program: Option<&'b solana_account_info::AccountInfo<'a>>, + spendable_quote_in: Option, + min_base_amount_out: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/claim_token_incentives.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/claim_token_incentives.rs new file mode 100644 index 00000000..0c011530 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/claim_token_incentives.rs @@ -0,0 +1,709 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const CLAIM_TOKEN_INCENTIVES_DISCRIMINATOR: [u8; 8] = [16, 4, 71, 28, 204, 1, 40, 27]; + +/// Accounts. +#[derive(Debug)] +pub struct ClaimTokenIncentives { + pub user: solana_pubkey::Pubkey, + + pub user_ata: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub global_incentive_token_account: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub mint: solana_pubkey::Pubkey, + + pub token_program: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub associated_token_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, + + pub payer: solana_pubkey::Pubkey, +} + +impl ClaimTokenIncentives { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.user_ata, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_incentive_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.payer, true)); + accounts.extend_from_slice(remaining_accounts); + let data = ClaimTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ClaimTokenIncentivesInstructionData { + discriminator: [u8; 8], +} + +impl ClaimTokenIncentivesInstructionData { + pub fn new() -> Self { + Self { + discriminator: [16, 4, 71, 28, 204, 1, 40, 27], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for ClaimTokenIncentivesInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `ClaimTokenIncentives`. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[writable]` user_ata +/// 2. `[]` global_volume_accumulator +/// 3. `[writable]` global_incentive_token_account +/// 4. `[writable]` user_volume_accumulator +/// 5. `[]` mint +/// 6. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 7. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 8. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 9. `[]` event_authority +/// 10. `[optional]` program (default to `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA`) +/// 11. `[writable, signer]` payer +#[derive(Clone, Debug, Default)] +pub struct ClaimTokenIncentivesBuilder { + user: Option, + user_ata: Option, + global_volume_accumulator: Option, + global_incentive_token_account: Option, + user_volume_accumulator: Option, + mint: Option, + token_program: Option, + system_program: Option, + associated_token_program: Option, + event_authority: Option, + program: Option, + payer: Option, + __remaining_accounts: Vec, +} + +impl ClaimTokenIncentivesBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn user_ata(&mut self, user_ata: solana_pubkey::Pubkey) -> &mut Self { + self.user_ata = Some(user_ata); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_incentive_token_account = Some(global_incentive_token_account); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + /// `[optional account, default to 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA']` + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = ClaimTokenIncentives { + user: self.user.expect("user is not set"), + user_ata: self.user_ata.expect("user_ata is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + global_incentive_token_account: self + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + mint: self.mint.expect("mint is not set"), + token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + associated_token_program: self.associated_token_program.unwrap_or( + solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + )), + payer: self.payer.expect("payer is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `claim_token_incentives` CPI accounts. +pub struct ClaimTokenIncentivesCpiAccounts<'a, 'b> { + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_ata: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub payer: &'b solana_account_info::AccountInfo<'a>, +} + +/// `claim_token_incentives` CPI instruction. +pub struct ClaimTokenIncentivesCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_ata: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub payer: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> ClaimTokenIncentivesCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: ClaimTokenIncentivesCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + user: accounts.user, + user_ata: accounts.user_ata, + global_volume_accumulator: accounts.global_volume_accumulator, + global_incentive_token_account: accounts.global_incentive_token_account, + user_volume_accumulator: accounts.user_volume_accumulator, + mint: accounts.mint, + token_program: accounts.token_program, + system_program: accounts.system_program, + associated_token_program: accounts.associated_token_program, + event_authority: accounts.event_authority, + program: accounts.program, + payer: accounts.payer, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_ata.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_incentive_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(*self.payer.key, true)); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = ClaimTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(13 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.user_ata.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.global_incentive_token_account.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + account_infos.push(self.payer.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ClaimTokenIncentives` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[writable]` user_ata +/// 2. `[]` global_volume_accumulator +/// 3. `[writable]` global_incentive_token_account +/// 4. `[writable]` user_volume_accumulator +/// 5. `[]` mint +/// 6. `[]` token_program +/// 7. `[]` system_program +/// 8. `[]` associated_token_program +/// 9. `[]` event_authority +/// 10. `[]` program +/// 11. `[writable, signer]` payer +#[derive(Clone, Debug)] +pub struct ClaimTokenIncentivesCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ClaimTokenIncentivesCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ClaimTokenIncentivesCpiBuilderInstruction { + __program: program, + user: None, + user_ata: None, + global_volume_accumulator: None, + global_incentive_token_account: None, + user_volume_accumulator: None, + mint: None, + token_program: None, + system_program: None, + associated_token_program: None, + event_authority: None, + program: None, + payer: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn user_ata(&mut self, user_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user_ata = Some(user_ata); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_incentive_token_account = Some(global_incentive_token_account); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = ClaimTokenIncentivesCpi { + __program: self.instruction.__program, + + user: self.instruction.user.expect("user is not set"), + + user_ata: self.instruction.user_ata.expect("user_ata is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + global_incentive_token_account: self + .instruction + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct ClaimTokenIncentivesCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + user_ata: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + global_incentive_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + payer: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/close_user_volume_accumulator.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/close_user_volume_accumulator.rs new file mode 100644 index 00000000..50b3496a --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/close_user_volume_accumulator.rs @@ -0,0 +1,388 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const CLOSE_USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = + [249, 69, 164, 218, 150, 103, 84, 138]; + +/// Accounts. +#[derive(Debug)] +pub struct CloseUserVolumeAccumulator { + pub user: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl CloseUserVolumeAccumulator { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.user, true)); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = CloseUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CloseUserVolumeAccumulatorInstructionData { + discriminator: [u8; 8], +} + +impl CloseUserVolumeAccumulatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [249, 69, 164, 218, 150, 103, 84, 138], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for CloseUserVolumeAccumulatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `CloseUserVolumeAccumulator`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` user +/// 1. `[writable]` user_volume_accumulator +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct CloseUserVolumeAccumulatorBuilder { + user: Option, + user_volume_accumulator: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl CloseUserVolumeAccumulatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = CloseUserVolumeAccumulator { + user: self.user.expect("user is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `close_user_volume_accumulator` CPI accounts. +pub struct CloseUserVolumeAccumulatorCpiAccounts<'a, 'b> { + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `close_user_volume_accumulator` CPI instruction. +pub struct CloseUserVolumeAccumulatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> CloseUserVolumeAccumulatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: CloseUserVolumeAccumulatorCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + user: accounts.user, + user_volume_accumulator: accounts.user_volume_accumulator, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = CloseUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `CloseUserVolumeAccumulator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` user +/// 1. `[writable]` user_volume_accumulator +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct CloseUserVolumeAccumulatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> CloseUserVolumeAccumulatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CloseUserVolumeAccumulatorCpiBuilderInstruction { + __program: program, + user: None, + user_volume_accumulator: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = CloseUserVolumeAccumulatorCpi { + __program: self.instruction.__program, + + user: self.instruction.user.expect("user is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct CloseUserVolumeAccumulatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/collect_coin_creator_fee.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/collect_coin_creator_fee.rs index 7714395b..3f47591b 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/collect_coin_creator_fee.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/collect_coin_creator_fee.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const COLLECT_COIN_CREATOR_FEE_DISCRIMINATOR: [u8; 8] = [160, 57, 89, 42, 181, 139, 43, 66]; /// Accounts. #[derive(Debug)] @@ -31,7 +34,6 @@ impl CollectCoinCreatorFee { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -49,7 +51,7 @@ impl CollectCoinCreatorFee { )); accounts.push(solana_instruction::AccountMeta::new_readonly( self.coin_creator, - true, + false, )); accounts.push(solana_instruction::AccountMeta::new_readonly( self.coin_creator_vault_authority, @@ -72,7 +74,9 @@ impl CollectCoinCreatorFee { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&CollectCoinCreatorFeeInstructionData::new()).unwrap(); + let data = CollectCoinCreatorFeeInstructionData::new() + .try_to_vec() + .unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -94,10 +98,16 @@ impl CollectCoinCreatorFeeInstructionData { discriminator: [160, 57, 89, 42, 181, 139, 43, 66], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for CollectCoinCreatorFeeInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `CollectCoinCreatorFee`. @@ -106,7 +116,7 @@ impl Default for CollectCoinCreatorFeeInstructionData { /// /// 0. `[]` quote_mint /// 1. `[]` quote_token_program -/// 2. `[signer]` coin_creator +/// 2. `[]` coin_creator /// 3. `[]` coin_creator_vault_authority /// 4. `[writable]` coin_creator_vault_ata /// 5. `[writable]` coin_creator_token_account @@ -126,26 +136,24 @@ pub struct CollectCoinCreatorFeeBuilder { } impl CollectCoinCreatorFeeBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { self.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn quote_token_program(&mut self, quote_token_program: solana_pubkey::Pubkey) -> &mut Self { self.quote_token_program = Some(quote_token_program); self } - #[inline(always)] pub fn coin_creator(&mut self, coin_creator: solana_pubkey::Pubkey) -> &mut Self { self.coin_creator = Some(coin_creator); self } - #[inline(always)] pub fn coin_creator_vault_authority( &mut self, @@ -154,7 +162,6 @@ impl CollectCoinCreatorFeeBuilder { self.coin_creator_vault_authority = Some(coin_creator_vault_authority); self } - #[inline(always)] pub fn coin_creator_vault_ata( &mut self, @@ -163,7 +170,6 @@ impl CollectCoinCreatorFeeBuilder { self.coin_creator_vault_ata = Some(coin_creator_vault_ata); self } - #[inline(always)] pub fn coin_creator_token_account( &mut self, @@ -172,26 +178,22 @@ impl CollectCoinCreatorFeeBuilder { self.coin_creator_token_account = Some(coin_creator_token_account); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -201,7 +203,6 @@ impl CollectCoinCreatorFeeBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = CollectCoinCreatorFee { @@ -285,28 +286,21 @@ impl<'a, 'b> CollectCoinCreatorFeeCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -314,7 +308,7 @@ impl<'a, 'b> CollectCoinCreatorFeeCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(8 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.quote_mint.key, @@ -326,7 +320,7 @@ impl<'a, 'b> CollectCoinCreatorFeeCpi<'a, 'b> { )); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.coin_creator.key, - true, + false, )); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.coin_creator_vault_authority.key, @@ -355,7 +349,9 @@ impl<'a, 'b> CollectCoinCreatorFeeCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&CollectCoinCreatorFeeInstructionData::new()).unwrap(); + let data = CollectCoinCreatorFeeInstructionData::new() + .try_to_vec() + .unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -390,7 +386,7 @@ impl<'a, 'b> CollectCoinCreatorFeeCpi<'a, 'b> { /// /// 0. `[]` quote_mint /// 1. `[]` quote_token_program -/// 2. `[signer]` coin_creator +/// 2. `[]` coin_creator /// 3. `[]` coin_creator_vault_authority /// 4. `[writable]` coin_creator_vault_ata /// 5. `[writable]` coin_creator_token_account @@ -417,7 +413,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn quote_mint( &mut self, @@ -426,7 +421,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn quote_token_program( &mut self, @@ -435,7 +429,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.quote_token_program = Some(quote_token_program); self } - #[inline(always)] pub fn coin_creator( &mut self, @@ -444,7 +437,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.coin_creator = Some(coin_creator); self } - #[inline(always)] pub fn coin_creator_vault_authority( &mut self, @@ -453,7 +445,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.coin_creator_vault_authority = Some(coin_creator_vault_authority); self } - #[inline(always)] pub fn coin_creator_vault_ata( &mut self, @@ -462,7 +453,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.coin_creator_vault_ata = Some(coin_creator_vault_ata); self } - #[inline(always)] pub fn coin_creator_token_account( &mut self, @@ -471,7 +461,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.coin_creator_token_account = Some(coin_creator_token_account); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -480,13 +469,11 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -500,7 +487,6 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -515,16 +501,13 @@ impl<'a, 'b> CollectCoinCreatorFeeCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = CollectCoinCreatorFeeCpi { __program: self.instruction.__program, diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/create_config.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/create_config.rs index 74c1b883..509afb89 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/create_config.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/create_config.rs @@ -5,9 +5,12 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +pub const CREATE_CONFIG_DISCRIMINATOR: [u8; 8] = [201, 207, 243, 114, 75, 111, 47, 189]; + /// Accounts. #[derive(Debug)] pub struct CreateConfig { @@ -29,7 +32,6 @@ impl CreateConfig { ) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -56,8 +58,8 @@ impl CreateConfig { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&CreateConfigInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = CreateConfigInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -80,10 +82,16 @@ impl CreateConfigInstructionData { discriminator: [201, 207, 243, 114, 75, 111, 47, 189], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for CreateConfigInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -93,6 +101,13 @@ pub struct CreateConfigInstructionArgs { pub protocol_fee_basis_points: u64, pub protocol_fee_recipients: [Pubkey; 8], pub coin_creator_fee_basis_points: u64, + pub admin_set_coin_creator_authority: Pubkey, +} + +impl CreateConfigInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } /// Instruction builder for `CreateConfig`. @@ -115,62 +130,56 @@ pub struct CreateConfigBuilder { protocol_fee_basis_points: Option, protocol_fee_recipients: Option<[Pubkey; 8]>, coin_creator_fee_basis_points: Option, + admin_set_coin_creator_authority: Option, __remaining_accounts: Vec, } impl CreateConfigBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } /// `[optional account, default to '8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8']` #[inline(always)] pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { self.admin = Some(admin); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn lp_fee_basis_points(&mut self, lp_fee_basis_points: u64) -> &mut Self { self.lp_fee_basis_points = Some(lp_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_basis_points(&mut self, protocol_fee_basis_points: u64) -> &mut Self { self.protocol_fee_basis_points = Some(protocol_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_recipients(&mut self, protocol_fee_recipients: [Pubkey; 8]) -> &mut Self { self.protocol_fee_recipients = Some(protocol_fee_recipients); self } - #[inline(always)] pub fn coin_creator_fee_basis_points( &mut self, @@ -179,14 +188,20 @@ impl CreateConfigBuilder { self.coin_creator_fee_basis_points = Some(coin_creator_fee_basis_points); self } - + #[inline(always)] + pub fn admin_set_coin_creator_authority( + &mut self, + admin_set_coin_creator_authority: Pubkey, + ) -> &mut Self { + self.admin_set_coin_creator_authority = Some(admin_set_coin_creator_authority); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -196,7 +211,6 @@ impl CreateConfigBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = CreateConfig { @@ -227,6 +241,10 @@ impl CreateConfigBuilder { .coin_creator_fee_basis_points .clone() .expect("coin_creator_fee_basis_points is not set"), + admin_set_coin_creator_authority: self + .admin_set_coin_creator_authority + .clone() + .expect("admin_set_coin_creator_authority is not set"), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -280,28 +298,21 @@ impl<'a, 'b> CreateConfigCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -309,7 +320,7 @@ impl<'a, 'b> CreateConfigCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new(*self.admin.key, true)); accounts.push(solana_instruction::AccountMeta::new( @@ -335,8 +346,8 @@ impl<'a, 'b> CreateConfigCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&CreateConfigInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = CreateConfigInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -390,17 +401,16 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { protocol_fee_basis_points: None, protocol_fee_recipients: None, coin_creator_fee_basis_points: None, + admin_set_coin_creator_authority: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.admin = Some(admin); self } - #[inline(always)] pub fn global_config( &mut self, @@ -409,7 +419,6 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn system_program( &mut self, @@ -418,7 +427,6 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -427,31 +435,26 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn lp_fee_basis_points(&mut self, lp_fee_basis_points: u64) -> &mut Self { self.instruction.lp_fee_basis_points = Some(lp_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_basis_points(&mut self, protocol_fee_basis_points: u64) -> &mut Self { self.instruction.protocol_fee_basis_points = Some(protocol_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_recipients(&mut self, protocol_fee_recipients: [Pubkey; 8]) -> &mut Self { self.instruction.protocol_fee_recipients = Some(protocol_fee_recipients); self } - #[inline(always)] pub fn coin_creator_fee_basis_points( &mut self, @@ -460,7 +463,14 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { self.instruction.coin_creator_fee_basis_points = Some(coin_creator_fee_basis_points); self } - + #[inline(always)] + pub fn admin_set_coin_creator_authority( + &mut self, + admin_set_coin_creator_authority: Pubkey, + ) -> &mut Self { + self.instruction.admin_set_coin_creator_authority = Some(admin_set_coin_creator_authority); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -474,7 +484,6 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -489,16 +498,13 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = CreateConfigInstructionArgs { lp_fee_basis_points: self .instruction @@ -520,6 +526,11 @@ impl<'a, 'b> CreateConfigCpiBuilder<'a, 'b> { .coin_creator_fee_basis_points .clone() .expect("coin_creator_fee_basis_points is not set"), + admin_set_coin_creator_authority: self + .instruction + .admin_set_coin_creator_authority + .clone() + .expect("admin_set_coin_creator_authority is not set"), }; let instruction = CreateConfigCpi { __program: self.instruction.__program, @@ -563,6 +574,7 @@ struct CreateConfigCpiBuilderInstruction<'a, 'b> { protocol_fee_basis_points: Option, protocol_fee_recipients: Option<[Pubkey; 8]>, coin_creator_fee_basis_points: Option, + admin_set_coin_creator_authority: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/create_pool.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/create_pool.rs index 660e9bfb..e3f5ba60 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/create_pool.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/create_pool.rs @@ -5,9 +5,12 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +pub const CREATE_POOL_DISCRIMINATOR: [u8; 8] = [233, 146, 209, 142, 207, 104, 64, 188]; + /// Accounts. #[derive(Debug)] pub struct CreatePool { @@ -52,7 +55,6 @@ impl CreatePool { pub fn instruction(&self, args: CreatePoolInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -125,8 +127,8 @@ impl CreatePool { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&CreatePoolInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = CreatePoolInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -149,10 +151,16 @@ impl CreatePoolInstructionData { discriminator: [233, 146, 209, 142, 207, 104, 64, 188], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for CreatePoolInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -162,6 +170,13 @@ pub struct CreatePoolInstructionArgs { pub base_amount_in: u64, pub quote_amount_in: u64, pub coin_creator: Pubkey, + pub is_mayhem_mode: bool, +} + +impl CreatePoolInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } /// Instruction builder for `CreatePool`. @@ -210,48 +225,44 @@ pub struct CreatePoolBuilder { base_amount_in: Option, quote_amount_in: Option, coin_creator: Option, + is_mayhem_mode: Option, __remaining_accounts: Vec, } impl CreatePoolBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn creator(&mut self, creator: solana_pubkey::Pubkey) -> &mut Self { self.creator = Some(creator); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: solana_pubkey::Pubkey) -> &mut Self { self.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { self.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: solana_pubkey::Pubkey) -> &mut Self { self.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -260,7 +271,6 @@ impl CreatePoolBuilder { self.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -269,7 +279,6 @@ impl CreatePoolBuilder { self.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -278,7 +287,6 @@ impl CreatePoolBuilder { self.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -287,7 +295,6 @@ impl CreatePoolBuilder { self.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -296,33 +303,28 @@ impl CreatePoolBuilder { self.pool_quote_token_account = Some(pool_quote_token_account); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` #[inline(always)] pub fn token2022_program(&mut self, token2022_program: solana_pubkey::Pubkey) -> &mut Self { self.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn base_token_program(&mut self, base_token_program: solana_pubkey::Pubkey) -> &mut Self { self.base_token_program = Some(base_token_program); self } - #[inline(always)] pub fn quote_token_program(&mut self, quote_token_program: solana_pubkey::Pubkey) -> &mut Self { self.quote_token_program = Some(quote_token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` #[inline(always)] pub fn associated_token_program( @@ -332,50 +334,47 @@ impl CreatePoolBuilder { self.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn index(&mut self, index: u16) -> &mut Self { self.index = Some(index); self } - #[inline(always)] pub fn base_amount_in(&mut self, base_amount_in: u64) -> &mut Self { self.base_amount_in = Some(base_amount_in); self } - #[inline(always)] pub fn quote_amount_in(&mut self, quote_amount_in: u64) -> &mut Self { self.quote_amount_in = Some(quote_amount_in); self } - #[inline(always)] pub fn coin_creator(&mut self, coin_creator: Pubkey) -> &mut Self { self.coin_creator = Some(coin_creator); self } - + #[inline(always)] + pub fn is_mayhem_mode(&mut self, is_mayhem_mode: bool) -> &mut Self { + self.is_mayhem_mode = Some(is_mayhem_mode); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -385,7 +384,6 @@ impl CreatePoolBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = CreatePool { @@ -439,6 +437,10 @@ impl CreatePoolBuilder { .clone() .expect("quote_amount_in is not set"), coin_creator: self.coin_creator.clone().expect("coin_creator is not set"), + is_mayhem_mode: self + .is_mayhem_mode + .clone() + .expect("is_mayhem_mode is not set"), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -557,28 +559,21 @@ impl<'a, 'b> CreatePoolCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -586,7 +581,7 @@ impl<'a, 'b> CreatePoolCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(18 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); accounts.push(solana_instruction::AccountMeta::new_readonly( @@ -664,8 +659,8 @@ impl<'a, 'b> CreatePoolCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&CreatePoolInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = CreatePoolInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -758,17 +753,16 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { base_amount_in: None, quote_amount_in: None, coin_creator: None, + is_mayhem_mode: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn global_config( &mut self, @@ -777,19 +771,16 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn creator(&mut self, creator: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.creator = Some(creator); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint( &mut self, @@ -798,13 +789,11 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -813,7 +802,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -822,7 +810,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -831,7 +818,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -840,7 +826,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -849,7 +834,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn system_program( &mut self, @@ -858,7 +842,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn token2022_program( &mut self, @@ -867,7 +850,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn base_token_program( &mut self, @@ -876,7 +858,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.base_token_program = Some(base_token_program); self } - #[inline(always)] pub fn quote_token_program( &mut self, @@ -885,7 +866,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.quote_token_program = Some(quote_token_program); self } - #[inline(always)] pub fn associated_token_program( &mut self, @@ -894,7 +874,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -903,37 +882,36 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn index(&mut self, index: u16) -> &mut Self { self.instruction.index = Some(index); self } - #[inline(always)] pub fn base_amount_in(&mut self, base_amount_in: u64) -> &mut Self { self.instruction.base_amount_in = Some(base_amount_in); self } - #[inline(always)] pub fn quote_amount_in(&mut self, quote_amount_in: u64) -> &mut Self { self.instruction.quote_amount_in = Some(quote_amount_in); self } - #[inline(always)] pub fn coin_creator(&mut self, coin_creator: Pubkey) -> &mut Self { self.instruction.coin_creator = Some(coin_creator); self } - + #[inline(always)] + pub fn is_mayhem_mode(&mut self, is_mayhem_mode: bool) -> &mut Self { + self.instruction.is_mayhem_mode = Some(is_mayhem_mode); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -947,7 +925,6 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -962,16 +939,13 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = CreatePoolInstructionArgs { index: self.instruction.index.clone().expect("index is not set"), base_amount_in: self @@ -989,6 +963,11 @@ impl<'a, 'b> CreatePoolCpiBuilder<'a, 'b> { .coin_creator .clone() .expect("coin_creator is not set"), + is_mayhem_mode: self + .instruction + .is_mayhem_mode + .clone() + .expect("is_mayhem_mode is not set"), }; let instruction = CreatePoolCpi { __program: self.instruction.__program, @@ -1098,6 +1077,7 @@ struct CreatePoolCpiBuilderInstruction<'a, 'b> { base_amount_in: Option, quote_amount_in: Option, coin_creator: Option, + is_mayhem_mode: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/deposit.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/deposit.rs index 38b7d737..5df283e7 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/deposit.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/deposit.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const DEPOSIT_DISCRIMINATOR: [u8; 8] = [242, 35, 198, 137, 82, 225, 242, 182]; /// Accounts. #[derive(Debug)] @@ -45,7 +48,6 @@ impl Deposit { pub fn instruction(&self, args: DepositInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -108,8 +110,8 @@ impl Deposit { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&DepositInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = DepositInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -132,10 +134,16 @@ impl DepositInstructionData { discriminator: [242, 35, 198, 137, 82, 225, 242, 182], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for DepositInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -146,6 +154,12 @@ pub struct DepositInstructionArgs { pub max_quote_amount_in: u64, } +impl DepositInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Deposit`. /// /// ### Accounts: @@ -189,44 +203,39 @@ pub struct DepositBuilder { } impl DepositBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: solana_pubkey::Pubkey) -> &mut Self { self.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { self.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: solana_pubkey::Pubkey) -> &mut Self { self.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -235,7 +244,6 @@ impl DepositBuilder { self.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -244,7 +252,6 @@ impl DepositBuilder { self.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -253,7 +260,6 @@ impl DepositBuilder { self.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -262,7 +268,6 @@ impl DepositBuilder { self.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -271,58 +276,49 @@ impl DepositBuilder { self.pool_quote_token_account = Some(pool_quote_token_account); self } - /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` #[inline(always)] pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { self.token_program = Some(token_program); self } - /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` #[inline(always)] pub fn token2022_program(&mut self, token2022_program: solana_pubkey::Pubkey) -> &mut Self { self.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn lp_token_amount_out(&mut self, lp_token_amount_out: u64) -> &mut Self { self.lp_token_amount_out = Some(lp_token_amount_out); self } - #[inline(always)] pub fn max_base_amount_in(&mut self, max_base_amount_in: u64) -> &mut Self { self.max_base_amount_in = Some(max_base_amount_in); self } - #[inline(always)] pub fn max_quote_amount_in(&mut self, max_quote_amount_in: u64) -> &mut Self { self.max_quote_amount_in = Some(max_quote_amount_in); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -332,7 +328,6 @@ impl DepositBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Deposit { @@ -482,28 +477,21 @@ impl<'a, 'b> DepositCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -511,7 +499,7 @@ impl<'a, 'b> DepositCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(15 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); accounts.push(solana_instruction::AccountMeta::new_readonly( @@ -577,8 +565,8 @@ impl<'a, 'b> DepositCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&DepositInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = DepositInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -665,13 +653,11 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn global_config( &mut self, @@ -680,19 +666,16 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint( &mut self, @@ -701,13 +684,11 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -716,7 +697,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -725,7 +705,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -734,7 +713,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -743,7 +721,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -752,7 +729,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn token_program( &mut self, @@ -761,7 +737,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.token_program = Some(token_program); self } - #[inline(always)] pub fn token2022_program( &mut self, @@ -770,7 +745,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -779,31 +753,26 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn lp_token_amount_out(&mut self, lp_token_amount_out: u64) -> &mut Self { self.instruction.lp_token_amount_out = Some(lp_token_amount_out); self } - #[inline(always)] pub fn max_base_amount_in(&mut self, max_base_amount_in: u64) -> &mut Self { self.instruction.max_base_amount_in = Some(max_base_amount_in); self } - #[inline(always)] pub fn max_quote_amount_in(&mut self, max_quote_amount_in: u64) -> &mut Self { self.instruction.max_quote_amount_in = Some(max_quote_amount_in); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -817,7 +786,6 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -832,16 +800,13 @@ impl<'a, 'b> DepositCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = DepositInstructionArgs { lp_token_amount_out: self .instruction diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/disable.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/disable.rs index 0987f736..269e314a 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/disable.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/disable.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const DISABLE_DISCRIMINATOR: [u8; 8] = [185, 173, 187, 90, 216, 15, 238, 233]; /// Accounts. #[derive(Debug)] @@ -23,7 +26,6 @@ impl Disable { pub fn instruction(&self, args: DisableInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -48,8 +50,8 @@ impl Disable { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&DisableInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = DisableInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -72,10 +74,16 @@ impl DisableInstructionData { discriminator: [185, 173, 187, 90, 216, 15, 238, 233], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for DisableInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -88,6 +96,12 @@ pub struct DisableInstructionArgs { pub disable_sell: bool, } +impl DisableInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Disable`. /// /// ### Accounts: @@ -111,69 +125,60 @@ pub struct DisableBuilder { } impl DisableBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { self.admin = Some(admin); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn disable_create_pool(&mut self, disable_create_pool: bool) -> &mut Self { self.disable_create_pool = Some(disable_create_pool); self } - #[inline(always)] pub fn disable_deposit(&mut self, disable_deposit: bool) -> &mut Self { self.disable_deposit = Some(disable_deposit); self } - #[inline(always)] pub fn disable_withdraw(&mut self, disable_withdraw: bool) -> &mut Self { self.disable_withdraw = Some(disable_withdraw); self } - #[inline(always)] pub fn disable_buy(&mut self, disable_buy: bool) -> &mut Self { self.disable_buy = Some(disable_buy); self } - #[inline(always)] pub fn disable_sell(&mut self, disable_sell: bool) -> &mut Self { self.disable_sell = Some(disable_sell); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -183,7 +188,6 @@ impl DisableBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Disable { @@ -255,28 +259,21 @@ impl<'a, 'b> DisableCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -284,7 +281,7 @@ impl<'a, 'b> DisableCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.admin.key, @@ -309,8 +306,8 @@ impl<'a, 'b> DisableCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&DisableInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = DisableInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -366,13 +363,11 @@ impl<'a, 'b> DisableCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.admin = Some(admin); self } - #[inline(always)] pub fn global_config( &mut self, @@ -381,7 +376,6 @@ impl<'a, 'b> DisableCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -390,43 +384,36 @@ impl<'a, 'b> DisableCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn disable_create_pool(&mut self, disable_create_pool: bool) -> &mut Self { self.instruction.disable_create_pool = Some(disable_create_pool); self } - #[inline(always)] pub fn disable_deposit(&mut self, disable_deposit: bool) -> &mut Self { self.instruction.disable_deposit = Some(disable_deposit); self } - #[inline(always)] pub fn disable_withdraw(&mut self, disable_withdraw: bool) -> &mut Self { self.instruction.disable_withdraw = Some(disable_withdraw); self } - #[inline(always)] pub fn disable_buy(&mut self, disable_buy: bool) -> &mut Self { self.instruction.disable_buy = Some(disable_buy); self } - #[inline(always)] pub fn disable_sell(&mut self, disable_sell: bool) -> &mut Self { self.instruction.disable_sell = Some(disable_sell); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -440,7 +427,6 @@ impl<'a, 'b> DisableCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -455,16 +441,13 @@ impl<'a, 'b> DisableCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = DisableInstructionArgs { disable_create_pool: self .instruction diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/extend_account.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/extend_account.rs index b03b3084..bc1a24d6 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/extend_account.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/extend_account.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const EXTEND_ACCOUNT_DISCRIMINATOR: [u8; 8] = [234, 102, 194, 203, 150, 72, 62, 229]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl ExtendAccount { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -50,7 +52,7 @@ impl ExtendAccount { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&ExtendAccountInstructionData::new()).unwrap(); + let data = ExtendAccountInstructionData::new().try_to_vec().unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -72,10 +74,16 @@ impl ExtendAccountInstructionData { discriminator: [234, 102, 194, 203, 150, 72, 62, 229], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for ExtendAccountInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `ExtendAccount`. @@ -98,46 +106,41 @@ pub struct ExtendAccountBuilder { } impl ExtendAccountBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn account(&mut self, account: solana_pubkey::Pubkey) -> &mut Self { self.account = Some(account); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -147,7 +150,6 @@ impl ExtendAccountBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = ExtendAccount { @@ -207,28 +209,21 @@ impl<'a, 'b> ExtendAccountCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -236,7 +231,7 @@ impl<'a, 'b> ExtendAccountCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new( *self.account.key, @@ -265,7 +260,7 @@ impl<'a, 'b> ExtendAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&ExtendAccountInstructionData::new()).unwrap(); + let data = ExtendAccountInstructionData::new().try_to_vec().unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -318,19 +313,16 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn account(&mut self, account: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.account = Some(account); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -339,7 +331,6 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -348,13 +339,11 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -368,7 +357,6 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -383,16 +371,13 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = ExtendAccountCpi { __program: self.instruction.__program, diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/init_user_volume_accumulator.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/init_user_volume_accumulator.rs new file mode 100644 index 00000000..a76b02d4 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/init_user_volume_accumulator.rs @@ -0,0 +1,464 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const INIT_USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = + [94, 6, 202, 115, 255, 96, 232, 183]; + +/// Accounts. +#[derive(Debug)] +pub struct InitUserVolumeAccumulator { + pub payer: solana_pubkey::Pubkey, + + pub user: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl InitUserVolumeAccumulator { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.payer, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = InitUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitUserVolumeAccumulatorInstructionData { + discriminator: [u8; 8], +} + +impl InitUserVolumeAccumulatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [94, 6, 202, 115, 255, 96, 232, 183], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for InitUserVolumeAccumulatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `InitUserVolumeAccumulator`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` payer +/// 1. `[]` user +/// 2. `[writable]` user_volume_accumulator +/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug, Default)] +pub struct InitUserVolumeAccumulatorBuilder { + payer: Option, + user: Option, + user_volume_accumulator: Option, + system_program: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl InitUserVolumeAccumulatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = InitUserVolumeAccumulator { + payer: self.payer.expect("payer is not set"), + user: self.user.expect("user is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `init_user_volume_accumulator` CPI accounts. +pub struct InitUserVolumeAccumulatorCpiAccounts<'a, 'b> { + pub payer: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `init_user_volume_accumulator` CPI instruction. +pub struct InitUserVolumeAccumulatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub payer: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> InitUserVolumeAccumulatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: InitUserVolumeAccumulatorCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + payer: accounts.payer, + user: accounts.user, + user_volume_accumulator: accounts.user_volume_accumulator, + system_program: accounts.system_program, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.payer.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = InitUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `InitUserVolumeAccumulator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` payer +/// 1. `[]` user +/// 2. `[writable]` user_volume_accumulator +/// 3. `[]` system_program +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug)] +pub struct InitUserVolumeAccumulatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> InitUserVolumeAccumulatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(InitUserVolumeAccumulatorCpiBuilderInstruction { + __program: program, + payer: None, + user: None, + user_volume_accumulator: None, + system_program: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = InitUserVolumeAccumulatorCpi { + __program: self.instruction.__program, + + payer: self.instruction.payer.expect("payer is not set"), + + user: self.instruction.user.expect("user is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct InitUserVolumeAccumulatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + payer: Option<&'b solana_account_info::AccountInfo<'a>>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/mod.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/mod.rs index 10375ea6..1a1974b3 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/mod.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/mod.rs @@ -5,21 +5,46 @@ //! //! +pub(crate) mod r#admin_set_coin_creator; +pub(crate) mod r#admin_update_token_incentives; pub(crate) mod r#buy; +pub(crate) mod r#buy_exact_quote_in; +pub(crate) mod r#claim_token_incentives; +pub(crate) mod r#close_user_volume_accumulator; pub(crate) mod r#collect_coin_creator_fee; pub(crate) mod r#create_config; pub(crate) mod r#create_pool; pub(crate) mod r#deposit; pub(crate) mod r#disable; pub(crate) mod r#extend_account; +pub(crate) mod r#init_user_volume_accumulator; pub(crate) mod r#sell; pub(crate) mod r#set_coin_creator; +pub(crate) mod r#set_reserved_fee_recipients; +pub(crate) mod r#sync_user_volume_accumulator; +pub(crate) mod r#toggle_mayhem_mode; pub(crate) mod r#update_admin; pub(crate) mod r#update_fee_config; pub(crate) mod r#withdraw; -pub use self::{ - r#buy::*, r#collect_coin_creator_fee::*, r#create_config::*, r#create_pool::*, r#deposit::*, - r#disable::*, r#extend_account::*, r#sell::*, r#set_coin_creator::*, r#update_admin::*, - r#update_fee_config::*, r#withdraw::*, -}; +pub use self::r#admin_set_coin_creator::*; +pub use self::r#admin_update_token_incentives::*; +pub use self::r#buy::*; +pub use self::r#buy_exact_quote_in::*; +pub use self::r#claim_token_incentives::*; +pub use self::r#close_user_volume_accumulator::*; +pub use self::r#collect_coin_creator_fee::*; +pub use self::r#create_config::*; +pub use self::r#create_pool::*; +pub use self::r#deposit::*; +pub use self::r#disable::*; +pub use self::r#extend_account::*; +pub use self::r#init_user_volume_accumulator::*; +pub use self::r#sell::*; +pub use self::r#set_coin_creator::*; +pub use self::r#set_reserved_fee_recipients::*; +pub use self::r#sync_user_volume_accumulator::*; +pub use self::r#toggle_mayhem_mode::*; +pub use self::r#update_admin::*; +pub use self::r#update_fee_config::*; +pub use self::r#withdraw::*; diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/sell.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/sell.rs index 1c95cf72..4d901449 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/sell.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/sell.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const SELL_DISCRIMINATOR: [u8; 8] = [51, 230, 133, 164, 1, 127, 131, 173]; /// Accounts. #[derive(Debug)] @@ -47,13 +50,16 @@ pub struct Sell { pub coin_creator_vault_ata: solana_pubkey::Pubkey, pub coin_creator_vault_authority: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub fee_program: solana_pubkey::Pubkey, } impl Sell { pub fn instruction(&self, args: SellInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -61,10 +67,8 @@ impl Sell { args: SellInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta], ) -> solana_instruction::Instruction { - let mut accounts = Vec::with_capacity(19 + remaining_accounts.len()); - accounts.push(solana_instruction::AccountMeta::new_readonly( - self.pool, false, - )); + let mut accounts = Vec::with_capacity(21 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.pool, false)); accounts.push(solana_instruction::AccountMeta::new(self.user, true)); accounts.push(solana_instruction::AccountMeta::new_readonly( self.global_config, @@ -134,9 +138,17 @@ impl Sell { self.coin_creator_vault_authority, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_program, + false, + )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&SellInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = SellInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -159,10 +171,16 @@ impl SellInstructionData { discriminator: [51, 230, 133, 164, 1, 127, 131, 173], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for SellInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -172,11 +190,17 @@ pub struct SellInstructionArgs { pub min_quote_amount_out: u64, } +impl SellInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Sell`. /// /// ### Accounts: /// -/// 0. `[]` pool +/// 0. `[writable]` pool /// 1. `[writable, signer]` user /// 2. `[]` global_config /// 3. `[]` base_mint @@ -192,9 +216,11 @@ pub struct SellInstructionArgs { /// 13. `[optional]` system_program (default to `11111111111111111111111111111111`) /// 14. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) /// 15. `[]` event_authority -/// 16. `[]` program +/// 16. `[optional]` program (default to `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA`) /// 17. `[writable]` coin_creator_vault_ata /// 18. `[]` coin_creator_vault_authority +/// 19. `[]` fee_config +/// 20. `[optional]` fee_program (default to `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`) #[derive(Clone, Debug, Default)] pub struct SellBuilder { pool: Option, @@ -216,44 +242,42 @@ pub struct SellBuilder { program: Option, coin_creator_vault_ata: Option, coin_creator_vault_authority: Option, + fee_config: Option, + fee_program: Option, base_amount_in: Option, min_quote_amount_out: Option, __remaining_accounts: Vec, } impl SellBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: solana_pubkey::Pubkey) -> &mut Self { self.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { self.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -262,7 +286,6 @@ impl SellBuilder { self.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -271,7 +294,6 @@ impl SellBuilder { self.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -280,7 +302,6 @@ impl SellBuilder { self.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -289,7 +310,6 @@ impl SellBuilder { self.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn protocol_fee_recipient( &mut self, @@ -298,7 +318,6 @@ impl SellBuilder { self.protocol_fee_recipient = Some(protocol_fee_recipient); self } - #[inline(always)] pub fn protocol_fee_recipient_token_account( &mut self, @@ -307,26 +326,22 @@ impl SellBuilder { self.protocol_fee_recipient_token_account = Some(protocol_fee_recipient_token_account); self } - #[inline(always)] pub fn base_token_program(&mut self, base_token_program: solana_pubkey::Pubkey) -> &mut Self { self.base_token_program = Some(base_token_program); self } - #[inline(always)] pub fn quote_token_program(&mut self, quote_token_program: solana_pubkey::Pubkey) -> &mut Self { self.quote_token_program = Some(quote_token_program); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` #[inline(always)] pub fn associated_token_program( @@ -336,19 +351,17 @@ impl SellBuilder { self.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - + /// `[optional account, default to 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA']` #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn coin_creator_vault_ata( &mut self, @@ -357,7 +370,6 @@ impl SellBuilder { self.coin_creator_vault_ata = Some(coin_creator_vault_ata); self } - #[inline(always)] pub fn coin_creator_vault_authority( &mut self, @@ -366,26 +378,33 @@ impl SellBuilder { self.coin_creator_vault_authority = Some(coin_creator_vault_authority); self } - + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to 'pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ']` + #[inline(always)] + pub fn fee_program(&mut self, fee_program: solana_pubkey::Pubkey) -> &mut Self { + self.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn base_amount_in(&mut self, base_amount_in: u64) -> &mut Self { self.base_amount_in = Some(base_amount_in); self } - #[inline(always)] pub fn min_quote_amount_out(&mut self, min_quote_amount_out: u64) -> &mut Self { self.min_quote_amount_out = Some(min_quote_amount_out); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -395,7 +414,6 @@ impl SellBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Sell { @@ -435,13 +453,19 @@ impl SellBuilder { solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), ), event_authority: self.event_authority.expect("event_authority is not set"), - program: self.program.expect("program is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + )), coin_creator_vault_ata: self .coin_creator_vault_ata .expect("coin_creator_vault_ata is not set"), coin_creator_vault_authority: self .coin_creator_vault_authority .expect("coin_creator_vault_authority is not set"), + fee_config: self.fee_config.expect("fee_config is not set"), + fee_program: self.fee_program.unwrap_or(solana_pubkey::pubkey!( + "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + )), }; let args = SellInstructionArgs { base_amount_in: self @@ -497,6 +521,10 @@ pub struct SellCpiAccounts<'a, 'b> { pub coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, pub coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, } /// `sell` CPI instruction. @@ -541,6 +569,10 @@ pub struct SellCpi<'a, 'b> { pub coin_creator_vault_ata: &'b solana_account_info::AccountInfo<'a>, pub coin_creator_vault_authority: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, /// The arguments for the instruction. pub __args: SellInstructionArgs, } @@ -572,31 +604,26 @@ impl<'a, 'b> SellCpi<'a, 'b> { program: accounts.program, coin_creator_vault_ata: accounts.coin_creator_vault_ata, coin_creator_vault_authority: accounts.coin_creator_vault_authority, + fee_config: accounts.fee_config, + fee_program: accounts.fee_program, __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -604,12 +631,9 @@ impl<'a, 'b> SellCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(19 + remaining_accounts.len()); - accounts.push(solana_instruction::AccountMeta::new_readonly( - *self.pool.key, - false, - )); + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(21 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.global_config.key, @@ -679,6 +703,14 @@ impl<'a, 'b> SellCpi<'a, 'b> { *self.coin_creator_vault_authority.key, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_program.key, + false, + )); remaining_accounts.iter().for_each(|remaining_account| { accounts.push(solana_instruction::AccountMeta { pubkey: *remaining_account.0.key, @@ -686,8 +718,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&SellInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = SellInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -695,7 +727,7 @@ impl<'a, 'b> SellCpi<'a, 'b> { accounts, data, }; - let mut account_infos = Vec::with_capacity(20 + remaining_accounts.len()); + let mut account_infos = Vec::with_capacity(22 + remaining_accounts.len()); account_infos.push(self.__program.clone()); account_infos.push(self.pool.clone()); account_infos.push(self.user.clone()); @@ -716,6 +748,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { account_infos.push(self.program.clone()); account_infos.push(self.coin_creator_vault_ata.clone()); account_infos.push(self.coin_creator_vault_authority.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.fee_program.clone()); remaining_accounts .iter() .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); @@ -732,7 +766,7 @@ impl<'a, 'b> SellCpi<'a, 'b> { /// /// ### Accounts: /// -/// 0. `[]` pool +/// 0. `[writable]` pool /// 1. `[writable, signer]` user /// 2. `[]` global_config /// 3. `[]` base_mint @@ -751,6 +785,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { /// 16. `[]` program /// 17. `[writable]` coin_creator_vault_ata /// 18. `[]` coin_creator_vault_authority +/// 19. `[]` fee_config +/// 20. `[]` fee_program #[derive(Clone, Debug)] pub struct SellCpiBuilder<'a, 'b> { instruction: Box>, @@ -779,25 +815,24 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { program: None, coin_creator_vault_ata: None, coin_creator_vault_authority: None, + fee_config: None, + fee_program: None, base_amount_in: None, min_quote_amount_out: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn global_config( &mut self, @@ -806,13 +841,11 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint( &mut self, @@ -821,7 +854,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -830,7 +862,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -839,7 +870,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -848,7 +878,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -857,7 +886,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn protocol_fee_recipient( &mut self, @@ -866,7 +894,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.protocol_fee_recipient = Some(protocol_fee_recipient); self } - #[inline(always)] pub fn protocol_fee_recipient_token_account( &mut self, @@ -876,7 +903,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { Some(protocol_fee_recipient_token_account); self } - #[inline(always)] pub fn base_token_program( &mut self, @@ -885,7 +911,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.base_token_program = Some(base_token_program); self } - #[inline(always)] pub fn quote_token_program( &mut self, @@ -894,7 +919,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.quote_token_program = Some(quote_token_program); self } - #[inline(always)] pub fn system_program( &mut self, @@ -903,7 +927,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn associated_token_program( &mut self, @@ -912,7 +935,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -921,13 +943,11 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn coin_creator_vault_ata( &mut self, @@ -936,7 +956,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.coin_creator_vault_ata = Some(coin_creator_vault_ata); self } - #[inline(always)] pub fn coin_creator_vault_authority( &mut self, @@ -945,19 +964,32 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.coin_creator_vault_authority = Some(coin_creator_vault_authority); self } - + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn fee_program( + &mut self, + fee_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn base_amount_in(&mut self, base_amount_in: u64) -> &mut Self { self.instruction.base_amount_in = Some(base_amount_in); self } - #[inline(always)] pub fn min_quote_amount_out(&mut self, min_quote_amount_out: u64) -> &mut Self { self.instruction.min_quote_amount_out = Some(min_quote_amount_out); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -971,7 +1003,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -986,16 +1017,13 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = SellInstructionArgs { base_amount_in: self .instruction @@ -1090,6 +1118,13 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { .instruction .coin_creator_vault_authority .expect("coin_creator_vault_authority is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + fee_program: self + .instruction + .fee_program + .expect("fee_program is not set"), __args: args, }; instruction.invoke_signed_with_remaining_accounts( @@ -1121,6 +1156,8 @@ struct SellCpiBuilderInstruction<'a, 'b> { program: Option<&'b solana_account_info::AccountInfo<'a>>, coin_creator_vault_ata: Option<&'b solana_account_info::AccountInfo<'a>>, coin_creator_vault_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_program: Option<&'b solana_account_info::AccountInfo<'a>>, base_amount_in: Option, min_quote_amount_out: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/set_coin_creator.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/set_coin_creator.rs index a184e609..975456d3 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/set_coin_creator.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/set_coin_creator.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const SET_COIN_CREATOR_DISCRIMINATOR: [u8; 8] = [210, 149, 128, 45, 188, 58, 78, 175]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl SetCoinCreator { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -51,7 +53,7 @@ impl SetCoinCreator { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&SetCoinCreatorInstructionData::new()).unwrap(); + let data = SetCoinCreatorInstructionData::new().try_to_vec().unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -73,10 +75,16 @@ impl SetCoinCreatorInstructionData { discriminator: [210, 149, 128, 45, 188, 58, 78, 175], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for SetCoinCreatorInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `SetCoinCreator`. @@ -99,45 +107,40 @@ pub struct SetCoinCreatorBuilder { } impl SetCoinCreatorBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn metadata(&mut self, metadata: solana_pubkey::Pubkey) -> &mut Self { self.metadata = Some(metadata); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -147,7 +150,6 @@ impl SetCoinCreatorBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = SetCoinCreator { @@ -205,28 +207,21 @@ impl<'a, 'b> SetCoinCreatorCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -234,7 +229,7 @@ impl<'a, 'b> SetCoinCreatorCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); accounts.push(solana_instruction::AccountMeta::new_readonly( @@ -260,7 +255,7 @@ impl<'a, 'b> SetCoinCreatorCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&SetCoinCreatorInstructionData::new()).unwrap(); + let data = SetCoinCreatorInstructionData::new().try_to_vec().unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -313,19 +308,16 @@ impl<'a, 'b> SetCoinCreatorCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn metadata(&mut self, metadata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.metadata = Some(metadata); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -334,7 +326,6 @@ impl<'a, 'b> SetCoinCreatorCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -343,13 +334,11 @@ impl<'a, 'b> SetCoinCreatorCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -363,7 +352,6 @@ impl<'a, 'b> SetCoinCreatorCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -378,16 +366,13 @@ impl<'a, 'b> SetCoinCreatorCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = SetCoinCreatorCpi { __program: self.instruction.__program, diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/set_reserved_fee_recipients.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/set_reserved_fee_recipients.rs new file mode 100644 index 00000000..7d627385 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/set_reserved_fee_recipients.rs @@ -0,0 +1,440 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +pub const SET_RESERVED_FEE_RECIPIENTS_DISCRIMINATOR: [u8; 8] = + [111, 172, 162, 232, 114, 89, 213, 142]; + +/// Accounts. +#[derive(Debug)] +pub struct SetReservedFeeRecipients { + pub global_config: solana_pubkey::Pubkey, + + pub admin: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl SetReservedFeeRecipients { + pub fn instruction( + &self, + args: SetReservedFeeRecipientsInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: SetReservedFeeRecipientsInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + self.global_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin, true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = SetReservedFeeRecipientsInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SetReservedFeeRecipientsInstructionData { + discriminator: [u8; 8], +} + +impl SetReservedFeeRecipientsInstructionData { + pub fn new() -> Self { + Self { + discriminator: [111, 172, 162, 232, 114, 89, 213, 142], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for SetReservedFeeRecipientsInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SetReservedFeeRecipientsInstructionArgs { + pub whitelist_pda: Pubkey, +} + +impl SetReservedFeeRecipientsInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `SetReservedFeeRecipients`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global_config +/// 1. `[signer]` admin +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct SetReservedFeeRecipientsBuilder { + global_config: Option, + admin: Option, + event_authority: Option, + program: Option, + whitelist_pda: Option, + __remaining_accounts: Vec, +} + +impl SetReservedFeeRecipientsBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { + self.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn whitelist_pda(&mut self, whitelist_pda: Pubkey) -> &mut Self { + self.whitelist_pda = Some(whitelist_pda); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = SetReservedFeeRecipients { + global_config: self.global_config.expect("global_config is not set"), + admin: self.admin.expect("admin is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = SetReservedFeeRecipientsInstructionArgs { + whitelist_pda: self + .whitelist_pda + .clone() + .expect("whitelist_pda is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `set_reserved_fee_recipients` CPI accounts. +pub struct SetReservedFeeRecipientsCpiAccounts<'a, 'b> { + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `set_reserved_fee_recipients` CPI instruction. +pub struct SetReservedFeeRecipientsCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: SetReservedFeeRecipientsInstructionArgs, +} + +impl<'a, 'b> SetReservedFeeRecipientsCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: SetReservedFeeRecipientsCpiAccounts<'a, 'b>, + args: SetReservedFeeRecipientsInstructionArgs, + ) -> Self { + Self { + __program: program, + global_config: accounts.global_config, + admin: accounts.admin, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = SetReservedFeeRecipientsInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.global_config.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `SetReservedFeeRecipients` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global_config +/// 1. `[signer]` admin +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct SetReservedFeeRecipientsCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> SetReservedFeeRecipientsCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SetReservedFeeRecipientsCpiBuilderInstruction { + __program: program, + global_config: None, + admin: None, + event_authority: None, + program: None, + whitelist_pda: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn global_config( + &mut self, + global_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn whitelist_pda(&mut self, whitelist_pda: Pubkey) -> &mut Self { + self.instruction.whitelist_pda = Some(whitelist_pda); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = SetReservedFeeRecipientsInstructionArgs { + whitelist_pda: self + .instruction + .whitelist_pda + .clone() + .expect("whitelist_pda is not set"), + }; + let instruction = SetReservedFeeRecipientsCpi { + __program: self.instruction.__program, + + global_config: self + .instruction + .global_config + .expect("global_config is not set"), + + admin: self.instruction.admin.expect("admin is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct SetReservedFeeRecipientsCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + global_config: Option<&'b solana_account_info::AccountInfo<'a>>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + whitelist_pda: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/sync_user_volume_accumulator.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/sync_user_volume_accumulator.rs new file mode 100644 index 00000000..0c10b39e --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/sync_user_volume_accumulator.rs @@ -0,0 +1,437 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const SYNC_USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = [86, 31, 192, 87, 163, 87, 79, 238]; + +/// Accounts. +#[derive(Debug)] +pub struct SyncUserVolumeAccumulator { + pub user: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl SyncUserVolumeAccumulator { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = SyncUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SyncUserVolumeAccumulatorInstructionData { + discriminator: [u8; 8], +} + +impl SyncUserVolumeAccumulatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [86, 31, 192, 87, 163, 87, 79, 238], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for SyncUserVolumeAccumulatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `SyncUserVolumeAccumulator`. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[]` global_volume_accumulator +/// 2. `[writable]` user_volume_accumulator +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug, Default)] +pub struct SyncUserVolumeAccumulatorBuilder { + user: Option, + global_volume_accumulator: Option, + user_volume_accumulator: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl SyncUserVolumeAccumulatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = SyncUserVolumeAccumulator { + user: self.user.expect("user is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `sync_user_volume_accumulator` CPI accounts. +pub struct SyncUserVolumeAccumulatorCpiAccounts<'a, 'b> { + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `sync_user_volume_accumulator` CPI instruction. +pub struct SyncUserVolumeAccumulatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> SyncUserVolumeAccumulatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: SyncUserVolumeAccumulatorCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + user: accounts.user, + global_volume_accumulator: accounts.global_volume_accumulator, + user_volume_accumulator: accounts.user_volume_accumulator, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = SyncUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `SyncUserVolumeAccumulator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[]` global_volume_accumulator +/// 2. `[writable]` user_volume_accumulator +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug)] +pub struct SyncUserVolumeAccumulatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> SyncUserVolumeAccumulatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SyncUserVolumeAccumulatorCpiBuilderInstruction { + __program: program, + user: None, + global_volume_accumulator: None, + user_volume_accumulator: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = SyncUserVolumeAccumulatorCpi { + __program: self.instruction.__program, + + user: self.instruction.user.expect("user is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct SyncUserVolumeAccumulatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/toggle_mayhem_mode.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/toggle_mayhem_mode.rs new file mode 100644 index 00000000..b958930a --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/toggle_mayhem_mode.rs @@ -0,0 +1,431 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const TOGGLE_MAYHEM_MODE_DISCRIMINATOR: [u8; 8] = [1, 9, 111, 208, 100, 31, 255, 163]; + +/// Accounts. +#[derive(Debug)] +pub struct ToggleMayhemMode { + pub admin: solana_pubkey::Pubkey, + + pub global_config: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl ToggleMayhemMode { + pub fn instruction( + &self, + args: ToggleMayhemModeInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: ToggleMayhemModeInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin, true, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = ToggleMayhemModeInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ToggleMayhemModeInstructionData { + discriminator: [u8; 8], +} + +impl ToggleMayhemModeInstructionData { + pub fn new() -> Self { + Self { + discriminator: [1, 9, 111, 208, 100, 31, 255, 163], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for ToggleMayhemModeInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ToggleMayhemModeInstructionArgs { + pub enabled: bool, +} + +impl ToggleMayhemModeInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `ToggleMayhemMode`. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin +/// 1. `[writable]` global_config +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct ToggleMayhemModeBuilder { + admin: Option, + global_config: Option, + event_authority: Option, + program: Option, + enabled: Option, + __remaining_accounts: Vec, +} + +impl ToggleMayhemModeBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { + self.admin = Some(admin); + self + } + #[inline(always)] + pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { + self.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn enabled(&mut self, enabled: bool) -> &mut Self { + self.enabled = Some(enabled); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = ToggleMayhemMode { + admin: self.admin.expect("admin is not set"), + global_config: self.global_config.expect("global_config is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = ToggleMayhemModeInstructionArgs { + enabled: self.enabled.clone().expect("enabled is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `toggle_mayhem_mode` CPI accounts. +pub struct ToggleMayhemModeCpiAccounts<'a, 'b> { + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `toggle_mayhem_mode` CPI instruction. +pub struct ToggleMayhemModeCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub admin: &'b solana_account_info::AccountInfo<'a>, + + pub global_config: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: ToggleMayhemModeInstructionArgs, +} + +impl<'a, 'b> ToggleMayhemModeCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: ToggleMayhemModeCpiAccounts<'a, 'b>, + args: ToggleMayhemModeInstructionArgs, + ) -> Self { + Self { + __program: program, + admin: accounts.admin, + global_config: accounts.global_config, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = ToggleMayhemModeInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_AMM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.admin.clone()); + account_infos.push(self.global_config.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ToggleMayhemMode` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin +/// 1. `[writable]` global_config +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct ToggleMayhemModeCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ToggleMayhemModeCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ToggleMayhemModeCpiBuilderInstruction { + __program: program, + admin: None, + global_config: None, + event_authority: None, + program: None, + enabled: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.admin = Some(admin); + self + } + #[inline(always)] + pub fn global_config( + &mut self, + global_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_config = Some(global_config); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn enabled(&mut self, enabled: bool) -> &mut Self { + self.instruction.enabled = Some(enabled); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = ToggleMayhemModeInstructionArgs { + enabled: self + .instruction + .enabled + .clone() + .expect("enabled is not set"), + }; + let instruction = ToggleMayhemModeCpi { + __program: self.instruction.__program, + + admin: self.instruction.admin.expect("admin is not set"), + + global_config: self + .instruction + .global_config + .expect("global_config is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct ToggleMayhemModeCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + admin: Option<&'b solana_account_info::AccountInfo<'a>>, + global_config: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + enabled: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/update_admin.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/update_admin.rs index e0ee0503..bbdad2c9 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/update_admin.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/update_admin.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const UPDATE_ADMIN_DISCRIMINATOR: [u8; 8] = [161, 176, 40, 213, 60, 184, 179, 228]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl UpdateAdmin { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -53,7 +55,7 @@ impl UpdateAdmin { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&UpdateAdminInstructionData::new()).unwrap(); + let data = UpdateAdminInstructionData::new().try_to_vec().unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -75,10 +77,16 @@ impl UpdateAdminInstructionData { discriminator: [161, 176, 40, 213, 60, 184, 179, 228], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for UpdateAdminInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `UpdateAdmin`. @@ -101,45 +109,40 @@ pub struct UpdateAdminBuilder { } impl UpdateAdminBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { self.admin = Some(admin); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn new_admin(&mut self, new_admin: solana_pubkey::Pubkey) -> &mut Self { self.new_admin = Some(new_admin); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -149,7 +152,6 @@ impl UpdateAdminBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = UpdateAdmin { @@ -207,28 +209,21 @@ impl<'a, 'b> UpdateAdminCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -236,7 +231,7 @@ impl<'a, 'b> UpdateAdminCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.admin.key, @@ -265,7 +260,7 @@ impl<'a, 'b> UpdateAdminCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&UpdateAdminInstructionData::new()).unwrap(); + let data = UpdateAdminInstructionData::new().try_to_vec().unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_AMM_ID, @@ -318,13 +313,11 @@ impl<'a, 'b> UpdateAdminCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.admin = Some(admin); self } - #[inline(always)] pub fn global_config( &mut self, @@ -333,13 +326,11 @@ impl<'a, 'b> UpdateAdminCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn new_admin(&mut self, new_admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.new_admin = Some(new_admin); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -348,13 +339,11 @@ impl<'a, 'b> UpdateAdminCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -368,7 +357,6 @@ impl<'a, 'b> UpdateAdminCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -383,16 +371,13 @@ impl<'a, 'b> UpdateAdminCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = UpdateAdminCpi { __program: self.instruction.__program, diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/update_fee_config.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/update_fee_config.rs index f97ce4c4..ea437ce8 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/update_fee_config.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/update_fee_config.rs @@ -5,9 +5,12 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +pub const UPDATE_FEE_CONFIG_DISCRIMINATOR: [u8; 8] = [104, 184, 103, 242, 88, 151, 107, 20]; + /// Accounts. #[derive(Debug)] pub struct UpdateFeeConfig { @@ -27,7 +30,6 @@ impl UpdateFeeConfig { ) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -52,8 +54,8 @@ impl UpdateFeeConfig { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&UpdateFeeConfigInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = UpdateFeeConfigInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -76,10 +78,16 @@ impl UpdateFeeConfigInstructionData { discriminator: [104, 184, 103, 242, 88, 151, 107, 20], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for UpdateFeeConfigInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -89,6 +97,13 @@ pub struct UpdateFeeConfigInstructionArgs { pub protocol_fee_basis_points: u64, pub protocol_fee_recipients: [Pubkey; 8], pub coin_creator_fee_basis_points: u64, + pub admin_set_coin_creator_authority: Pubkey, +} + +impl UpdateFeeConfigInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } /// Instruction builder for `UpdateFeeConfig`. @@ -109,54 +124,49 @@ pub struct UpdateFeeConfigBuilder { protocol_fee_basis_points: Option, protocol_fee_recipients: Option<[Pubkey; 8]>, coin_creator_fee_basis_points: Option, + admin_set_coin_creator_authority: Option, __remaining_accounts: Vec, } impl UpdateFeeConfigBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn admin(&mut self, admin: solana_pubkey::Pubkey) -> &mut Self { self.admin = Some(admin); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn lp_fee_basis_points(&mut self, lp_fee_basis_points: u64) -> &mut Self { self.lp_fee_basis_points = Some(lp_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_basis_points(&mut self, protocol_fee_basis_points: u64) -> &mut Self { self.protocol_fee_basis_points = Some(protocol_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_recipients(&mut self, protocol_fee_recipients: [Pubkey; 8]) -> &mut Self { self.protocol_fee_recipients = Some(protocol_fee_recipients); self } - #[inline(always)] pub fn coin_creator_fee_basis_points( &mut self, @@ -165,14 +175,20 @@ impl UpdateFeeConfigBuilder { self.coin_creator_fee_basis_points = Some(coin_creator_fee_basis_points); self } - + #[inline(always)] + pub fn admin_set_coin_creator_authority( + &mut self, + admin_set_coin_creator_authority: Pubkey, + ) -> &mut Self { + self.admin_set_coin_creator_authority = Some(admin_set_coin_creator_authority); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -182,7 +198,6 @@ impl UpdateFeeConfigBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = UpdateFeeConfig { @@ -208,6 +223,10 @@ impl UpdateFeeConfigBuilder { .coin_creator_fee_basis_points .clone() .expect("coin_creator_fee_basis_points is not set"), + admin_set_coin_creator_authority: self + .admin_set_coin_creator_authority + .clone() + .expect("admin_set_coin_creator_authority is not set"), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -256,28 +275,21 @@ impl<'a, 'b> UpdateFeeConfigCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -285,7 +297,7 @@ impl<'a, 'b> UpdateFeeConfigCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.admin.key, @@ -310,8 +322,8 @@ impl<'a, 'b> UpdateFeeConfigCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&UpdateFeeConfigInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = UpdateFeeConfigInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -362,17 +374,16 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { protocol_fee_basis_points: None, protocol_fee_recipients: None, coin_creator_fee_basis_points: None, + admin_set_coin_creator_authority: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn admin(&mut self, admin: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.admin = Some(admin); self } - #[inline(always)] pub fn global_config( &mut self, @@ -381,7 +392,6 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -390,31 +400,26 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn lp_fee_basis_points(&mut self, lp_fee_basis_points: u64) -> &mut Self { self.instruction.lp_fee_basis_points = Some(lp_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_basis_points(&mut self, protocol_fee_basis_points: u64) -> &mut Self { self.instruction.protocol_fee_basis_points = Some(protocol_fee_basis_points); self } - #[inline(always)] pub fn protocol_fee_recipients(&mut self, protocol_fee_recipients: [Pubkey; 8]) -> &mut Self { self.instruction.protocol_fee_recipients = Some(protocol_fee_recipients); self } - #[inline(always)] pub fn coin_creator_fee_basis_points( &mut self, @@ -423,7 +428,14 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { self.instruction.coin_creator_fee_basis_points = Some(coin_creator_fee_basis_points); self } - + #[inline(always)] + pub fn admin_set_coin_creator_authority( + &mut self, + admin_set_coin_creator_authority: Pubkey, + ) -> &mut Self { + self.instruction.admin_set_coin_creator_authority = Some(admin_set_coin_creator_authority); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -437,7 +449,6 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -452,16 +463,13 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = UpdateFeeConfigInstructionArgs { lp_fee_basis_points: self .instruction @@ -483,6 +491,11 @@ impl<'a, 'b> UpdateFeeConfigCpiBuilder<'a, 'b> { .coin_creator_fee_basis_points .clone() .expect("coin_creator_fee_basis_points is not set"), + admin_set_coin_creator_authority: self + .instruction + .admin_set_coin_creator_authority + .clone() + .expect("admin_set_coin_creator_authority is not set"), }; let instruction = UpdateFeeConfigCpi { __program: self.instruction.__program, @@ -520,6 +533,7 @@ struct UpdateFeeConfigCpiBuilderInstruction<'a, 'b> { protocol_fee_basis_points: Option, protocol_fee_recipients: Option<[Pubkey; 8]>, coin_creator_fee_basis_points: Option, + admin_set_coin_creator_authority: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/instructions/withdraw.rs b/crates/pump-swaps-parser/src/generated_sdk/instructions/withdraw.rs index 74776d0f..811f97f6 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/instructions/withdraw.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/instructions/withdraw.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const WITHDRAW_DISCRIMINATOR: [u8; 8] = [183, 18, 70, 156, 148, 109, 161, 34]; /// Accounts. #[derive(Debug)] @@ -45,7 +48,6 @@ impl Withdraw { pub fn instruction(&self, args: WithdrawInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -108,8 +110,8 @@ impl Withdraw { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&WithdrawInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = WithdrawInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -132,10 +134,16 @@ impl WithdrawInstructionData { discriminator: [183, 18, 70, 156, 148, 109, 161, 34], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for WithdrawInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -146,6 +154,12 @@ pub struct WithdrawInstructionArgs { pub min_quote_amount_out: u64, } +impl WithdrawInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Withdraw`. /// /// ### Accounts: @@ -189,44 +203,39 @@ pub struct WithdrawBuilder { } impl WithdrawBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn global_config(&mut self, global_config: solana_pubkey::Pubkey) -> &mut Self { self.global_config = Some(global_config); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: solana_pubkey::Pubkey) -> &mut Self { self.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint(&mut self, quote_mint: solana_pubkey::Pubkey) -> &mut Self { self.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: solana_pubkey::Pubkey) -> &mut Self { self.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -235,7 +244,6 @@ impl WithdrawBuilder { self.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -244,7 +252,6 @@ impl WithdrawBuilder { self.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -253,7 +260,6 @@ impl WithdrawBuilder { self.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -262,7 +268,6 @@ impl WithdrawBuilder { self.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -271,58 +276,49 @@ impl WithdrawBuilder { self.pool_quote_token_account = Some(pool_quote_token_account); self } - /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` #[inline(always)] pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { self.token_program = Some(token_program); self } - /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` #[inline(always)] pub fn token2022_program(&mut self, token2022_program: solana_pubkey::Pubkey) -> &mut Self { self.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn lp_token_amount_in(&mut self, lp_token_amount_in: u64) -> &mut Self { self.lp_token_amount_in = Some(lp_token_amount_in); self } - #[inline(always)] pub fn min_base_amount_out(&mut self, min_base_amount_out: u64) -> &mut Self { self.min_base_amount_out = Some(min_base_amount_out); self } - #[inline(always)] pub fn min_quote_amount_out(&mut self, min_quote_amount_out: u64) -> &mut Self { self.min_quote_amount_out = Some(min_quote_amount_out); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -332,7 +328,6 @@ impl WithdrawBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Withdraw { @@ -482,28 +477,21 @@ impl<'a, 'b> WithdrawCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -511,7 +499,7 @@ impl<'a, 'b> WithdrawCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(15 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new(*self.pool.key, false)); accounts.push(solana_instruction::AccountMeta::new_readonly( @@ -577,8 +565,8 @@ impl<'a, 'b> WithdrawCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&WithdrawInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = WithdrawInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -665,13 +653,11 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn global_config( &mut self, @@ -680,19 +666,16 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.global_config = Some(global_config); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn base_mint(&mut self, base_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.base_mint = Some(base_mint); self } - #[inline(always)] pub fn quote_mint( &mut self, @@ -701,13 +684,11 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.quote_mint = Some(quote_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_base_token_account( &mut self, @@ -716,7 +697,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.user_base_token_account = Some(user_base_token_account); self } - #[inline(always)] pub fn user_quote_token_account( &mut self, @@ -725,7 +705,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.user_quote_token_account = Some(user_quote_token_account); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -734,7 +713,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -743,7 +721,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -752,7 +729,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn token_program( &mut self, @@ -761,7 +737,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.token_program = Some(token_program); self } - #[inline(always)] pub fn token2022_program( &mut self, @@ -770,7 +745,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -779,31 +753,26 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn lp_token_amount_in(&mut self, lp_token_amount_in: u64) -> &mut Self { self.instruction.lp_token_amount_in = Some(lp_token_amount_in); self } - #[inline(always)] pub fn min_base_amount_out(&mut self, min_base_amount_out: u64) -> &mut Self { self.instruction.min_base_amount_out = Some(min_base_amount_out); self } - #[inline(always)] pub fn min_quote_amount_out(&mut self, min_quote_amount_out: u64) -> &mut Self { self.instruction.min_quote_amount_out = Some(min_quote_amount_out); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -817,7 +786,6 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -832,16 +800,13 @@ impl<'a, 'b> WithdrawCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = WithdrawInstructionArgs { lp_token_amount_in: self .instruction diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/admin_set_coin_creator_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/admin_set_coin_creator_event.rs new file mode 100644 index 00000000..cc16288c --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/admin_set_coin_creator_event.rs @@ -0,0 +1,41 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetCoinCreatorEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_coin_creator_authority: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub base_mint: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub pool: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub old_coin_creator: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub new_coin_creator: Pubkey, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/admin_update_token_incentives_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/admin_update_token_incentives_event.rs new file mode 100644 index 00000000..883bc4c3 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/admin_update_token_incentives_event.rs @@ -0,0 +1,26 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminUpdateTokenIncentivesEvent { + pub start_time: i64, + pub end_time: i64, + pub day_number: u64, + pub token_supply_per_day: u64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + pub seconds_in_a_day: i64, + pub timestamp: i64, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/buy_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/buy_event.rs index 97ea2e64..e1501379 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/buy_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/buy_event.rs @@ -5,9 +5,11 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +/// ix_name: "buy" | "buy_exact_quote_in" #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct BuyEvent { @@ -62,4 +64,11 @@ pub struct BuyEvent { pub coin_creator: Pubkey, pub coin_creator_fee_basis_points: u64, pub coin_creator_fee: u64, + pub track_volume: bool, + pub total_unclaimed_tokens: u64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, + pub last_update_timestamp: i64, + pub min_base_amount_out: u64, + pub ix_name: String, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/claim_token_incentives_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/claim_token_incentives_event.rs new file mode 100644 index 00000000..cb76a65e --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/claim_token_incentives_event.rs @@ -0,0 +1,29 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ClaimTokenIncentivesEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + pub amount: u64, + pub timestamp: i64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/close_user_volume_accumulator_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/close_user_volume_accumulator_event.rs new file mode 100644 index 00000000..dc04332d --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/close_user_volume_accumulator_event.rs @@ -0,0 +1,25 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CloseUserVolumeAccumulatorEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub timestamp: i64, + pub total_unclaimed_tokens: u64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, + pub last_update_timestamp: i64, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/collect_coin_creator_fee_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/collect_coin_creator_fee_event.rs index 03f7b951..2f19d4c6 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/collect_coin_creator_fee_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/collect_coin_creator_fee_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/create_config_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/create_config_event.rs index 18515f2f..59e1fa95 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/create_config_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/create_config_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -21,4 +22,9 @@ pub struct CreateConfigEvent { pub protocol_fee_basis_points: u64, pub protocol_fee_recipients: [Pubkey; 8], pub coin_creator_fee_basis_points: u64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_coin_creator_authority: Pubkey, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/create_pool_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/create_pool_event.rs index 16ecb3c7..92047642 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/create_pool_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/create_pool_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -63,4 +64,5 @@ pub struct CreatePoolEvent { serde(with = "serde_with::As::") )] pub coin_creator: Pubkey, + pub is_mayhem_mode: bool, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/deposit_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/deposit_event.rs index 89960b66..185bc4dc 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/deposit_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/deposit_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/disable_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/disable_event.rs index cd6d466b..dea9600b 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/disable_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/disable_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/extend_account_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/extend_account_event.rs index 348e8c82..98262fe9 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/extend_account_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/extend_account_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/fee_tier.rs b/crates/pump-swaps-parser/src/generated_sdk/types/fee_tier.rs new file mode 100644 index 00000000..7d52af95 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/fee_tier.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FeeTier { + pub market_cap_lamports_threshold: u128, + pub fees: Fees, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/fees.rs b/crates/pump-swaps-parser/src/generated_sdk/types/fees.rs new file mode 100644 index 00000000..c248d91f --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/fees.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct Fees { + pub lp_fee_bps: u64, + pub protocol_fee_bps: u64, + pub creator_fee_bps: u64, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/init_user_volume_accumulator_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/init_user_volume_accumulator_event.rs new file mode 100644 index 00000000..7fdcebcd --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/init_user_volume_accumulator_event.rs @@ -0,0 +1,26 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitUserVolumeAccumulatorEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub payer: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub timestamp: i64, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/mod.rs b/crates/pump-swaps-parser/src/generated_sdk/types/mod.rs index e57bc3d8..89dcc9a6 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/mod.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/mod.rs @@ -5,24 +5,48 @@ //! //! +pub(crate) mod r#admin_set_coin_creator_event; +pub(crate) mod r#admin_update_token_incentives_event; pub(crate) mod r#buy_event; +pub(crate) mod r#claim_token_incentives_event; +pub(crate) mod r#close_user_volume_accumulator_event; pub(crate) mod r#collect_coin_creator_fee_event; pub(crate) mod r#create_config_event; pub(crate) mod r#create_pool_event; pub(crate) mod r#deposit_event; pub(crate) mod r#disable_event; pub(crate) mod r#extend_account_event; +pub(crate) mod r#fee_tier; +pub(crate) mod r#fees; +pub(crate) mod r#init_user_volume_accumulator_event; +pub(crate) mod r#reserved_fee_recipients_event; pub(crate) mod r#sell_event; pub(crate) mod r#set_bonding_curve_coin_creator_event; pub(crate) mod r#set_metaplex_coin_creator_event; +pub(crate) mod r#sync_user_volume_accumulator_event; pub(crate) mod r#update_admin_event; pub(crate) mod r#update_fee_config_event; pub(crate) mod r#withdraw_event; -pub use self::{ - r#buy_event::*, r#collect_coin_creator_fee_event::*, r#create_config_event::*, - r#create_pool_event::*, r#deposit_event::*, r#disable_event::*, r#extend_account_event::*, - r#sell_event::*, r#set_bonding_curve_coin_creator_event::*, - r#set_metaplex_coin_creator_event::*, r#update_admin_event::*, r#update_fee_config_event::*, - r#withdraw_event::*, -}; +pub use self::r#admin_set_coin_creator_event::*; +pub use self::r#admin_update_token_incentives_event::*; +pub use self::r#buy_event::*; +pub use self::r#claim_token_incentives_event::*; +pub use self::r#close_user_volume_accumulator_event::*; +pub use self::r#collect_coin_creator_fee_event::*; +pub use self::r#create_config_event::*; +pub use self::r#create_pool_event::*; +pub use self::r#deposit_event::*; +pub use self::r#disable_event::*; +pub use self::r#extend_account_event::*; +pub use self::r#fee_tier::*; +pub use self::r#fees::*; +pub use self::r#init_user_volume_accumulator_event::*; +pub use self::r#reserved_fee_recipients_event::*; +pub use self::r#sell_event::*; +pub use self::r#set_bonding_curve_coin_creator_event::*; +pub use self::r#set_metaplex_coin_creator_event::*; +pub use self::r#sync_user_volume_accumulator_event::*; +pub use self::r#update_admin_event::*; +pub use self::r#update_fee_config_event::*; +pub use self::r#withdraw_event::*; diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/reserved_fee_recipients_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/reserved_fee_recipients_event.rs new file mode 100644 index 00000000..2d6b5af0 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/reserved_fee_recipients_event.rs @@ -0,0 +1,22 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ReservedFeeRecipientsEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub reserved_fee_recipient: Pubkey, + pub reserved_fee_recipients: [Pubkey; 7], +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/sell_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/sell_event.rs index 94f39b37..c73bb3c4 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/sell_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/sell_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/set_bonding_curve_coin_creator_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/set_bonding_curve_coin_creator_event.rs index bbb1948f..5cd6d8c4 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/set_bonding_curve_coin_creator_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/set_bonding_curve_coin_creator_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/set_metaplex_coin_creator_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/set_metaplex_coin_creator_event.rs index 27528614..051ad73d 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/set_metaplex_coin_creator_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/set_metaplex_coin_creator_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/sync_user_volume_accumulator_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/sync_user_volume_accumulator_event.rs new file mode 100644 index 00000000..28a50909 --- /dev/null +++ b/crates/pump-swaps-parser/src/generated_sdk/types/sync_user_volume_accumulator_event.rs @@ -0,0 +1,23 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SyncUserVolumeAccumulatorEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub total_claimed_tokens_before: u64, + pub total_claimed_tokens_after: u64, + pub timestamp: i64, +} diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/update_admin_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/update_admin_event.rs index f3973136..42b67f3a 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/update_admin_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/update_admin_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/update_fee_config_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/update_fee_config_event.rs index 4cee1761..d56b0dc7 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/update_fee_config_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/update_fee_config_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -21,4 +22,9 @@ pub struct UpdateFeeConfigEvent { pub protocol_fee_basis_points: u64, pub protocol_fee_recipients: [Pubkey; 8], pub coin_creator_fee_basis_points: u64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_coin_creator_authority: Pubkey, } diff --git a/crates/pump-swaps-parser/src/generated_sdk/types/withdraw_event.rs b/crates/pump-swaps-parser/src/generated_sdk/types/withdraw_event.rs index 50b04519..e526bfd5 100644 --- a/crates/pump-swaps-parser/src/generated_sdk/types/withdraw_event.rs +++ b/crates/pump-swaps-parser/src/generated_sdk/types/withdraw_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/Cargo.toml b/crates/pumpfun-parser/Cargo.toml index e54d462e..ac8acecb 100644 --- a/crates/pumpfun-parser/Cargo.toml +++ b/crates/pumpfun-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "yellowstone-vixen-pumpfun-parser" -version = "0.5.1" +version = "0.5.2" edition.workspace = true description = "Vixen program parser for Pumpfun program" license.workspace = true diff --git a/crates/pumpfun-parser/codama.cjs b/crates/pumpfun-parser/codama.cjs new file mode 100644 index 00000000..13ac97ad --- /dev/null +++ b/crates/pumpfun-parser/codama.cjs @@ -0,0 +1,22 @@ +// codama.cjs +const path = require("node:path"); +const { rootNode } = require("@codama/nodes"); +const { rootNodeFromAnchor } = require("@codama/nodes-from-anchor"); +const { readJson } = require("@codama/renderers-core"); +const { visit } = require("@codama/visitors-core"); +const { renderVisitor } = require("@codama/renderers-vixen-parser"); + +const projectName = "example-parser"; +const idl = readJson(path.join(__dirname, "idl.json")); + +// Use the appropriate node constructor based on your IDL type: +const node = rootNodeFromAnchor(idl); // for Anchor/Shank idls +// const node = rootNode(idl.program); // for Codama idls + +visit( + node, + renderVisitor({ + projectFolder: __dirname, + projectName, + }), +); diff --git a/crates/pumpfun-parser/codama.json b/crates/pumpfun-parser/codama.json new file mode 100644 index 00000000..b2a2d3c1 --- /dev/null +++ b/crates/pumpfun-parser/codama.json @@ -0,0 +1,16 @@ +{ + "idl": "idl.json", + "before": [], + "scripts": { + "rust": { + "from": "@codama/renderers-rust", + "args": [ + "clients/rust/src/generated", + { + "crateFolder": "clients/rust", + "formatCode": true + } + ] + } + } +} \ No newline at end of file diff --git a/crates/pumpfun-parser/idl.json b/crates/pumpfun-parser/idl.json index 160ba581..7833c6b9 100644 --- a/crates/pumpfun-parser/idl.json +++ b/crates/pumpfun-parser/idl.json @@ -1,1958 +1,5811 @@ { - "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", - "metadata": { - "name": "pump", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "buy", - "docs": ["Buys tokens from a bonding curve."], - "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], - "accounts": [ - { - "name": "global", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "fee_recipient", - "writable": true - }, - { - "name": "mint" - }, - { - "name": "bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "associated_bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "bonding_curve" - }, - { - "kind": "const", - "value": [ - 6, 221, 246, 225, 215, 101, 161, 147, 217, - 203, 225, 70, 206, 235, 121, 172, 28, 180, - 133, 237, 95, 91, 55, 145, 58, 140, 245, - 133, 126, 255, 0, 169 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "associated_user", - "writable": true - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "creator_vault", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 99, 114, 101, 97, 116, 111, 114, 45, 118, - 97, 117, 108, 116 - ] - }, - { - "kind": "account", - "path": "bonding_curve.creator", - "account": "BondingCurve" - } - ] - } - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "max_sol_cost", - "type": "u64" - } + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", + "metadata": { + "name": "pump", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "admin_set_creator", + "docs": [ + "Allows Global::admin_set_creator_authority to override the bonding curve creator" + ], + "discriminator": [ + 69, + 25, + 171, + 142, + 57, + 239, + 13, + 4 + ], + "accounts": [ + { + "name": "admin_set_creator_authority", + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } ] + } }, { - "name": "collect_creator_fee", - "docs": [ - "Collects creator_fee from creator_vault to the coin creator account" - ], - "discriminator": [20, 22, 86, 123, 198, 28, 219, 132], - "accounts": [ - { - "name": "creator", - "writable": true, - "signer": true - }, - { - "name": "creator_vault", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 99, 114, 101, 97, 116, 111, 114, 45, 118, - 97, 117, 108, 116 - ] - }, - { - "kind": "account", - "path": "creator" - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "create", - "docs": ["Creates a new coin and bonding curve."], - "discriminator": [24, 30, 200, 40, 5, 28, 7, 119], - "accounts": [ - { - "name": "mint", - "writable": true, - "signer": true - }, - { - "name": "mint_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, 105, 110, 116, 45, 97, 117, 116, 104, - 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "associated_bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "bonding_curve" - }, - { - "kind": "const", - "value": [ - 6, 221, 246, 225, 215, 101, 161, 147, 217, - 203, 225, 70, 206, 235, 121, 172, 28, 180, - 133, 237, 95, 91, 55, 145, 58, 140, 245, - 133, 126, 255, 0, 169 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "global", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "mpl_token_metadata", - "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" - }, - { - "name": "metadata", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [109, 101, 116, 97, 100, 97, 116, 97] - }, - { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, - 157, 82, 127, 107, 4, 195, 205, 88, 184, - 108, 115, 26, 160, 253, 181, 73, 182, 209, - 188, 3, 248, 41, 70 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "account", - "path": "mpl_token_metadata" - } - } - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "associated_token_program", - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "rent", - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "name", - "type": "string" - }, - { - "name": "symbol", - "type": "string" - }, - { - "name": "uri", - "type": "string" - }, - { - "name": "creator", - "type": "pubkey" - } + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } ] + } }, { - "name": "extend_account", - "docs": ["Extends the size of program-owned accounts"], - "discriminator": [234, 102, 194, 203, 150, 72, 62, 229], - "accounts": [ - { - "name": "account", - "writable": true - }, - { - "name": "user", - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "initialize", - "docs": ["Creates the global state."], - "discriminator": [175, 175, 109, 31, 13, 152, 155, 237], - "accounts": [ - { - "name": "global", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [] + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "name": "migrate", - "docs": [ - "Migrates liquidity to pump_amm if the bonding curve is complete" - ], - "discriminator": [155, 234, 231, 146, 236, 158, 162, 30], - "accounts": [ - { - "name": "global", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "withdraw_authority", - "writable": true, - "relations": ["global"] - }, - { - "name": "mint" - }, - { - "name": "bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "associated_bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "bonding_curve" - }, - { - "kind": "const", - "value": [ - 6, 221, 246, 225, 215, 101, 161, 147, 217, - 203, 225, 70, 206, 235, 121, 172, 28, 180, - 133, 237, 95, 91, 55, 145, 58, 140, 245, - 133, 126, 255, 0, 169 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "user", - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "pump_amm", - "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" - }, - { - "name": "pool", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [112, 111, 111, 108] - }, - { - "kind": "const", - "value": [0, 0] - }, - { - "kind": "account", - "path": "pool_authority" - }, - { - "kind": "account", - "path": "mint" - }, - { - "kind": "account", - "path": "wsol_mint" - } - ], - "program": { - "kind": "account", - "path": "pump_amm" - } - } - }, - { - "name": "pool_authority", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, 111, 111, 108, 45, 97, 117, 116, 104, - 111, 114, 105, 116, 121 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "pool_authority_mint_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool_authority" - }, - { - "kind": "account", - "path": "token_program" - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "account", - "path": "associated_token_program" - } - } - }, - { - "name": "pool_authority_wsol_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool_authority" - }, - { - "kind": "account", - "path": "token_program" - }, - { - "kind": "account", - "path": "wsol_mint" - } - ], - "program": { - "kind": "account", - "path": "associated_token_program" - } - } - }, - { - "name": "amm_global_config", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 103, 108, 111, 98, 97, 108, 95, 99, 111, - 110, 102, 105, 103 - ] - } - ], - "program": { - "kind": "account", - "path": "pump_amm" - } - } - }, - { - "name": "wsol_mint", - "address": "So11111111111111111111111111111111111111112" - }, - { - "name": "lp_mint", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 112, 111, 111, 108, 95, 108, 112, 95, 109, - 105, 110, 116 - ] - }, - { - "kind": "account", - "path": "pool" - } - ], - "program": { - "kind": "account", - "path": "pump_amm" - } - } - }, - { - "name": "user_pool_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool_authority" - }, - { - "kind": "account", - "path": "token_2022_program" - }, - { - "kind": "account", - "path": "lp_mint" - } - ], - "program": { - "kind": "account", - "path": "associated_token_program" - } - } - }, - { - "name": "pool_base_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool" - }, - { - "kind": "account", - "path": "token_program" - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "account", - "path": "associated_token_program" - } - } - }, - { - "name": "pool_quote_token_account", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "pool" - }, - { - "kind": "account", - "path": "token_program" - }, - { - "kind": "account", - "path": "wsol_mint" - } - ], - "program": { - "kind": "account", - "path": "associated_token_program" - } - } - }, - { - "name": "token_2022_program", - "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "name": "associated_token_program", - "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" - }, - { - "name": "pump_amm_event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ], - "program": { - "kind": "account", - "path": "pump_amm" - } - } - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "sell", - "docs": ["Sells tokens into a bonding curve."], - "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], - "accounts": [ - { - "name": "global", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "fee_recipient", - "writable": true - }, - { - "name": "mint" - }, - { - "name": "bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "associated_bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "account", - "path": "bonding_curve" - }, - { - "kind": "const", - "value": [ - 6, 221, 246, 225, 215, 101, 161, 147, 217, - 203, 225, 70, 206, 235, 121, 172, 28, 180, - 133, 237, 95, 91, 55, 145, 58, 140, 245, - 133, 126, 255, 0, 169 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "const", - "value": [ - 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, - 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, - 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, - 89 - ] - } - } - }, - { - "name": "associated_user", - "writable": true - }, - { - "name": "user", - "writable": true, - "signer": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - }, - { - "name": "creator_vault", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 99, 114, 101, 97, 116, 111, 114, 45, 118, - 97, 117, 108, 116 - ] - }, - { - "kind": "account", - "path": "bonding_curve.creator", - "account": "BondingCurve" - } - ] - } - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "min_sol_output", - "type": "u64" - } + "name": "program" + } + ], + "args": [ + { + "name": "creator", + "type": "pubkey" + } + ] + }, + { + "name": "admin_set_idl_authority", + "discriminator": [ + 8, + 217, + 96, + 231, + 144, + 104, + 192, + 5 + ], + "accounts": [ + { + "name": "authority", + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } ] + } }, { - "name": "set_creator", - "docs": [ - "Allows Global::set_creator_authority to set the bonding curve creator from Metaplex metadata or input argument" - ], - "discriminator": [254, 148, 255, 112, 207, 142, 170, 165], - "accounts": [ - { - "name": "set_creator_authority", - "signer": true, - "relations": ["global"] - }, - { - "name": "global", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "mint" - }, - { - "name": "metadata", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [109, 101, 116, 97, 100, 97, 116, 97] - }, - { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, - 157, 82, 127, 107, 4, 195, 205, 88, 184, - 108, 115, 26, 160, 253, 181, 73, 182, 209, - 188, 3, 248, 41, 70 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, - 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, - 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, - 41, 70 - ] - } - } - }, - { - "name": "bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "creator", - "type": "pubkey" - } + "name": "idl_account", + "writable": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "program_signer", + "pda": { + "seeds": [] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } ] + } }, { - "name": "set_metaplex_creator", - "docs": [ - "Syncs the bonding curve creator with the Metaplex metadata creator if it exists" - ], - "discriminator": [138, 96, 174, 217, 48, 85, 197, 246], - "accounts": [ - { - "name": "mint" - }, - { - "name": "metadata", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [109, 101, 116, 97, 100, 97, 116, 97] - }, - { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, - 157, 82, 127, 107, 4, 195, 205, 88, 184, - 108, 115, 26, 160, 253, 181, 73, 182, 209, - 188, 3, 248, 41, 70 - ] - }, - { - "kind": "account", - "path": "mint" - } - ], - "program": { - "kind": "const", - "value": [ - 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, - 82, 127, 107, 4, 195, 205, 88, 184, 108, 115, - 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, - 41, 70 - ] - } - } - }, - { - "name": "bonding_curve", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 98, 111, 110, 100, 105, 110, 103, 45, 99, - 117, 114, 118, 101 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [] - }, - { - "name": "set_params", - "docs": ["Sets the global state parameters."], - "discriminator": [27, 234, 178, 52, 147, 2, 187, 141], - "accounts": [ - { - "name": "global", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "authority", - "writable": true, - "signer": true, - "relations": ["global"] - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } - ], - "args": [ - { - "name": "initial_virtual_token_reserves", - "type": "u64" - }, - { - "name": "initial_virtual_sol_reserves", - "type": "u64" - }, - { - "name": "initial_real_token_reserves", - "type": "u64" - }, - { - "name": "token_total_supply", - "type": "u64" - }, - { - "name": "fee_basis_points", - "type": "u64" - }, - { - "name": "withdraw_authority", - "type": "pubkey" - }, - { - "name": "enable_migrate", - "type": "bool" - }, - { - "name": "pool_migration_fee", - "type": "u64" - }, - { - "name": "creator_fee_basis_points", - "type": "u64" - }, - { - "name": "set_creator_authority", - "type": "pubkey" - } + "name": "program" + } + ], + "args": [ + { + "name": "idl_authority", + "type": "pubkey" + } + ] + }, + { + "name": "admin_update_token_incentives", + "discriminator": [ + 209, + 11, + 115, + 87, + 213, + 23, + 124, + 204 + ], + "accounts": [ + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } ] + } }, { - "name": "update_global_authority", - "discriminator": [227, 181, 74, 196, 208, 21, 97, 213], - "accounts": [ - { - "name": "global", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [103, 108, 111, 98, 97, 108] - } - ] - } - }, - { - "name": "authority", - "signer": true, - "relations": ["global"] - }, - { - "name": "new_authority" - }, - { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, - 117, 116, 104, 111, 114, 105, 116, 121 - ] - } - ] - } - }, - { - "name": "program" - } + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } ], - "args": [] + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" } - ], - "accounts": [ + ], + "args": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, { - "name": "BondingCurve", - "discriminator": [23, 183, 248, 55, 96, 216, 172, 96] + "name": "day_number", + "type": "u64" }, { - "name": "Global", - "discriminator": [167, 232, 232, 177, 200, 108, 114, 127] + "name": "pump_token_supply_per_day", + "type": "u64" } - ], - "events": [ + ] + }, + { + "name": "buy", + "docs": [ + "Buys tokens from a bonding curve." + ], + "discriminator": [ + 102, + 6, + 61, + 18, + 1, + 218, + 235, + 234 + ], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, { - "name": "CollectCreatorFeeEvent", - "discriminator": [122, 2, 127, 1, 14, 191, 12, 175] + "name": "fee_recipient", + "writable": true }, { - "name": "CompleteEvent", - "discriminator": [95, 114, 97, 156, 212, 46, 152, 8] + "name": "mint" }, { - "name": "CompletePumpAmmMigrationEvent", - "discriminator": [189, 233, 93, 185, 92, 148, 234, 148] + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "associated_user", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 45, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "bonding_curve.creator", + "account": "BondingCurve" + } + ] + } }, { - "name": "CreateEvent", - "discriminator": [27, 114, 169, 77, 222, 235, 99, 118] + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "name": "ExtendAccountEvent", - "discriminator": [97, 97, 215, 144, 93, 146, 22, 124] + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" }, { - "name": "SetCreatorEvent", - "discriminator": [237, 52, 123, 37, 245, 251, 72, 210] + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } }, { - "name": "SetMetaplexCreatorEvent", - "discriminator": [142, 203, 6, 32, 127, 105, 191, 162] + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "name": "SetParamsEvent", - "discriminator": [223, 195, 159, 246, 62, 48, 143, 131] + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 1, + 86, + 224, + 246, + 147, + 102, + 90, + 207, + 68, + 219, + 21, + 104, + 191, + 23, + 91, + 170, + 81, + 137, + 203, + 151, + 245, + 210, + 255, + 59, + 101, + 93, + 43, + 182, + 253, + 109, + 24, + 176 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } }, { - "name": "TradeEvent", - "discriminator": [189, 219, 127, 211, 78, 230, 97, 238] + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" }, { - "name": "UpdateGlobalAuthorityEvent", - "discriminator": [182, 195, 137, 42, 35, 206, 207, 247] + "name": "max_sol_cost", + "type": "u64" } - ], - "errors": [ + ] + }, + { + "name": "buy_exact_sol_in", + "docs": [ + "Given a budget of spendable SOL, buy at least min_tokens_out", + "Account creation and fees will be deducted from the spendable SOL", + "", + "f(sol) = tokens, where tokens >= min_tokens_out and sol > rent + fees", + "", + "max_slippage = min_tokens_out = 1", + "", + "Make sure the sol budget is enough to cover creation of the following accounts (unless already created):", + "- creator_vault: rent.minimum_balance(SystemAccount::LEN)", + "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)" + ], + "discriminator": [ + 56, + 252, + 116, + 8, + 158, + 223, + 205, + 95 + ], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, { - "code": 6000, - "name": "NotAuthorized", - "msg": "The given account is not authorized to execute this instruction." + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "code": 6001, - "name": "AlreadyInitialized", - "msg": "The program is already initialized." + "name": "associated_user", + "writable": true }, { - "code": 6002, - "name": "TooMuchSolRequired", - "msg": "slippage: Too much SOL required to buy the given amount of tokens." + "name": "user", + "writable": true, + "signer": true }, { - "code": 6003, - "name": "TooLittleSolReceived", - "msg": "slippage: Too little SOL received to sell the given amount of tokens." + "name": "system_program", + "address": "11111111111111111111111111111111" }, { - "code": 6004, - "name": "MintDoesNotMatchBondingCurve", - "msg": "The mint does not match the bonding curve." + "name": "token_program" }, { - "code": 6005, - "name": "BondingCurveComplete", - "msg": "The bonding curve has completed and liquidity migrated to raydium." + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 45, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "bonding_curve.creator", + "account": "BondingCurve" + } + ] + } }, { - "code": 6006, - "name": "BondingCurveNotComplete", - "msg": "The bonding curve has not completed." + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "code": 6007, - "name": "NotInitialized", - "msg": "The program is not initialized." + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" }, { - "code": 6008, - "name": "WithdrawTooFrequent", - "msg": "Withdraw too frequent" + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } }, { - "code": 6009, - "name": "NewSizeShouldBeGreaterThanCurrentSize", - "msg": "new_size should be > current_size" + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "code": 6010, - "name": "AccountTypeNotSupported", - "msg": "Account type not supported" + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 1, + 86, + 224, + 246, + 147, + 102, + 90, + 207, + 68, + 219, + 21, + 104, + 191, + 23, + 91, + 170, + 81, + 137, + 203, + 151, + 245, + 210, + 255, + 59, + 101, + 93, + 43, + 182, + 253, + 109, + 24, + 176 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } }, { - "code": 6011, - "name": "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply", - "msg": "initial_real_token_reserves should be less than token_total_supply" + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "spendable_sol_in", + "type": "u64" }, { - "code": 6012, - "name": "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves", - "msg": "initial_virtual_token_reserves should be greater than initial_real_token_reserves" + "name": "min_tokens_out", + "type": "u64" + } + ] + }, + { + "name": "claim_token_incentives", + "discriminator": [ + 16, + 4, + 71, + 28, + 204, + 1, + 40, + 27 + ], + "accounts": [ + { + "name": "user" }, { - "code": 6013, - "name": "FeeBasisPointsGreaterThanMaximum", - "msg": "fee_basis_points greater than maximum" + "name": "user_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "code": 6014, - "name": "AllZerosWithdrawAuthority", - "msg": "Withdraw authority cannot be set to System Program ID" + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } }, { - "code": 6015, - "name": "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves", - "msg": "pool_migration_fee should be less than final_real_sol_reserves" + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } }, { - "code": 6016, - "name": "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees", - "msg": "pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES" + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "code": 6017, - "name": "DisabledWithdraw", - "msg": "Migrate instruction is disabled" + "name": "mint", + "relations": [ + "global_volume_accumulator" + ] }, { - "code": 6018, - "name": "DisabledMigrate", - "msg": "Migrate instruction is disabled" + "name": "token_program" }, { - "code": 6019, - "name": "InvalidCreator", - "msg": "Invalid creator pubkey" + "name": "system_program", + "address": "11111111111111111111111111111111" }, { - "code": 6020, - "name": "BuyZeroAmount", - "msg": "Buy zero amount" + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" }, { - "code": 6021, - "name": "NotEnoughTokensToBuy", - "msg": "Not enough tokens to buy" + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "code": 6022, - "name": "SellZeroAmount", - "msg": "Sell zero amount" + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" }, { - "code": 6023, - "name": "NotEnoughTokensToSell", - "msg": "Not enough tokens to sell" + "name": "payer", + "writable": true, + "signer": true + } + ], + "args": [] + }, + { + "name": "close_user_volume_accumulator", + "discriminator": [ + 249, + 69, + 164, + 218, + 150, + 103, + 84, + 138 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true }, { - "code": 6024, - "name": "Overflow", - "msg": "Overflow" + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } }, { - "code": 6025, - "name": "Truncation", - "msg": "Truncation" + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "code": 6026, - "name": "DivisionByZero", - "msg": "Division by zero" + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_creator_fee", + "docs": [ + "Collects creator_fee from creator_vault to the coin creator account" + ], + "discriminator": [ + 20, + 22, + 86, + 123, + 198, + 28, + 219, + 132 + ], + "accounts": [ + { + "name": "creator", + "writable": true }, { - "code": 6027, - "name": "NotEnoughRemainingAccounts", - "msg": "Not enough remaining accounts" + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 45, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "creator" + } + ] + } }, { - "code": 6028, - "name": "AllFeeRecipientsShouldBeNonZero", - "msg": "All fee recipients should be non-zero" + "name": "system_program", + "address": "11111111111111111111111111111111" }, { - "code": 6029, - "name": "UnsortedNotUniqueFeeRecipients", - "msg": "Unsorted or not unique fee recipients" + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } }, { - "code": 6030, - "name": "CreatorShouldNotBeZero", - "msg": "Creator should not be zero" + "name": "program" } - ], - "types": [ + ], + "args": [] + }, + { + "name": "create", + "docs": [ + "Creates a new coin and bonding curve." + ], + "discriminator": [ + 24, + 30, + 200, + 40, + 5, + 28, + 7, + 119 + ], + "accounts": [ { - "name": "BondingCurve", - "type": { - "kind": "struct", - "fields": [ - { - "name": "virtual_token_reserves", - "type": "u64" - }, - { - "name": "virtual_sol_reserves", - "type": "u64" - }, - { - "name": "real_token_reserves", - "type": "u64" - }, - { - "name": "real_sol_reserves", - "type": "u64" - }, - { - "name": "token_total_supply", - "type": "u64" - }, - { - "name": "complete", - "type": "bool" - }, - { - "name": "creator", - "type": "pubkey" - } + "name": "mint", + "writable": true, + "signer": true + }, + { + "name": "mint_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 45, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "CollectCreatorFeeEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "creator", - "type": "pubkey" - }, - { - "name": "creator_fee", - "type": "u64" - } + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 ] - } + }, + { + "kind": "account", + "path": "mint" + } + ] + } }, { - "name": "CompleteEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "user", - "type": "pubkey" - }, - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "bonding_curve", - "type": "pubkey" - }, - { - "name": "timestamp", - "type": "i64" - } + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } }, { - "name": "CompletePumpAmmMigrationEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "user", - "type": "pubkey" - }, - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "mint_amount", - "type": "u64" - }, - { - "name": "sol_amount", - "type": "u64" - }, - { - "name": "pool_migration_fee", - "type": "u64" - }, - { - "name": "bonding_curve", - "type": "pubkey" - }, - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "pool", - "type": "pubkey" - } + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 ] - } + } + ] + } }, { - "name": "CreateEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "name", - "type": "string" - }, - { - "name": "symbol", - "type": "string" - }, - { - "name": "uri", - "type": "string" - }, - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "bonding_curve", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "creator", - "type": "pubkey" - }, - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "virtual_token_reserves", - "type": "u64" - }, - { - "name": "virtual_sol_reserves", - "type": "u64" - }, - { - "name": "real_token_reserves", - "type": "u64" - }, - { - "name": "token_total_supply", - "type": "u64" - } + "name": "mpl_token_metadata", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "account", + "path": "mpl_token_metadata" } + } }, { - "name": "ExtendAccountEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "account", - "type": "pubkey" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "current_size", - "type": "u64" - }, - { - "name": "new_size", - "type": "u64" - }, - { - "name": "timestamp", - "type": "i64" - } + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "Global", - "type": { - "kind": "struct", - "fields": [ - { - "name": "initialized", - "docs": ["Unused"], - "type": "bool" - }, - { - "name": "authority", - "type": "pubkey" - }, - { - "name": "fee_recipient", - "type": "pubkey" - }, - { - "name": "initial_virtual_token_reserves", - "type": "u64" - }, - { - "name": "initial_virtual_sol_reserves", - "type": "u64" - }, - { - "name": "initial_real_token_reserves", - "type": "u64" - }, - { - "name": "token_total_supply", - "type": "u64" - }, - { - "name": "fee_basis_points", - "type": "u64" - }, - { - "name": "withdraw_authority", - "type": "pubkey" - }, - { - "name": "enable_migrate", - "docs": ["Unused"], - "type": "bool" - }, - { - "name": "pool_migration_fee", - "type": "u64" - }, - { - "name": "creator_fee_basis_points", - "type": "u64" - }, - { - "name": "fee_recipients", - "type": { - "array": ["pubkey", 7] - } - }, - { - "name": "set_creator_authority", - "type": "pubkey" - } + "name": "program" + } + ], + "args": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + }, + { + "name": "create_v2", + "docs": [ + "Creates a new spl-22 coin and bonding curve." + ], + "discriminator": [ + 214, + 144, + 76, + 236, + 95, + 139, + 49, + 180 + ], + "accounts": [ + { + "name": "mint", + "writable": true, + "signer": true + }, + { + "name": "mint_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 45, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 ] - } + } + ] + } }, { - "name": "SetCreatorEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "bonding_curve", - "type": "pubkey" - }, - { - "name": "creator", - "type": "pubkey" - } + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] } + } }, { - "name": "SetMetaplexCreatorEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "bonding_curve", - "type": "pubkey" - }, - { - "name": "metadata", - "type": "pubkey" - }, - { - "name": "creator", - "type": "pubkey" - } + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 ] - } + } + ] + } }, { - "name": "SetParamsEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "initial_virtual_token_reserves", - "type": "u64" - }, - { - "name": "initial_virtual_sol_reserves", - "type": "u64" - }, - { - "name": "initial_real_token_reserves", - "type": "u64" - }, - { - "name": "final_real_sol_reserves", - "type": "u64" - }, - { - "name": "token_total_supply", - "type": "u64" - }, - { - "name": "fee_basis_points", - "type": "u64" - }, - { - "name": "withdraw_authority", - "type": "pubkey" - }, - { - "name": "enable_migrate", - "type": "bool" - }, - { - "name": "pool_migration_fee", - "type": "u64" - }, - { - "name": "creator_fee_basis_points", - "type": "u64" - }, - { - "name": "fee_recipients", - "type": { - "array": ["pubkey", 8] - } - }, - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "set_creator_authority", - "type": "pubkey" - } + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "mayhem_program_id", + "writable": true, + "address": "MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e" + }, + { + "name": "global_params", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 45, + 112, + 97, + 114, + 97, + 109, + 115 ] + } + ], + "program": { + "kind": "const", + "value": [ + 5, + 42, + 229, + 215, + 167, + 218, + 167, + 36, + 166, + 234, + 176, + 167, + 41, + 84, + 145, + 133, + 90, + 212, + 160, + 103, + 22, + 96, + 103, + 76, + 78, + 3, + 69, + 89, + 128, + 61, + 101, + 163 + ] } + } }, { - "name": "TradeEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "mint", - "type": "pubkey" - }, - { - "name": "sol_amount", - "type": "u64" - }, - { - "name": "token_amount", - "type": "u64" - }, - { - "name": "is_buy", - "type": "bool" - }, - { - "name": "user", - "type": "pubkey" - }, - { - "name": "timestamp", - "type": "i64" - }, - { - "name": "virtual_sol_reserves", - "type": "u64" - }, - { - "name": "virtual_token_reserves", - "type": "u64" - }, - { - "name": "real_sol_reserves", - "type": "u64" - }, - { - "name": "real_token_reserves", - "type": "u64" - }, - { - "name": "fee_recipient", - "type": "pubkey" - }, - { - "name": "fee_basis_points", - "type": "u64" - }, - { - "name": "fee", - "type": "u64" - }, - { - "name": "creator", - "type": "pubkey" - }, - { - "name": "creator_fee_basis_points", - "type": "u64" - }, - { - "name": "creator_fee", - "type": "u64" - } + "name": "sol_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 115, + 111, + 108, + 45, + 118, + 97, + 117, + 108, + 116 ] + } + ], + "program": { + "kind": "const", + "value": [ + 5, + 42, + 229, + 215, + 167, + 218, + 167, + 36, + 166, + 234, + 176, + 167, + 41, + 84, + 145, + 133, + 90, + 212, + 160, + 103, + 22, + 96, + 103, + 76, + 78, + 3, + 69, + 89, + 128, + 61, + 101, + 163 + ] } + } }, { - "name": "UpdateGlobalAuthorityEvent", - "type": { - "kind": "struct", - "fields": [ - { - "name": "global", - "type": "pubkey" - }, - { - "name": "authority", - "type": "pubkey" - }, - { - "name": "new_authority", - "type": "pubkey" - }, - { - "name": "timestamp", - "type": "i64" - } + "name": "mayhem_state", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 97, + 121, + 104, + 101, + 109, + 45, + 115, + 116, + 97, + 116, + 101 ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 5, + 42, + 229, + 215, + 167, + 218, + 167, + 36, + 166, + 234, + 176, + 167, + 41, + 84, + 145, + 133, + 90, + 212, + 160, + 103, + 22, + 96, + 103, + 76, + 78, + 3, + 69, + 89, + 128, + 61, + 101, + 163 + ] } - } - ] -} + } + }, + { + "name": "mayhem_token_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "sol_vault" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + }, + { + "name": "extend_account", + "docs": [ + "Extends the size of program-owned accounts" + ], + "discriminator": [ + 234, + 102, + 194, + 203, + 150, + 72, + 62, + 229 + ], + "accounts": [ + { + "name": "account", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "init_user_volume_accumulator", + "discriminator": [ + 94, + 6, + 202, + 115, + 255, + 96, + 232, + 183 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "user" + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize", + "docs": [ + "Creates the global state." + ], + "discriminator": [ + 175, + 175, + 109, + 31, + 13, + 152, + 155, + 237 + ], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "migrate", + "docs": [ + "Migrates liquidity to pump_amm if the bonding curve is complete" + ], + "discriminator": [ + 155, + 234, + 231, + 146, + 236, + 158, + 162, + 30 + ], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "withdraw_authority", + "writable": true, + "relations": [ + "global" + ] + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "pump_amm", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "pool", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "const", + "value": [ + 0, + 0 + ] + }, + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "wsol_mint" + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "pool_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 45, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "pool_authority_mint_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_authority_wsol_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "wsol_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "amm_global_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "wsol_mint", + "address": "So11111111111111111111111111111111111111112" + }, + { + "name": "lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 108, + 112, + 95, + 109, + 105, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "user_pool_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "token_2022_program" + }, + { + "kind": "account", + "path": "lp_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_base_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "wsol_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "pump_amm_event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "sell", + "docs": [ + "Sells tokens into a bonding curve." + ], + "discriminator": [ + 51, + 230, + 133, + 164, + 1, + 127, + 131, + 173 + ], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "associated_user", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 45, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "bonding_curve.creator", + "account": "BondingCurve" + } + ] + } + }, + { + "name": "token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 1, + 86, + 224, + 246, + 147, + 102, + 90, + 207, + 68, + 219, + 21, + 104, + 191, + 23, + 91, + 170, + 81, + 137, + 203, + 151, + 245, + 210, + 255, + 59, + 101, + 93, + 43, + 182, + 253, + 109, + 24, + 176 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "min_sol_output", + "type": "u64" + } + ] + }, + { + "name": "set_creator", + "docs": [ + "Allows Global::set_creator_authority to set the bonding curve creator from Metaplex metadata or input argument" + ], + "discriminator": [ + 254, + 148, + 255, + 112, + 207, + 142, + 170, + 165 + ], + "accounts": [ + { + "name": "set_creator_authority", + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "metadata", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "creator", + "type": "pubkey" + } + ] + }, + { + "name": "set_metaplex_creator", + "docs": [ + "Syncs the bonding curve creator with the Metaplex metadata creator if it exists" + ], + "discriminator": [ + 138, + 96, + 174, + 217, + 48, + 85, + 197, + 246 + ], + "accounts": [ + { + "name": "mint" + }, + { + "name": "metadata", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_params", + "docs": [ + "Sets the global state parameters." + ], + "discriminator": [ + 27, + 234, + 178, + 52, + 147, + 2, + 187, + 141 + ], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "initial_virtual_token_reserves", + "type": "u64" + }, + { + "name": "initial_virtual_sol_reserves", + "type": "u64" + }, + { + "name": "initial_real_token_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "withdraw_authority", + "type": "pubkey" + }, + { + "name": "enable_migrate", + "type": "bool" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "set_creator_authority", + "type": "pubkey" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + } + ] + }, + { + "name": "set_reserved_fee_recipients", + "discriminator": [ + 111, + 172, + 162, + 232, + 114, + 89, + 213, + 142 + ], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "authority", + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "whitelist_pda", + "type": "pubkey" + } + ] + }, + { + "name": "sync_user_volume_accumulator", + "discriminator": [ + 86, + 31, + 192, + 87, + 163, + 87, + 79, + 238 + ], + "accounts": [ + { + "name": "user" + }, + { + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, + 115, + 101, + 114, + 95, + 118, + 111, + 108, + 117, + 109, + 101, + 95, + 97, + 99, + 99, + 117, + 109, + 117, + 108, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "toggle_create_v2", + "discriminator": [ + 28, + 255, + 230, + 240, + 172, + 107, + 203, + 171 + ], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "toggle_mayhem_mode", + "discriminator": [ + 1, + 9, + 111, + 208, + 100, + 31, + 255, + 163 + ], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "update_global_authority", + "discriminator": [ + 227, + 181, + 74, + 196, + 208, + 21, + 97, + 213 + ], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "authority", + "signer": true, + "relations": [ + "global" + ] + }, + { + "name": "new_authority" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "BondingCurve", + "discriminator": [ + 23, + 183, + 248, + 55, + 96, + 216, + 172, + 96 + ] + }, + { + "name": "FeeConfig", + "discriminator": [ + 143, + 52, + 146, + 187, + 219, + 123, + 76, + 155 + ] + }, + { + "name": "Global", + "discriminator": [ + 167, + 232, + 232, + 177, + 200, + 108, + 114, + 127 + ] + }, + { + "name": "GlobalVolumeAccumulator", + "discriminator": [ + 202, + 42, + 246, + 43, + 142, + 190, + 30, + 255 + ] + }, + { + "name": "UserVolumeAccumulator", + "discriminator": [ + 86, + 255, + 112, + 14, + 102, + 53, + 154, + 250 + ] + } + ], + "events": [ + { + "name": "AdminSetCreatorEvent", + "discriminator": [ + 64, + 69, + 192, + 104, + 29, + 30, + 25, + 107 + ] + }, + { + "name": "AdminSetIdlAuthorityEvent", + "discriminator": [ + 245, + 59, + 70, + 34, + 75, + 185, + 109, + 92 + ] + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "discriminator": [ + 147, + 250, + 108, + 120, + 247, + 29, + 67, + 222 + ] + }, + { + "name": "ClaimTokenIncentivesEvent", + "discriminator": [ + 79, + 172, + 246, + 49, + 205, + 91, + 206, + 232 + ] + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "discriminator": [ + 146, + 159, + 189, + 172, + 146, + 88, + 56, + 244 + ] + }, + { + "name": "CollectCreatorFeeEvent", + "discriminator": [ + 122, + 2, + 127, + 1, + 14, + 191, + 12, + 175 + ] + }, + { + "name": "CompleteEvent", + "discriminator": [ + 95, + 114, + 97, + 156, + 212, + 46, + 152, + 8 + ] + }, + { + "name": "CompletePumpAmmMigrationEvent", + "discriminator": [ + 189, + 233, + 93, + 185, + 92, + 148, + 234, + 148 + ] + }, + { + "name": "CreateEvent", + "discriminator": [ + 27, + 114, + 169, + 77, + 222, + 235, + 99, + 118 + ] + }, + { + "name": "ExtendAccountEvent", + "discriminator": [ + 97, + 97, + 215, + 144, + 93, + 146, + 22, + 124 + ] + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "discriminator": [ + 134, + 36, + 13, + 72, + 232, + 101, + 130, + 216 + ] + }, + { + "name": "ReservedFeeRecipientsEvent", + "discriminator": [ + 43, + 188, + 250, + 18, + 221, + 75, + 187, + 95 + ] + }, + { + "name": "SetCreatorEvent", + "discriminator": [ + 237, + 52, + 123, + 37, + 245, + 251, + 72, + 210 + ] + }, + { + "name": "SetMetaplexCreatorEvent", + "discriminator": [ + 142, + 203, + 6, + 32, + 127, + 105, + 191, + 162 + ] + }, + { + "name": "SetParamsEvent", + "discriminator": [ + 223, + 195, + 159, + 246, + 62, + 48, + 143, + 131 + ] + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "discriminator": [ + 197, + 122, + 167, + 124, + 116, + 81, + 91, + 255 + ] + }, + { + "name": "TradeEvent", + "discriminator": [ + 189, + 219, + 127, + 211, + 78, + 230, + 97, + 238 + ] + }, + { + "name": "UpdateGlobalAuthorityEvent", + "discriminator": [ + 182, + 195, + 137, + 42, + 35, + 206, + 207, + 247 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "NotAuthorized", + "msg": "The given account is not authorized to execute this instruction." + }, + { + "code": 6001, + "name": "AlreadyInitialized", + "msg": "The program is already initialized." + }, + { + "code": 6002, + "name": "TooMuchSolRequired", + "msg": "slippage: Too much SOL required to buy the given amount of tokens." + }, + { + "code": 6003, + "name": "TooLittleSolReceived", + "msg": "slippage: Too little SOL received to sell the given amount of tokens." + }, + { + "code": 6004, + "name": "MintDoesNotMatchBondingCurve", + "msg": "The mint does not match the bonding curve." + }, + { + "code": 6005, + "name": "BondingCurveComplete", + "msg": "The bonding curve has completed and liquidity migrated to raydium." + }, + { + "code": 6006, + "name": "BondingCurveNotComplete", + "msg": "The bonding curve has not completed." + }, + { + "code": 6007, + "name": "NotInitialized", + "msg": "The program is not initialized." + }, + { + "code": 6008, + "name": "WithdrawTooFrequent", + "msg": "Withdraw too frequent" + }, + { + "code": 6009, + "name": "NewSizeShouldBeGreaterThanCurrentSize", + "msg": "new_size should be > current_size" + }, + { + "code": 6010, + "name": "AccountTypeNotSupported", + "msg": "Account type not supported" + }, + { + "code": 6011, + "name": "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply", + "msg": "initial_real_token_reserves should be less than token_total_supply" + }, + { + "code": 6012, + "name": "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves", + "msg": "initial_virtual_token_reserves should be greater than initial_real_token_reserves" + }, + { + "code": 6013, + "name": "FeeBasisPointsGreaterThanMaximum", + "msg": "fee_basis_points greater than maximum" + }, + { + "code": 6014, + "name": "AllZerosWithdrawAuthority", + "msg": "Withdraw authority cannot be set to System Program ID" + }, + { + "code": 6015, + "name": "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves", + "msg": "pool_migration_fee should be less than final_real_sol_reserves" + }, + { + "code": 6016, + "name": "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees", + "msg": "pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES" + }, + { + "code": 6017, + "name": "DisabledWithdraw", + "msg": "Migrate instruction is disabled" + }, + { + "code": 6018, + "name": "DisabledMigrate", + "msg": "Migrate instruction is disabled" + }, + { + "code": 6019, + "name": "InvalidCreator", + "msg": "Invalid creator pubkey" + }, + { + "code": 6020, + "name": "BuyZeroAmount", + "msg": "Buy zero amount" + }, + { + "code": 6021, + "name": "NotEnoughTokensToBuy", + "msg": "Not enough tokens to buy" + }, + { + "code": 6022, + "name": "SellZeroAmount", + "msg": "Sell zero amount" + }, + { + "code": 6023, + "name": "NotEnoughTokensToSell", + "msg": "Not enough tokens to sell" + }, + { + "code": 6024, + "name": "Overflow", + "msg": "Overflow" + }, + { + "code": 6025, + "name": "Truncation", + "msg": "Truncation" + }, + { + "code": 6026, + "name": "DivisionByZero", + "msg": "Division by zero" + }, + { + "code": 6027, + "name": "NotEnoughRemainingAccounts", + "msg": "Not enough remaining accounts" + }, + { + "code": 6028, + "name": "AllFeeRecipientsShouldBeNonZero", + "msg": "All fee recipients should be non-zero" + }, + { + "code": 6029, + "name": "UnsortedNotUniqueFeeRecipients", + "msg": "Unsorted or not unique fee recipients" + }, + { + "code": 6030, + "name": "CreatorShouldNotBeZero", + "msg": "Creator should not be zero" + }, + { + "code": 6031, + "name": "StartTimeInThePast" + }, + { + "code": 6032, + "name": "EndTimeInThePast" + }, + { + "code": 6033, + "name": "EndTimeBeforeStartTime" + }, + { + "code": 6034, + "name": "TimeRangeTooLarge" + }, + { + "code": 6035, + "name": "EndTimeBeforeCurrentDay" + }, + { + "code": 6036, + "name": "SupplyUpdateForFinishedRange" + }, + { + "code": 6037, + "name": "DayIndexAfterEndIndex" + }, + { + "code": 6038, + "name": "DayInActiveRange" + }, + { + "code": 6039, + "name": "InvalidIncentiveMint" + }, + { + "code": 6040, + "name": "BuyNotEnoughSolToCoverRent", + "msg": "Buy: Not enough SOL to cover for rent exemption." + }, + { + "code": 6041, + "name": "BuyNotEnoughSolToCoverFees", + "msg": "Buy: Not enough SOL to cover for fees." + }, + { + "code": 6042, + "name": "BuySlippageBelowMinTokensOut", + "msg": "Slippage: Would buy less tokens than expected min_tokens_out" + }, + { + "code": 6043, + "name": "NameTooLong" + }, + { + "code": 6044, + "name": "SymbolTooLong" + }, + { + "code": 6045, + "name": "UriTooLong" + }, + { + "code": 6046, + "name": "CreateV2Disabled" + }, + { + "code": 6047, + "name": "CpitializeMayhemFailed" + }, + { + "code": 6048, + "name": "MayhemModeDisabled" + } + ], + "types": [ + { + "name": "AdminSetCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "old_creator", + "type": "pubkey" + }, + { + "name": "new_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminSetIdlAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "idl_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "day_number", + "type": "u64" + }, + { + "name": "token_supply_per_day", + "type": "u64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "BondingCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "real_sol_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "complete", + "type": "bool" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "ClaimTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + } + ] + } + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "CollectCreatorFeeEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "creator_fee", + "type": "u64" + } + ] + } + }, + { + "name": "CompleteEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "CompletePumpAmmMigrationEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "mint_amount", + "type": "u64" + }, + { + "name": "sol_amount", + "type": "u64" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "pool", + "type": "pubkey" + } + ] + } + }, + { + "name": "CreateEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "token_program", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "ExtendAccountEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "account", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "current_size", + "type": "u64" + }, + { + "name": "new_size", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "FeeConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "flat_fees", + "type": { + "defined": { + "name": "Fees" + } + } + }, + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + } + ] + } + }, + { + "name": "FeeTier", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market_cap_lamports_threshold", + "type": "u128" + }, + { + "name": "fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_fee_bps", + "type": "u64" + }, + { + "name": "protocol_fee_bps", + "type": "u64" + }, + { + "name": "creator_fee_bps", + "type": "u64" + } + ] + } + }, + { + "name": "Global", + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "docs": [ + "Unused" + ], + "type": "bool" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "fee_recipient", + "type": "pubkey" + }, + { + "name": "initial_virtual_token_reserves", + "type": "u64" + }, + { + "name": "initial_virtual_sol_reserves", + "type": "u64" + }, + { + "name": "initial_real_token_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "withdraw_authority", + "type": "pubkey" + }, + { + "name": "enable_migrate", + "docs": [ + "Unused" + ], + "type": "bool" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "fee_recipients", + "type": { + "array": [ + "pubkey", + 7 + ] + } + }, + { + "name": "set_creator_authority", + "type": "pubkey" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + }, + { + "name": "create_v2_enabled", + "type": "bool" + }, + { + "name": "whitelist_pda", + "type": "pubkey" + }, + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "mayhem_mode_enabled", + "type": "bool" + }, + { + "name": "reserved_fee_recipients", + "type": { + "array": [ + "pubkey", + 7 + ] + } + } + ] + } + }, + { + "name": "GlobalVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "total_token_supply", + "type": { + "array": [ + "u64", + 30 + ] + } + }, + { + "name": "sol_volumes", + "type": { + "array": [ + "u64", + 30 + ] + } + } + ] + } + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "payer", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "ReservedFeeRecipientsEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "reserved_fee_recipients", + "type": { + "array": [ + "pubkey", + 7 + ] + } + } + ] + } + }, + { + "name": "SetCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetMetaplexCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "metadata", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetParamsEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "initial_virtual_token_reserves", + "type": "u64" + }, + { + "name": "initial_virtual_sol_reserves", + "type": "u64" + }, + { + "name": "initial_real_token_reserves", + "type": "u64" + }, + { + "name": "final_real_sol_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "withdraw_authority", + "type": "pubkey" + }, + { + "name": "enable_migrate", + "type": "bool" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "fee_recipients", + "type": { + "array": [ + "pubkey", + 8 + ] + } + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "set_creator_authority", + "type": "pubkey" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "total_claimed_tokens_before", + "type": "u64" + }, + { + "name": "total_claimed_tokens_after", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "TradeEvent", + "docs": [ + "ix_name: \"buy\" | \"sell\" | \"buy_exact_sol_in\"" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "sol_amount", + "type": "u64" + }, + { + "name": "token_amount", + "type": "u64" + }, + { + "name": "is_buy", + "type": "bool" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "real_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "fee_recipient", + "type": "pubkey" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "fee", + "type": "u64" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "creator_fee", + "type": "u64" + }, + { + "name": "track_volume", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "ix_name", + "type": "string" + } + ] + } + }, + { + "name": "UpdateGlobalAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "global", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "UserVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "needs_claim", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "has_total_claimed_tokens", + "type": "bool" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/crates/pumpfun-parser/package.json b/crates/pumpfun-parser/package.json new file mode 100644 index 00000000..2cc031bb --- /dev/null +++ b/crates/pumpfun-parser/package.json @@ -0,0 +1,23 @@ +{ + "name": "pumpfun-parser", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "packageManager": "pnpm@10.17.0", + "devDependencies": { + "@types/node": "^24.10.0", + "tsx": "^4.20.6", + "typescript": "^5.9.3" + }, + "dependencies": { + "@codama/nodes-from-anchor": "^1.2.9", + "@codama/renderers-js": "^1.4.3", + "@codama/renderers-rust": "^1.2.7" + } +} diff --git a/crates/pumpfun-parser/proto/pumpfun.proto b/crates/pumpfun-parser/proto/pumpfun.proto index 7c73a067..7349345d 100644 --- a/crates/pumpfun-parser/proto/pumpfun.proto +++ b/crates/pumpfun-parser/proto/pumpfun.proto @@ -8,11 +8,39 @@ syntax = "proto3"; package vixen.parser.pumpfun; +message AdminSetCreatorIx { + AdminSetCreatorIxAccounts accounts = 1; + AdminSetCreatorIxData data = 2; +} + +message AdminSetIdlAuthorityIx { + AdminSetIdlAuthorityIxAccounts accounts = 1; + AdminSetIdlAuthorityIxData data = 2; +} + +message AdminUpdateTokenIncentivesIx { + AdminUpdateTokenIncentivesIxAccounts accounts = 1; + AdminUpdateTokenIncentivesIxData data = 2; +} + message BuyIx { BuyIxAccounts accounts = 1; BuyIxData data = 2; } +message BuyExactSolInIx { + BuyExactSolInIxAccounts accounts = 1; + BuyExactSolInIxData data = 2; +} + +message ClaimTokenIncentivesIx { + ClaimTokenIncentivesIxAccounts accounts = 1; +} + +message CloseUserVolumeAccumulatorIx { + CloseUserVolumeAccumulatorIxAccounts accounts = 1; +} + message CollectCreatorFeeIx { CollectCreatorFeeIxAccounts accounts = 1; } @@ -22,10 +50,19 @@ message CreateIx { CreateIxData data = 2; } +message CreateV2Ix { + CreateV2IxAccounts accounts = 1; + CreateV2IxData data = 2; +} + message ExtendAccountIx { ExtendAccountIxAccounts accounts = 1; } +message InitUserVolumeAccumulatorIx { + InitUserVolumeAccumulatorIxAccounts accounts = 1; +} + message InitializeIx { InitializeIxAccounts accounts = 1; } @@ -53,11 +90,71 @@ message SetParamsIx { SetParamsIxData data = 2; } +message SetReservedFeeRecipientsIx { + SetReservedFeeRecipientsIxAccounts accounts = 1; + SetReservedFeeRecipientsIxData data = 2; +} + +message SyncUserVolumeAccumulatorIx { + SyncUserVolumeAccumulatorIxAccounts accounts = 1; +} + +message ToggleCreateV2Ix { + ToggleCreateV2IxAccounts accounts = 1; + ToggleCreateV2IxData data = 2; +} + +message ToggleMayhemModeIx { + ToggleMayhemModeIxAccounts accounts = 1; + ToggleMayhemModeIxData data = 2; +} + message UpdateGlobalAuthorityIx { UpdateGlobalAuthorityIxAccounts accounts = 1; } +message AdminSetCreatorEvent { + int64 timestamp = 1; + string admin_set_creator_authority = 2; + string mint = 3; + string bonding_curve = 4; + string old_creator = 5; + string new_creator = 6; +} + +message AdminSetIdlAuthorityEvent { + string idl_authority = 1; +} + +message AdminUpdateTokenIncentivesEvent { + int64 start_time = 1; + int64 end_time = 2; + uint64 day_number = 3; + uint64 token_supply_per_day = 4; + string mint = 5; + int64 seconds_in_a_day = 6; + int64 timestamp = 7; +} + +message ClaimTokenIncentivesEvent { + string user = 1; + string mint = 2; + uint64 amount = 3; + int64 timestamp = 4; + uint64 total_claimed_tokens = 5; + uint64 current_sol_volume = 6; +} + +message CloseUserVolumeAccumulatorEvent { + string user = 1; + int64 timestamp = 2; + uint64 total_unclaimed_tokens = 3; + uint64 total_claimed_tokens = 4; + uint64 current_sol_volume = 5; + int64 last_update_timestamp = 6; +} + message CollectCreatorFeeEvent { int64 timestamp = 1; string creator = 2; @@ -95,6 +192,8 @@ message CreateEvent { uint64 virtual_sol_reserves = 10; uint64 real_token_reserves = 11; uint64 token_total_supply = 12; + string token_program = 13; + bool is_mayhem_mode = 14; } message ExtendAccountEvent { @@ -105,6 +204,29 @@ message ExtendAccountEvent { int64 timestamp = 5; } +message FeeTier { + string market_cap_lamports_threshold = 1; + Fees fees = 2; +} + +message Fees { + uint64 lp_fee_bps = 1; + uint64 protocol_fee_bps = 2; + uint64 creator_fee_bps = 3; +} + +message InitUserVolumeAccumulatorEvent { + string payer = 1; + string user = 2; + int64 timestamp = 3; +} + +message ReservedFeeRecipientsEvent { + int64 timestamp = 1; + string reserved_fee_recipient = 2; + repeated string reserved_fee_recipients = 3; +} + message SetCreatorEvent { int64 timestamp = 1; string mint = 2; @@ -134,6 +256,14 @@ message SetParamsEvent { repeated string fee_recipients = 11; int64 timestamp = 12; string set_creator_authority = 13; + string admin_set_creator_authority = 14; +} + +message SyncUserVolumeAccumulatorEvent { + string user = 1; + uint64 total_claimed_tokens_before = 2; + uint64 total_claimed_tokens_after = 3; + int64 timestamp = 4; } message TradeEvent { @@ -153,6 +283,12 @@ message TradeEvent { string creator = 14; uint64 creator_fee_basis_points = 15; uint64 creator_fee = 16; + bool track_volume = 17; + uint64 total_unclaimed_tokens = 18; + uint64 total_claimed_tokens = 19; + uint64 current_sol_volume = 20; + int64 last_update_timestamp = 21; + string ix_name = 22; } message UpdateGlobalAuthorityEvent { @@ -171,6 +307,14 @@ message BondingCurve { uint64 token_total_supply = 5; bool complete = 6; string creator = 7; + bool is_mayhem_mode = 8; +} + +message FeeConfig { + uint32 bump = 1; + string admin = 2; + Fees flat_fees = 3; + repeated FeeTier fee_tiers = 4; } message Global { @@ -188,8 +332,81 @@ message Global { uint64 creator_fee_basis_points = 12; repeated string fee_recipients = 13; string set_creator_authority = 14; + string admin_set_creator_authority = 15; + bool create_v2_enabled = 16; + string whitelist_pda = 17; + string reserved_fee_recipient = 18; + bool mayhem_mode_enabled = 19; + repeated string reserved_fee_recipients = 20; +} + +message GlobalVolumeAccumulator { + int64 start_time = 1; + int64 end_time = 2; + int64 seconds_in_a_day = 3; + string mint = 4; + repeated uint64 total_token_supply = 5; + repeated uint64 sol_volumes = 6; +} + +message UserVolumeAccumulator { + string user = 1; + bool needs_claim = 2; + uint64 total_unclaimed_tokens = 3; + uint64 total_claimed_tokens = 4; + uint64 current_sol_volume = 5; + int64 last_update_timestamp = 6; + bool has_total_claimed_tokens = 7; +} + + +message AdminSetCreatorIxAccounts { + string admin_set_creator_authority = 1; + string global = 2; + string mint = 3; + string bonding_curve = 4; + string event_authority = 5; + string program = 6; +} + +message AdminSetCreatorIxData { + string creator = 1; +} + +message AdminSetIdlAuthorityIxAccounts { + string authority = 1; + string global = 2; + string idl_account = 3; + string system_program = 4; + string program_signer = 5; + string event_authority = 6; + string program = 7; +} + +message AdminSetIdlAuthorityIxData { + string idl_authority = 1; +} + +message AdminUpdateTokenIncentivesIxAccounts { + string authority = 1; + string global = 2; + string global_volume_accumulator = 3; + string mint = 4; + string global_incentive_token_account = 5; + string associated_token_program = 6; + string system_program = 7; + string token_program = 8; + string event_authority = 9; + string program = 10; } +message AdminUpdateTokenIncentivesIxData { + int64 start_time = 1; + int64 end_time = 2; + int64 seconds_in_a_day = 3; + uint64 day_number = 4; + uint64 pump_token_supply_per_day = 5; +} message BuyIxAccounts { string global = 1; @@ -204,6 +421,10 @@ message BuyIxAccounts { string creator_vault = 10; string event_authority = 11; string program = 12; + string global_volume_accumulator = 13; + string user_volume_accumulator = 14; + string fee_config = 15; + string fee_program = 16; } message BuyIxData { @@ -211,6 +432,54 @@ message BuyIxData { uint64 max_sol_cost = 2; } +message BuyExactSolInIxAccounts { + string global = 1; + string fee_recipient = 2; + string mint = 3; + string bonding_curve = 4; + string associated_bonding_curve = 5; + string associated_user = 6; + string user = 7; + string system_program = 8; + string token_program = 9; + string creator_vault = 10; + string event_authority = 11; + string program = 12; + string global_volume_accumulator = 13; + string user_volume_accumulator = 14; + string fee_config = 15; + string fee_program = 16; +} + +message BuyExactSolInIxData { + uint64 spendable_sol_in = 1; + uint64 min_tokens_out = 2; +} + +message ClaimTokenIncentivesIxAccounts { + string user = 1; + string user_ata = 2; + string global_volume_accumulator = 3; + string global_incentive_token_account = 4; + string user_volume_accumulator = 5; + string mint = 6; + string token_program = 7; + string system_program = 8; + string associated_token_program = 9; + string event_authority = 10; + string program = 11; + string payer = 12; +} + + +message CloseUserVolumeAccumulatorIxAccounts { + string user = 1; + string user_volume_accumulator = 2; + string event_authority = 3; + string program = 4; +} + + message CollectCreatorFeeIxAccounts { string creator = 1; string creator_vault = 2; @@ -244,6 +513,33 @@ message CreateIxData { string creator = 4; } +message CreateV2IxAccounts { + string mint = 1; + string mint_authority = 2; + string bonding_curve = 3; + string associated_bonding_curve = 4; + string global = 5; + string user = 6; + string system_program = 7; + string token_program = 8; + string associated_token_program = 9; + string mayhem_program_id = 10; + string global_params = 11; + string sol_vault = 12; + string mayhem_state = 13; + string mayhem_token_vault = 14; + string event_authority = 15; + string program = 16; +} + +message CreateV2IxData { + string name = 1; + string symbol = 2; + string uri = 3; + string creator = 4; + bool is_mayhem_mode = 5; +} + message ExtendAccountIxAccounts { string account = 1; string user = 2; @@ -253,6 +549,16 @@ message ExtendAccountIxAccounts { } +message InitUserVolumeAccumulatorIxAccounts { + string payer = 1; + string user = 2; + string user_volume_accumulator = 3; + string system_program = 4; + string event_authority = 5; + string program = 6; +} + + message InitializeIxAccounts { string global = 1; string user = 2; @@ -301,6 +607,8 @@ message SellIxAccounts { string token_program = 10; string event_authority = 11; string program = 12; + string fee_config = 13; + string fee_program = 14; } message SellIxData { @@ -349,6 +657,49 @@ message SetParamsIxData { uint64 pool_migration_fee = 8; uint64 creator_fee_basis_points = 9; string set_creator_authority = 10; + string admin_set_creator_authority = 11; +} + +message SetReservedFeeRecipientsIxAccounts { + string global = 1; + string authority = 2; + string event_authority = 3; + string program = 4; +} + +message SetReservedFeeRecipientsIxData { + string whitelist_pda = 1; +} + +message SyncUserVolumeAccumulatorIxAccounts { + string user = 1; + string global_volume_accumulator = 2; + string user_volume_accumulator = 3; + string event_authority = 4; + string program = 5; +} + + +message ToggleCreateV2IxAccounts { + string global = 1; + string authority = 2; + string event_authority = 3; + string program = 4; +} + +message ToggleCreateV2IxData { + bool enabled = 1; +} + +message ToggleMayhemModeIxAccounts { + string global = 1; + string authority = 2; + string event_authority = 3; + string program = 4; +} + +message ToggleMayhemModeIxData { + bool enabled = 1; } message UpdateGlobalAuthorityIxAccounts { @@ -364,23 +715,38 @@ message UpdateGlobalAuthorityIxAccounts { message ProgramState { oneof state_oneof { BondingCurve bonding_curve = 1; - Global global = 2; + FeeConfig fee_config = 2; + Global global = 3; + GlobalVolumeAccumulator global_volume_accumulator = 4; + UserVolumeAccumulator user_volume_accumulator = 5; } } message ProgramIxs { oneof ix_oneof { - BuyIx buy = 1; - CollectCreatorFeeIx collect_creator_fee = 2; - CreateIx create = 3; - ExtendAccountIx extend_account = 4; - InitializeIx initialize = 5; - MigrateIx migrate = 6; - SellIx sell = 7; - SetCreatorIx set_creator = 8; - SetMetaplexCreatorIx set_metaplex_creator = 9; - SetParamsIx set_params = 10; - UpdateGlobalAuthorityIx update_global_authority = 11; + AdminSetCreatorIx admin_set_creator = 1; + AdminSetIdlAuthorityIx admin_set_idl_authority = 2; + AdminUpdateTokenIncentivesIx admin_update_token_incentives = 3; + BuyIx buy = 4; + BuyExactSolInIx buy_exact_sol_in = 5; + ClaimTokenIncentivesIx claim_token_incentives = 6; + CloseUserVolumeAccumulatorIx close_user_volume_accumulator = 7; + CollectCreatorFeeIx collect_creator_fee = 8; + CreateIx create = 9; + CreateV2Ix create_v2 = 10; + ExtendAccountIx extend_account = 11; + InitUserVolumeAccumulatorIx init_user_volume_accumulator = 12; + InitializeIx initialize = 13; + MigrateIx migrate = 14; + SellIx sell = 15; + SetCreatorIx set_creator = 16; + SetMetaplexCreatorIx set_metaplex_creator = 17; + SetParamsIx set_params = 18; + SetReservedFeeRecipientsIx set_reserved_fee_recipients = 19; + SyncUserVolumeAccumulatorIx sync_user_volume_accumulator = 20; + ToggleCreateV2Ix toggle_create_v2 = 21; + ToggleMayhemModeIx toggle_mayhem_mode = 22; + UpdateGlobalAuthorityIx update_global_authority = 23; } } diff --git a/crates/pumpfun-parser/src/generated_parser/accounts_parser.rs b/crates/pumpfun-parser/src/generated_parser/accounts_parser.rs index 2fec6f5b..ec3db28a 100644 --- a/crates/pumpfun-parser/src/generated_parser/accounts_parser.rs +++ b/crates/pumpfun-parser/src/generated_parser/accounts_parser.rs @@ -5,10 +5,14 @@ //! //! -use crate::{ - accounts::{BondingCurve, Global}, - deserialize_checked, ID, -}; +use crate::accounts::BondingCurve; +use crate::accounts::FeeConfig; +use crate::accounts::Global; +use crate::accounts::GlobalVolumeAccumulator; +use crate::accounts::UserVolumeAccumulator; +use crate::ID; + +use crate::deserialize_checked; /// Pump Program State #[allow(clippy::large_enum_variant)] @@ -16,7 +20,10 @@ use crate::{ #[cfg_attr(feature = "tracing", derive(strum_macros::Display))] pub enum PumpProgramState { BondingCurve(BondingCurve), + FeeConfig(FeeConfig), Global(Global), + GlobalVolumeAccumulator(GlobalVolumeAccumulator), + UserVolumeAccumulator(UserVolumeAccumulator), } impl PumpProgramState { @@ -26,9 +33,18 @@ impl PumpProgramState { [23, 183, 248, 55, 96, 216, 172, 96] => Ok(PumpProgramState::BondingCurve( deserialize_checked(data_bytes, &acc_discriminator)?, )), + [143, 52, 146, 187, 219, 123, 76, 155] => Ok(PumpProgramState::FeeConfig( + deserialize_checked(data_bytes, &acc_discriminator)?, + )), [167, 232, 232, 177, 200, 108, 114, 127] => Ok(PumpProgramState::Global( deserialize_checked(data_bytes, &acc_discriminator)?, )), + [202, 42, 246, 43, 142, 190, 30, 255] => Ok(PumpProgramState::GlobalVolumeAccumulator( + deserialize_checked(data_bytes, &acc_discriminator)?, + )), + [86, 255, 112, 14, 102, 53, 154, 250] => Ok(PumpProgramState::UserVolumeAccumulator( + deserialize_checked(data_bytes, &acc_discriminator)?, + )), _ => Err(yellowstone_vixen_core::ParseError::from( "Invalid Account discriminator".to_owned(), )), @@ -67,7 +83,9 @@ impl yellowstone_vixen_core::Parser for AccountParser { type Input = yellowstone_vixen_core::AccountUpdate; type Output = PumpProgramState; - fn id(&self) -> std::borrow::Cow<'static, str> { "pump::AccountParser".into() } + fn id(&self) -> std::borrow::Cow<'static, str> { + "pump::AccountParser".into() + } fn prefilter(&self) -> yellowstone_vixen_core::Prefilter { yellowstone_vixen_core::Prefilter::builder() @@ -105,15 +123,18 @@ impl yellowstone_vixen_core::Parser for AccountParser { impl yellowstone_vixen_core::ProgramParser for AccountParser { #[inline] - fn program_id(&self) -> yellowstone_vixen_core::Pubkey { ID.to_bytes().into() } + fn program_id(&self) -> yellowstone_vixen_core::Pubkey { + ID.to_bytes().into() + } } // #[cfg(feature = "proto")] mod proto_parser { + use super::{AccountParser, PumpProgramState}; + use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; use yellowstone_vixen_core::proto::ParseProto; - use super::{AccountParser, BondingCurve, PumpProgramState}; - use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; + use super::BondingCurve; impl IntoProto for BondingCurve { fn into_proto(self) -> proto_def::BondingCurve { proto_def::BondingCurve { @@ -124,6 +145,18 @@ mod proto_parser { token_total_supply: self.token_total_supply, complete: self.complete, creator: self.creator.to_string(), + is_mayhem_mode: self.is_mayhem_mode, + } + } + } + use super::FeeConfig; + impl IntoProto for FeeConfig { + fn into_proto(self) -> proto_def::FeeConfig { + proto_def::FeeConfig { + bump: self.bump.into(), + admin: self.admin.to_string(), + flat_fees: Some(self.flat_fees.into_proto()), + fee_tiers: self.fee_tiers.into_iter().map(|x| x.into_proto()).collect(), } } } @@ -149,6 +182,43 @@ mod proto_parser { .map(|x| x.to_string()) .collect(), set_creator_authority: self.set_creator_authority.to_string(), + admin_set_creator_authority: self.admin_set_creator_authority.to_string(), + create_v2_enabled: self.create_v2_enabled, + whitelist_pda: self.whitelist_pda.to_string(), + reserved_fee_recipient: self.reserved_fee_recipient.to_string(), + mayhem_mode_enabled: self.mayhem_mode_enabled, + reserved_fee_recipients: self + .reserved_fee_recipients + .into_iter() + .map(|x| x.to_string()) + .collect(), + } + } + } + use super::GlobalVolumeAccumulator; + impl IntoProto for GlobalVolumeAccumulator { + fn into_proto(self) -> proto_def::GlobalVolumeAccumulator { + proto_def::GlobalVolumeAccumulator { + start_time: self.start_time, + end_time: self.end_time, + seconds_in_a_day: self.seconds_in_a_day, + mint: self.mint.to_string(), + total_token_supply: self.total_token_supply.to_vec(), + sol_volumes: self.sol_volumes.to_vec(), + } + } + } + use super::UserVolumeAccumulator; + impl IntoProto for UserVolumeAccumulator { + fn into_proto(self) -> proto_def::UserVolumeAccumulator { + proto_def::UserVolumeAccumulator { + user: self.user.to_string(), + needs_claim: self.needs_claim, + total_unclaimed_tokens: self.total_unclaimed_tokens, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + last_update_timestamp: self.last_update_timestamp, + has_total_claimed_tokens: self.has_total_claimed_tokens, } } } @@ -159,9 +229,18 @@ mod proto_parser { PumpProgramState::BondingCurve(data) => { proto_def::program_state::StateOneof::BondingCurve(data.into_proto()) }, + PumpProgramState::FeeConfig(data) => { + proto_def::program_state::StateOneof::FeeConfig(data.into_proto()) + }, PumpProgramState::Global(data) => { proto_def::program_state::StateOneof::Global(data.into_proto()) }, + PumpProgramState::GlobalVolumeAccumulator(data) => { + proto_def::program_state::StateOneof::GlobalVolumeAccumulator(data.into_proto()) + }, + PumpProgramState::UserVolumeAccumulator(data) => { + proto_def::program_state::StateOneof::UserVolumeAccumulator(data.into_proto()) + }, }; proto_def::ProgramState { @@ -173,6 +252,8 @@ mod proto_parser { impl ParseProto for AccountParser { type Message = proto_def::ProgramState; - fn output_into_message(value: Self::Output) -> Self::Message { value.into_proto() } + fn output_into_message(value: Self::Output) -> Self::Message { + value.into_proto() + } } } diff --git a/crates/pumpfun-parser/src/generated_parser/instructions_parser.rs b/crates/pumpfun-parser/src/generated_parser/instructions_parser.rs index cb42b4b8..52ab5622 100644 --- a/crates/pumpfun-parser/src/generated_parser/instructions_parser.rs +++ b/crates/pumpfun-parser/src/generated_parser/instructions_parser.rs @@ -11,37 +11,71 @@ use std::sync::Arc; #[cfg(feature = "shared-data")] use yellowstone_vixen_core::InstructionUpdateOutput; -use crate::{ - deserialize_checked, - instructions::{ - Buy as BuyIxAccounts, BuyInstructionArgs as BuyIxData, - CollectCreatorFee as CollectCreatorFeeIxAccounts, Create as CreateIxAccounts, - CreateInstructionArgs as CreateIxData, ExtendAccount as ExtendAccountIxAccounts, - Initialize as InitializeIxAccounts, Migrate as MigrateIxAccounts, Sell as SellIxAccounts, - SellInstructionArgs as SellIxData, SetCreator as SetCreatorIxAccounts, - SetCreatorInstructionArgs as SetCreatorIxData, - SetMetaplexCreator as SetMetaplexCreatorIxAccounts, SetParams as SetParamsIxAccounts, - SetParamsInstructionArgs as SetParamsIxData, - UpdateGlobalAuthority as UpdateGlobalAuthorityIxAccounts, - }, - ID, +use crate::deserialize_checked; + +use crate::instructions::{ + AdminSetCreator as AdminSetCreatorIxAccounts, + AdminSetCreatorInstructionArgs as AdminSetCreatorIxData, + AdminSetIdlAuthority as AdminSetIdlAuthorityIxAccounts, + AdminSetIdlAuthorityInstructionArgs as AdminSetIdlAuthorityIxData, + AdminUpdateTokenIncentives as AdminUpdateTokenIncentivesIxAccounts, + AdminUpdateTokenIncentivesInstructionArgs as AdminUpdateTokenIncentivesIxData, + Buy as BuyIxAccounts, BuyExactSolIn as BuyExactSolInIxAccounts, + BuyExactSolInInstructionArgs as BuyExactSolInIxData, BuyInstructionArgs as BuyIxData, + ClaimTokenIncentives as ClaimTokenIncentivesIxAccounts, + CloseUserVolumeAccumulator as CloseUserVolumeAccumulatorIxAccounts, + CollectCreatorFee as CollectCreatorFeeIxAccounts, Create as CreateIxAccounts, + CreateInstructionArgs as CreateIxData, CreateV2 as CreateV2IxAccounts, + CreateV2InstructionArgs as CreateV2IxData, ExtendAccount as ExtendAccountIxAccounts, + InitUserVolumeAccumulator as InitUserVolumeAccumulatorIxAccounts, + Initialize as InitializeIxAccounts, Migrate as MigrateIxAccounts, Sell as SellIxAccounts, + SellInstructionArgs as SellIxData, SetCreator as SetCreatorIxAccounts, + SetCreatorInstructionArgs as SetCreatorIxData, + SetMetaplexCreator as SetMetaplexCreatorIxAccounts, SetParams as SetParamsIxAccounts, + SetParamsInstructionArgs as SetParamsIxData, + SetReservedFeeRecipients as SetReservedFeeRecipientsIxAccounts, + SetReservedFeeRecipientsInstructionArgs as SetReservedFeeRecipientsIxData, + SyncUserVolumeAccumulator as SyncUserVolumeAccumulatorIxAccounts, + ToggleCreateV2 as ToggleCreateV2IxAccounts, + ToggleCreateV2InstructionArgs as ToggleCreateV2IxData, + ToggleMayhemMode as ToggleMayhemModeIxAccounts, + ToggleMayhemModeInstructionArgs as ToggleMayhemModeIxData, + UpdateGlobalAuthority as UpdateGlobalAuthorityIxAccounts, }; +use crate::ID; /// Pump Instructions #[derive(Debug)] #[cfg_attr(feature = "tracing", derive(strum_macros::Display))] -#[allow(clippy::large_enum_variant)] pub enum PumpProgramIx { + AdminSetCreator(AdminSetCreatorIxAccounts, AdminSetCreatorIxData), + AdminSetIdlAuthority(AdminSetIdlAuthorityIxAccounts, AdminSetIdlAuthorityIxData), + AdminUpdateTokenIncentives( + AdminUpdateTokenIncentivesIxAccounts, + AdminUpdateTokenIncentivesIxData, + ), Buy(BuyIxAccounts, BuyIxData), + BuyExactSolIn(BuyExactSolInIxAccounts, BuyExactSolInIxData), + ClaimTokenIncentives(ClaimTokenIncentivesIxAccounts), + CloseUserVolumeAccumulator(CloseUserVolumeAccumulatorIxAccounts), CollectCreatorFee(CollectCreatorFeeIxAccounts), Create(CreateIxAccounts, CreateIxData), + CreateV2(CreateV2IxAccounts, CreateV2IxData), ExtendAccount(ExtendAccountIxAccounts), + InitUserVolumeAccumulator(InitUserVolumeAccumulatorIxAccounts), Initialize(InitializeIxAccounts), Migrate(MigrateIxAccounts), Sell(SellIxAccounts, SellIxData), SetCreator(SetCreatorIxAccounts, SetCreatorIxData), SetMetaplexCreator(SetMetaplexCreatorIxAccounts), SetParams(SetParamsIxAccounts, SetParamsIxData), + SetReservedFeeRecipients( + SetReservedFeeRecipientsIxAccounts, + SetReservedFeeRecipientsIxData, + ), + SyncUserVolumeAccumulator(SyncUserVolumeAccumulatorIxAccounts), + ToggleCreateV2(ToggleCreateV2IxAccounts, ToggleCreateV2IxData), + ToggleMayhemMode(ToggleMayhemModeIxAccounts, ToggleMayhemModeIxData), UpdateGlobalAuthority(UpdateGlobalAuthorityIxAccounts), } @@ -50,12 +84,16 @@ pub struct InstructionParser; impl yellowstone_vixen_core::Parser for InstructionParser { type Input = yellowstone_vixen_core::instruction::InstructionUpdate; + #[cfg(not(feature = "shared-data"))] type Output = PumpProgramIx; + #[cfg(feature = "shared-data")] type Output = InstructionUpdateOutput; - fn id(&self) -> std::borrow::Cow<'static, str> { "Pump::InstructionParser".into() } + fn id(&self) -> std::borrow::Cow<'static, str> { + "Pump::InstructionParser".into() + } fn prefilter(&self) -> yellowstone_vixen_core::Prefilter { yellowstone_vixen_core::Prefilter::builder() @@ -94,7 +132,9 @@ impl yellowstone_vixen_core::Parser for InstructionParser { impl yellowstone_vixen_core::ProgramParser for InstructionParser { #[inline] - fn program_id(&self) -> yellowstone_vixen_core::Pubkey { ID.to_bytes().into() } + fn program_id(&self) -> yellowstone_vixen_core::Pubkey { + ID.to_bytes().into() + } } impl InstructionParser { @@ -110,8 +150,61 @@ impl InstructionParser { let ix_discriminator: [u8; 8] = ix.data[0..8].try_into()?; let ix_data = &ix.data[8..]; let ix = match ix_discriminator { + [69, 25, 171, 142, 57, 239, 13, 4] => { + let expected_accounts_len = 6; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = AdminSetCreatorIxAccounts { + admin_set_creator_authority: next_account(accounts)?, + global: next_account(accounts)?, + mint: next_account(accounts)?, + bonding_curve: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: AdminSetCreatorIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::AdminSetCreator(ix_accounts, de_ix_data)) + }, + [8, 217, 96, 231, 144, 104, 192, 5] => { + let expected_accounts_len = 7; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = AdminSetIdlAuthorityIxAccounts { + authority: next_account(accounts)?, + global: next_account(accounts)?, + idl_account: next_account(accounts)?, + system_program: next_account(accounts)?, + program_signer: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: AdminSetIdlAuthorityIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::AdminSetIdlAuthority(ix_accounts, de_ix_data)) + }, + [209, 11, 115, 87, 213, 23, 124, 204] => { + let expected_accounts_len = 10; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = AdminUpdateTokenIncentivesIxAccounts { + authority: next_account(accounts)?, + global: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + mint: next_account(accounts)?, + global_incentive_token_account: next_account(accounts)?, + associated_token_program: next_account(accounts)?, + system_program: next_account(accounts)?, + token_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: AdminUpdateTokenIncentivesIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::AdminUpdateTokenIncentives( + ix_accounts, + de_ix_data, + )) + }, [102, 6, 61, 18, 1, 218, 235, 234] => { - let expected_accounts_len = 12; + let expected_accounts_len = 16; check_min_accounts_req(accounts_len, expected_accounts_len)?; let ix_accounts = BuyIxAccounts { global: next_account(accounts)?, @@ -126,10 +219,69 @@ impl InstructionParser { creator_vault: next_account(accounts)?, event_authority: next_account(accounts)?, program: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + fee_config: next_account(accounts)?, + fee_program: next_account(accounts)?, }; let de_ix_data: BuyIxData = deserialize_checked(ix_data, &ix_discriminator)?; Ok(PumpProgramIx::Buy(ix_accounts, de_ix_data)) }, + [56, 252, 116, 8, 158, 223, 205, 95] => { + let expected_accounts_len = 16; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = BuyExactSolInIxAccounts { + global: next_account(accounts)?, + fee_recipient: next_account(accounts)?, + mint: next_account(accounts)?, + bonding_curve: next_account(accounts)?, + associated_bonding_curve: next_account(accounts)?, + associated_user: next_account(accounts)?, + user: next_account(accounts)?, + system_program: next_account(accounts)?, + token_program: next_account(accounts)?, + creator_vault: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + fee_config: next_account(accounts)?, + fee_program: next_account(accounts)?, + }; + let de_ix_data: BuyExactSolInIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::BuyExactSolIn(ix_accounts, de_ix_data)) + }, + [16, 4, 71, 28, 204, 1, 40, 27] => { + let expected_accounts_len = 12; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = ClaimTokenIncentivesIxAccounts { + user: next_account(accounts)?, + user_ata: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + global_incentive_token_account: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + mint: next_account(accounts)?, + token_program: next_account(accounts)?, + system_program: next_account(accounts)?, + associated_token_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + payer: next_account(accounts)?, + }; + Ok(PumpProgramIx::ClaimTokenIncentives(ix_accounts)) + }, + [249, 69, 164, 218, 150, 103, 84, 138] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = CloseUserVolumeAccumulatorIxAccounts { + user: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpProgramIx::CloseUserVolumeAccumulator(ix_accounts)) + }, [20, 22, 86, 123, 198, 28, 219, 132] => { let expected_accounts_len = 5; check_min_accounts_req(accounts_len, expected_accounts_len)?; @@ -164,6 +316,30 @@ impl InstructionParser { let de_ix_data: CreateIxData = deserialize_checked(ix_data, &ix_discriminator)?; Ok(PumpProgramIx::Create(ix_accounts, de_ix_data)) }, + [214, 144, 76, 236, 95, 139, 49, 180] => { + let expected_accounts_len = 16; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = CreateV2IxAccounts { + mint: next_account(accounts)?, + mint_authority: next_account(accounts)?, + bonding_curve: next_account(accounts)?, + associated_bonding_curve: next_account(accounts)?, + global: next_account(accounts)?, + user: next_account(accounts)?, + system_program: next_account(accounts)?, + token_program: next_account(accounts)?, + associated_token_program: next_account(accounts)?, + mayhem_program_id: next_account(accounts)?, + global_params: next_account(accounts)?, + sol_vault: next_account(accounts)?, + mayhem_state: next_account(accounts)?, + mayhem_token_vault: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: CreateV2IxData = deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::CreateV2(ix_accounts, de_ix_data)) + }, [234, 102, 194, 203, 150, 72, 62, 229] => { let expected_accounts_len = 5; check_min_accounts_req(accounts_len, expected_accounts_len)?; @@ -176,6 +352,19 @@ impl InstructionParser { }; Ok(PumpProgramIx::ExtendAccount(ix_accounts)) }, + [94, 6, 202, 115, 255, 96, 232, 183] => { + let expected_accounts_len = 6; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = InitUserVolumeAccumulatorIxAccounts { + payer: next_account(accounts)?, + user: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + system_program: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpProgramIx::InitUserVolumeAccumulator(ix_accounts)) + }, [175, 175, 109, 31, 13, 152, 155, 237] => { let expected_accounts_len = 3; check_min_accounts_req(accounts_len, expected_accounts_len)?; @@ -218,7 +407,7 @@ impl InstructionParser { Ok(PumpProgramIx::Migrate(ix_accounts)) }, [51, 230, 133, 164, 1, 127, 131, 173] => { - let expected_accounts_len = 12; + let expected_accounts_len = 14; check_min_accounts_req(accounts_len, expected_accounts_len)?; let ix_accounts = SellIxAccounts { global: next_account(accounts)?, @@ -233,6 +422,8 @@ impl InstructionParser { token_program: next_account(accounts)?, event_authority: next_account(accounts)?, program: next_account(accounts)?, + fee_config: next_account(accounts)?, + fee_program: next_account(accounts)?, }; let de_ix_data: SellIxData = deserialize_checked(ix_data, &ix_discriminator)?; Ok(PumpProgramIx::Sell(ix_accounts, de_ix_data)) @@ -276,6 +467,60 @@ impl InstructionParser { let de_ix_data: SetParamsIxData = deserialize_checked(ix_data, &ix_discriminator)?; Ok(PumpProgramIx::SetParams(ix_accounts, de_ix_data)) }, + [111, 172, 162, 232, 114, 89, 213, 142] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = SetReservedFeeRecipientsIxAccounts { + global: next_account(accounts)?, + authority: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: SetReservedFeeRecipientsIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::SetReservedFeeRecipients( + ix_accounts, + de_ix_data, + )) + }, + [86, 31, 192, 87, 163, 87, 79, 238] => { + let expected_accounts_len = 5; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = SyncUserVolumeAccumulatorIxAccounts { + user: next_account(accounts)?, + global_volume_accumulator: next_account(accounts)?, + user_volume_accumulator: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + Ok(PumpProgramIx::SyncUserVolumeAccumulator(ix_accounts)) + }, + [28, 255, 230, 240, 172, 107, 203, 171] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = ToggleCreateV2IxAccounts { + global: next_account(accounts)?, + authority: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: ToggleCreateV2IxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::ToggleCreateV2(ix_accounts, de_ix_data)) + }, + [1, 9, 111, 208, 100, 31, 255, 163] => { + let expected_accounts_len = 4; + check_min_accounts_req(accounts_len, expected_accounts_len)?; + let ix_accounts = ToggleMayhemModeIxAccounts { + global: next_account(accounts)?, + authority: next_account(accounts)?, + event_authority: next_account(accounts)?, + program: next_account(accounts)?, + }; + let de_ix_data: ToggleMayhemModeIxData = + deserialize_checked(ix_data, &ix_discriminator)?; + Ok(PumpProgramIx::ToggleMayhemMode(ix_accounts, de_ix_data)) + }, [227, 181, 74, 196, 208, 21, 97, 213] => { let expected_accounts_len = 5; check_min_accounts_req(accounts_len, expected_accounts_len)?; @@ -384,10 +629,85 @@ pub fn next_program_id_optional_account< // #[cfg(feature = "proto")] mod proto_parser { + use super::{InstructionParser, PumpProgramIx}; + use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; use yellowstone_vixen_core::proto::ParseProto; - use super::{BuyIxAccounts, InstructionParser, PumpProgramIx}; - use crate::{proto_def, proto_helpers::proto_types_parsers::IntoProto}; + use super::AdminSetCreatorIxAccounts; + impl IntoProto for AdminSetCreatorIxAccounts { + fn into_proto(self) -> proto_def::AdminSetCreatorIxAccounts { + proto_def::AdminSetCreatorIxAccounts { + admin_set_creator_authority: self.admin_set_creator_authority.to_string(), + global: self.global.to_string(), + mint: self.mint.to_string(), + bonding_curve: self.bonding_curve.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::AdminSetCreatorIxData; + impl IntoProto for AdminSetCreatorIxData { + fn into_proto(self) -> proto_def::AdminSetCreatorIxData { + proto_def::AdminSetCreatorIxData { + creator: self.creator.to_string(), + } + } + } + use super::AdminSetIdlAuthorityIxAccounts; + impl IntoProto for AdminSetIdlAuthorityIxAccounts { + fn into_proto(self) -> proto_def::AdminSetIdlAuthorityIxAccounts { + proto_def::AdminSetIdlAuthorityIxAccounts { + authority: self.authority.to_string(), + global: self.global.to_string(), + idl_account: self.idl_account.to_string(), + system_program: self.system_program.to_string(), + program_signer: self.program_signer.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::AdminSetIdlAuthorityIxData; + impl IntoProto for AdminSetIdlAuthorityIxData { + fn into_proto(self) -> proto_def::AdminSetIdlAuthorityIxData { + proto_def::AdminSetIdlAuthorityIxData { + idl_authority: self.idl_authority.to_string(), + } + } + } + use super::AdminUpdateTokenIncentivesIxAccounts; + impl IntoProto + for AdminUpdateTokenIncentivesIxAccounts + { + fn into_proto(self) -> proto_def::AdminUpdateTokenIncentivesIxAccounts { + proto_def::AdminUpdateTokenIncentivesIxAccounts { + authority: self.authority.to_string(), + global: self.global.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + mint: self.mint.to_string(), + global_incentive_token_account: self.global_incentive_token_account.to_string(), + associated_token_program: self.associated_token_program.to_string(), + system_program: self.system_program.to_string(), + token_program: self.token_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::AdminUpdateTokenIncentivesIxData; + impl IntoProto for AdminUpdateTokenIncentivesIxData { + fn into_proto(self) -> proto_def::AdminUpdateTokenIncentivesIxData { + proto_def::AdminUpdateTokenIncentivesIxData { + start_time: self.start_time, + end_time: self.end_time, + seconds_in_a_day: self.seconds_in_a_day, + day_number: self.day_number, + pump_token_supply_per_day: self.pump_token_supply_per_day, + } + } + } + use super::BuyIxAccounts; impl IntoProto for BuyIxAccounts { fn into_proto(self) -> proto_def::BuyIxAccounts { proto_def::BuyIxAccounts { @@ -403,6 +723,10 @@ mod proto_parser { creator_vault: self.creator_vault.to_string(), event_authority: self.event_authority.to_string(), program: self.program.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + fee_config: self.fee_config.to_string(), + fee_program: self.fee_program.to_string(), } } } @@ -415,6 +739,70 @@ mod proto_parser { } } } + use super::BuyExactSolInIxAccounts; + impl IntoProto for BuyExactSolInIxAccounts { + fn into_proto(self) -> proto_def::BuyExactSolInIxAccounts { + proto_def::BuyExactSolInIxAccounts { + global: self.global.to_string(), + fee_recipient: self.fee_recipient.to_string(), + mint: self.mint.to_string(), + bonding_curve: self.bonding_curve.to_string(), + associated_bonding_curve: self.associated_bonding_curve.to_string(), + associated_user: self.associated_user.to_string(), + user: self.user.to_string(), + system_program: self.system_program.to_string(), + token_program: self.token_program.to_string(), + creator_vault: self.creator_vault.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + fee_config: self.fee_config.to_string(), + fee_program: self.fee_program.to_string(), + } + } + } + use super::BuyExactSolInIxData; + impl IntoProto for BuyExactSolInIxData { + fn into_proto(self) -> proto_def::BuyExactSolInIxData { + proto_def::BuyExactSolInIxData { + spendable_sol_in: self.spendable_sol_in, + min_tokens_out: self.min_tokens_out, + } + } + } + use super::ClaimTokenIncentivesIxAccounts; + impl IntoProto for ClaimTokenIncentivesIxAccounts { + fn into_proto(self) -> proto_def::ClaimTokenIncentivesIxAccounts { + proto_def::ClaimTokenIncentivesIxAccounts { + user: self.user.to_string(), + user_ata: self.user_ata.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + global_incentive_token_account: self.global_incentive_token_account.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + mint: self.mint.to_string(), + token_program: self.token_program.to_string(), + system_program: self.system_program.to_string(), + associated_token_program: self.associated_token_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + payer: self.payer.to_string(), + } + } + } + use super::CloseUserVolumeAccumulatorIxAccounts; + impl IntoProto + for CloseUserVolumeAccumulatorIxAccounts + { + fn into_proto(self) -> proto_def::CloseUserVolumeAccumulatorIxAccounts { + proto_def::CloseUserVolumeAccumulatorIxAccounts { + user: self.user.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } use super::CollectCreatorFeeIxAccounts; impl IntoProto for CollectCreatorFeeIxAccounts { fn into_proto(self) -> proto_def::CollectCreatorFeeIxAccounts { @@ -459,6 +847,41 @@ mod proto_parser { } } } + use super::CreateV2IxAccounts; + impl IntoProto for CreateV2IxAccounts { + fn into_proto(self) -> proto_def::CreateV2IxAccounts { + proto_def::CreateV2IxAccounts { + mint: self.mint.to_string(), + mint_authority: self.mint_authority.to_string(), + bonding_curve: self.bonding_curve.to_string(), + associated_bonding_curve: self.associated_bonding_curve.to_string(), + global: self.global.to_string(), + user: self.user.to_string(), + system_program: self.system_program.to_string(), + token_program: self.token_program.to_string(), + associated_token_program: self.associated_token_program.to_string(), + mayhem_program_id: self.mayhem_program_id.to_string(), + global_params: self.global_params.to_string(), + sol_vault: self.sol_vault.to_string(), + mayhem_state: self.mayhem_state.to_string(), + mayhem_token_vault: self.mayhem_token_vault.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::CreateV2IxData; + impl IntoProto for CreateV2IxData { + fn into_proto(self) -> proto_def::CreateV2IxData { + proto_def::CreateV2IxData { + name: self.name, + symbol: self.symbol, + uri: self.uri, + creator: self.creator.to_string(), + is_mayhem_mode: self.is_mayhem_mode, + } + } + } use super::ExtendAccountIxAccounts; impl IntoProto for ExtendAccountIxAccounts { fn into_proto(self) -> proto_def::ExtendAccountIxAccounts { @@ -471,6 +894,21 @@ mod proto_parser { } } } + use super::InitUserVolumeAccumulatorIxAccounts; + impl IntoProto + for InitUserVolumeAccumulatorIxAccounts + { + fn into_proto(self) -> proto_def::InitUserVolumeAccumulatorIxAccounts { + proto_def::InitUserVolumeAccumulatorIxAccounts { + payer: self.payer.to_string(), + user: self.user.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + system_program: self.system_program.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } use super::InitializeIxAccounts; impl IntoProto for InitializeIxAccounts { fn into_proto(self) -> proto_def::InitializeIxAccounts { @@ -528,6 +966,8 @@ mod proto_parser { token_program: self.token_program.to_string(), event_authority: self.event_authority.to_string(), program: self.program.to_string(), + fee_config: self.fee_config.to_string(), + fee_program: self.fee_program.to_string(), } } } @@ -599,6 +1039,80 @@ mod proto_parser { pool_migration_fee: self.pool_migration_fee, creator_fee_basis_points: self.creator_fee_basis_points, set_creator_authority: self.set_creator_authority.to_string(), + admin_set_creator_authority: self.admin_set_creator_authority.to_string(), + } + } + } + use super::SetReservedFeeRecipientsIxAccounts; + impl IntoProto + for SetReservedFeeRecipientsIxAccounts + { + fn into_proto(self) -> proto_def::SetReservedFeeRecipientsIxAccounts { + proto_def::SetReservedFeeRecipientsIxAccounts { + global: self.global.to_string(), + authority: self.authority.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::SetReservedFeeRecipientsIxData; + impl IntoProto for SetReservedFeeRecipientsIxData { + fn into_proto(self) -> proto_def::SetReservedFeeRecipientsIxData { + proto_def::SetReservedFeeRecipientsIxData { + whitelist_pda: self.whitelist_pda.to_string(), + } + } + } + use super::SyncUserVolumeAccumulatorIxAccounts; + impl IntoProto + for SyncUserVolumeAccumulatorIxAccounts + { + fn into_proto(self) -> proto_def::SyncUserVolumeAccumulatorIxAccounts { + proto_def::SyncUserVolumeAccumulatorIxAccounts { + user: self.user.to_string(), + global_volume_accumulator: self.global_volume_accumulator.to_string(), + user_volume_accumulator: self.user_volume_accumulator.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::ToggleCreateV2IxAccounts; + impl IntoProto for ToggleCreateV2IxAccounts { + fn into_proto(self) -> proto_def::ToggleCreateV2IxAccounts { + proto_def::ToggleCreateV2IxAccounts { + global: self.global.to_string(), + authority: self.authority.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::ToggleCreateV2IxData; + impl IntoProto for ToggleCreateV2IxData { + fn into_proto(self) -> proto_def::ToggleCreateV2IxData { + proto_def::ToggleCreateV2IxData { + enabled: self.enabled, + } + } + } + use super::ToggleMayhemModeIxAccounts; + impl IntoProto for ToggleMayhemModeIxAccounts { + fn into_proto(self) -> proto_def::ToggleMayhemModeIxAccounts { + proto_def::ToggleMayhemModeIxAccounts { + global: self.global.to_string(), + authority: self.authority.to_string(), + event_authority: self.event_authority.to_string(), + program: self.program.to_string(), + } + } + } + use super::ToggleMayhemModeIxData; + impl IntoProto for ToggleMayhemModeIxData { + fn into_proto(self) -> proto_def::ToggleMayhemModeIxData { + proto_def::ToggleMayhemModeIxData { + enabled: self.enabled, } } } @@ -618,12 +1132,58 @@ mod proto_parser { impl IntoProto for PumpProgramIx { fn into_proto(self) -> proto_def::ProgramIxs { match self { + PumpProgramIx::AdminSetCreator(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::AdminSetCreator( + proto_def::AdminSetCreatorIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpProgramIx::AdminSetIdlAuthority(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::AdminSetIdlAuthority( + proto_def::AdminSetIdlAuthorityIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpProgramIx::AdminUpdateTokenIncentives(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::AdminUpdateTokenIncentives( + proto_def::AdminUpdateTokenIncentivesIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, PumpProgramIx::Buy(acc, data) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::Buy(proto_def::BuyIx { accounts: Some(acc.into_proto()), data: Some(data.into_proto()), })), }, + PumpProgramIx::BuyExactSolIn(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::BuyExactSolIn( + proto_def::BuyExactSolInIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpProgramIx::ClaimTokenIncentives(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::ClaimTokenIncentives( + proto_def::ClaimTokenIncentivesIx { + accounts: Some(acc.into_proto()), + }, + )), + }, + PumpProgramIx::CloseUserVolumeAccumulator(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::CloseUserVolumeAccumulator( + proto_def::CloseUserVolumeAccumulatorIx { + accounts: Some(acc.into_proto()), + }, + )), + }, PumpProgramIx::CollectCreatorFee(acc) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::CollectCreatorFee( proto_def::CollectCreatorFeeIx { @@ -639,6 +1199,14 @@ mod proto_parser { }, )), }, + PumpProgramIx::CreateV2(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::CreateV2( + proto_def::CreateV2Ix { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, PumpProgramIx::ExtendAccount(acc) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::ExtendAccount( proto_def::ExtendAccountIx { @@ -646,6 +1214,13 @@ mod proto_parser { }, )), }, + PumpProgramIx::InitUserVolumeAccumulator(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::InitUserVolumeAccumulator( + proto_def::InitUserVolumeAccumulatorIx { + accounts: Some(acc.into_proto()), + }, + )), + }, PumpProgramIx::Initialize(acc) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::Initialize( proto_def::InitializeIx { @@ -689,6 +1264,37 @@ mod proto_parser { }, )), }, + PumpProgramIx::SetReservedFeeRecipients(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::SetReservedFeeRecipients( + proto_def::SetReservedFeeRecipientsIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpProgramIx::SyncUserVolumeAccumulator(acc) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::SyncUserVolumeAccumulator( + proto_def::SyncUserVolumeAccumulatorIx { + accounts: Some(acc.into_proto()), + }, + )), + }, + PumpProgramIx::ToggleCreateV2(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::ToggleCreateV2( + proto_def::ToggleCreateV2Ix { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, + PumpProgramIx::ToggleMayhemMode(acc, data) => proto_def::ProgramIxs { + ix_oneof: Some(proto_def::program_ixs::IxOneof::ToggleMayhemMode( + proto_def::ToggleMayhemModeIx { + accounts: Some(acc.into_proto()), + data: Some(data.into_proto()), + }, + )), + }, PumpProgramIx::UpdateGlobalAuthority(acc) => proto_def::ProgramIxs { ix_oneof: Some(proto_def::program_ixs::IxOneof::UpdateGlobalAuthority( proto_def::UpdateGlobalAuthorityIx { diff --git a/crates/pumpfun-parser/src/generated_parser/proto_helpers.rs b/crates/pumpfun-parser/src/generated_parser/proto_helpers.rs index 9f56779d..eb9068be 100644 --- a/crates/pumpfun-parser/src/generated_parser/proto_helpers.rs +++ b/crates/pumpfun-parser/src/generated_parser/proto_helpers.rs @@ -9,7 +9,70 @@ pub mod proto_types_parsers { use yellowstone_vixen_core::proto_helper_traits; proto_helper_traits!(); - use crate::{proto_def, types::CollectCreatorFeeEvent}; + use crate::proto_def; + + use crate::types::AdminSetCreatorEvent; + impl IntoProto for AdminSetCreatorEvent { + fn into_proto(self) -> proto_def::AdminSetCreatorEvent { + proto_def::AdminSetCreatorEvent { + timestamp: self.timestamp, + admin_set_creator_authority: self.admin_set_creator_authority.to_string(), + mint: self.mint.to_string(), + bonding_curve: self.bonding_curve.to_string(), + old_creator: self.old_creator.to_string(), + new_creator: self.new_creator.to_string(), + } + } + } + use crate::types::AdminSetIdlAuthorityEvent; + impl IntoProto for AdminSetIdlAuthorityEvent { + fn into_proto(self) -> proto_def::AdminSetIdlAuthorityEvent { + proto_def::AdminSetIdlAuthorityEvent { + idl_authority: self.idl_authority.to_string(), + } + } + } + use crate::types::AdminUpdateTokenIncentivesEvent; + impl IntoProto for AdminUpdateTokenIncentivesEvent { + fn into_proto(self) -> proto_def::AdminUpdateTokenIncentivesEvent { + proto_def::AdminUpdateTokenIncentivesEvent { + start_time: self.start_time, + end_time: self.end_time, + day_number: self.day_number, + token_supply_per_day: self.token_supply_per_day, + mint: self.mint.to_string(), + seconds_in_a_day: self.seconds_in_a_day, + timestamp: self.timestamp, + } + } + } + use crate::types::ClaimTokenIncentivesEvent; + impl IntoProto for ClaimTokenIncentivesEvent { + fn into_proto(self) -> proto_def::ClaimTokenIncentivesEvent { + proto_def::ClaimTokenIncentivesEvent { + user: self.user.to_string(), + mint: self.mint.to_string(), + amount: self.amount, + timestamp: self.timestamp, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + } + } + } + use crate::types::CloseUserVolumeAccumulatorEvent; + impl IntoProto for CloseUserVolumeAccumulatorEvent { + fn into_proto(self) -> proto_def::CloseUserVolumeAccumulatorEvent { + proto_def::CloseUserVolumeAccumulatorEvent { + user: self.user.to_string(), + timestamp: self.timestamp, + total_unclaimed_tokens: self.total_unclaimed_tokens, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + last_update_timestamp: self.last_update_timestamp, + } + } + } + use crate::types::CollectCreatorFeeEvent; impl IntoProto for CollectCreatorFeeEvent { fn into_proto(self) -> proto_def::CollectCreatorFeeEvent { proto_def::CollectCreatorFeeEvent { @@ -61,6 +124,8 @@ pub mod proto_types_parsers { virtual_sol_reserves: self.virtual_sol_reserves, real_token_reserves: self.real_token_reserves, token_total_supply: self.token_total_supply, + token_program: self.token_program.to_string(), + is_mayhem_mode: self.is_mayhem_mode, } } } @@ -76,6 +141,49 @@ pub mod proto_types_parsers { } } } + use crate::types::FeeTier; + impl IntoProto for FeeTier { + fn into_proto(self) -> proto_def::FeeTier { + proto_def::FeeTier { + market_cap_lamports_threshold: self.market_cap_lamports_threshold.to_string(), + fees: Some(self.fees.into_proto()), + } + } + } + use crate::types::Fees; + impl IntoProto for Fees { + fn into_proto(self) -> proto_def::Fees { + proto_def::Fees { + lp_fee_bps: self.lp_fee_bps, + protocol_fee_bps: self.protocol_fee_bps, + creator_fee_bps: self.creator_fee_bps, + } + } + } + use crate::types::InitUserVolumeAccumulatorEvent; + impl IntoProto for InitUserVolumeAccumulatorEvent { + fn into_proto(self) -> proto_def::InitUserVolumeAccumulatorEvent { + proto_def::InitUserVolumeAccumulatorEvent { + payer: self.payer.to_string(), + user: self.user.to_string(), + timestamp: self.timestamp, + } + } + } + use crate::types::ReservedFeeRecipientsEvent; + impl IntoProto for ReservedFeeRecipientsEvent { + fn into_proto(self) -> proto_def::ReservedFeeRecipientsEvent { + proto_def::ReservedFeeRecipientsEvent { + timestamp: self.timestamp, + reserved_fee_recipient: self.reserved_fee_recipient.to_string(), + reserved_fee_recipients: self + .reserved_fee_recipients + .into_iter() + .map(|x| x.to_string()) + .collect(), + } + } + } use crate::types::SetCreatorEvent; impl IntoProto for SetCreatorEvent { fn into_proto(self) -> proto_def::SetCreatorEvent { @@ -120,6 +228,18 @@ pub mod proto_types_parsers { .collect(), timestamp: self.timestamp, set_creator_authority: self.set_creator_authority.to_string(), + admin_set_creator_authority: self.admin_set_creator_authority.to_string(), + } + } + } + use crate::types::SyncUserVolumeAccumulatorEvent; + impl IntoProto for SyncUserVolumeAccumulatorEvent { + fn into_proto(self) -> proto_def::SyncUserVolumeAccumulatorEvent { + proto_def::SyncUserVolumeAccumulatorEvent { + user: self.user.to_string(), + total_claimed_tokens_before: self.total_claimed_tokens_before, + total_claimed_tokens_after: self.total_claimed_tokens_after, + timestamp: self.timestamp, } } } @@ -143,6 +263,12 @@ pub mod proto_types_parsers { creator: self.creator.to_string(), creator_fee_basis_points: self.creator_fee_basis_points, creator_fee: self.creator_fee, + track_volume: self.track_volume, + total_unclaimed_tokens: self.total_unclaimed_tokens, + total_claimed_tokens: self.total_claimed_tokens, + current_sol_volume: self.current_sol_volume, + last_update_timestamp: self.last_update_timestamp, + ix_name: self.ix_name, } } } diff --git a/crates/pumpfun-parser/src/generated_sdk/accounts/bonding_curve.rs b/crates/pumpfun-parser/src/generated_sdk/accounts/bonding_curve.rs index d939259d..47ed001c 100644 --- a/crates/pumpfun-parser/src/generated_sdk/accounts/bonding_curve.rs +++ b/crates/pumpfun-parser/src/generated_sdk/accounts/bonding_curve.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -23,10 +24,13 @@ pub struct BondingCurve { serde(with = "serde_with::As::") )] pub creator: Pubkey, + pub is_mayhem_mode: bool, } +pub const BONDING_CURVE_DISCRIMINATOR: [u8; 8] = [23, 183, 248, 55, 96, 216, 172, 96]; + impl BondingCurve { - pub const LEN: usize = 81; + pub const LEN: usize = 82; #[inline(always)] pub fn from_bytes(data: &[u8]) -> Result { @@ -126,7 +130,9 @@ impl anchor_lang::AccountSerialize for BondingCurve {} #[cfg(feature = "anchor")] impl anchor_lang::Owner for BondingCurve { - fn owner() -> Pubkey { crate::PUMP_ID } + fn owner() -> Pubkey { + crate::PUMP_ID + } } #[cfg(feature = "anchor-idl-build")] @@ -134,5 +140,5 @@ impl anchor_lang::IdlBuild for BondingCurve {} #[cfg(feature = "anchor-idl-build")] impl anchor_lang::Discriminator for BondingCurve { - const DISCRIMINATOR: [u8; 8] = [0; 8]; + const DISCRIMINATOR: &[u8] = &[0; 8]; } diff --git a/crates/pumpfun-parser/src/generated_sdk/accounts/fee_config.rs b/crates/pumpfun-parser/src/generated_sdk/accounts/fee_config.rs new file mode 100644 index 00000000..90ef5242 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/accounts/fee_config.rs @@ -0,0 +1,140 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::FeeTier; +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FeeConfig { + pub discriminator: [u8; 8], + pub bump: u8, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin: Pubkey, + pub flat_fees: Fees, + pub fee_tiers: Vec, +} + +pub const FEE_CONFIG_DISCRIMINATOR: [u8; 8] = [143, 52, 146, 187, 219, 123, 76, 155]; + +impl FeeConfig { + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for FeeConfig { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_fee_config(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = FeeConfig::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_fee_config(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_fee_config( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = FeeConfig::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for FeeConfig { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for FeeConfig {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for FeeConfig { + fn owner() -> Pubkey { + crate::PUMP_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for FeeConfig {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for FeeConfig { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pumpfun-parser/src/generated_sdk/accounts/global.rs b/crates/pumpfun-parser/src/generated_sdk/accounts/global.rs index fe361ab1..e83b4fa4 100644 --- a/crates/pumpfun-parser/src/generated_sdk/accounts/global.rs +++ b/crates/pumpfun-parser/src/generated_sdk/accounts/global.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -44,10 +45,30 @@ pub struct Global { serde(with = "serde_with::As::") )] pub set_creator_authority: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_creator_authority: Pubkey, + pub create_v2_enabled: bool, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub whitelist_pda: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub reserved_fee_recipient: Pubkey, + pub mayhem_mode_enabled: bool, + pub reserved_fee_recipients: [Pubkey; 7], } +pub const GLOBAL_DISCRIMINATOR: [u8; 8] = [167, 232, 232, 177, 200, 108, 114, 127]; + impl Global { - pub const LEN: usize = 418; + pub const LEN: usize = 740; #[inline(always)] pub fn from_bytes(data: &[u8]) -> Result { @@ -147,7 +168,9 @@ impl anchor_lang::AccountSerialize for Global {} #[cfg(feature = "anchor")] impl anchor_lang::Owner for Global { - fn owner() -> Pubkey { crate::PUMP_ID } + fn owner() -> Pubkey { + crate::PUMP_ID + } } #[cfg(feature = "anchor-idl-build")] @@ -155,5 +178,5 @@ impl anchor_lang::IdlBuild for Global {} #[cfg(feature = "anchor-idl-build")] impl anchor_lang::Discriminator for Global { - const DISCRIMINATOR: [u8; 8] = [0; 8]; + const DISCRIMINATOR: &[u8] = &[0; 8]; } diff --git a/crates/pumpfun-parser/src/generated_sdk/accounts/global_volume_accumulator.rs b/crates/pumpfun-parser/src/generated_sdk/accounts/global_volume_accumulator.rs new file mode 100644 index 00000000..58c04953 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/accounts/global_volume_accumulator.rs @@ -0,0 +1,144 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct GlobalVolumeAccumulator { + pub discriminator: [u8; 8], + pub start_time: i64, + pub end_time: i64, + pub seconds_in_a_day: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + pub total_token_supply: [u64; 30], + pub sol_volumes: [u64; 30], +} + +pub const GLOBAL_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = [202, 42, 246, 43, 142, 190, 30, 255]; + +impl GlobalVolumeAccumulator { + pub const LEN: usize = 544; + + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for GlobalVolumeAccumulator { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_global_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = + Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = GlobalVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_global_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_global_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = + Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = GlobalVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for GlobalVolumeAccumulator { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for GlobalVolumeAccumulator {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for GlobalVolumeAccumulator { + fn owner() -> Pubkey { + crate::PUMP_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for GlobalVolumeAccumulator {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for GlobalVolumeAccumulator { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pumpfun-parser/src/generated_sdk/accounts/mod.rs b/crates/pumpfun-parser/src/generated_sdk/accounts/mod.rs index 44a9d746..ac9e52b3 100644 --- a/crates/pumpfun-parser/src/generated_sdk/accounts/mod.rs +++ b/crates/pumpfun-parser/src/generated_sdk/accounts/mod.rs @@ -6,6 +6,13 @@ //! pub(crate) mod r#bonding_curve; +pub(crate) mod r#fee_config; pub(crate) mod r#global; +pub(crate) mod r#global_volume_accumulator; +pub(crate) mod r#user_volume_accumulator; -pub use self::{r#bonding_curve::*, r#global::*}; +pub use self::r#bonding_curve::*; +pub use self::r#fee_config::*; +pub use self::r#global::*; +pub use self::r#global_volume_accumulator::*; +pub use self::r#user_volume_accumulator::*; diff --git a/crates/pumpfun-parser/src/generated_sdk/accounts/user_volume_accumulator.rs b/crates/pumpfun-parser/src/generated_sdk/accounts/user_volume_accumulator.rs new file mode 100644 index 00000000..0703742d --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/accounts/user_volume_accumulator.rs @@ -0,0 +1,144 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UserVolumeAccumulator { + pub discriminator: [u8; 8], + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub needs_claim: bool, + pub total_unclaimed_tokens: u64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, + pub last_update_timestamp: i64, + pub has_total_claimed_tokens: bool, +} + +pub const USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = [86, 255, 112, 14, 102, 53, 154, 250]; + +impl UserVolumeAccumulator { + pub const LEN: usize = 74; + + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_account_info::AccountInfo<'a>> for UserVolumeAccumulator { + type Error = std::io::Error; + + fn try_from(account_info: &solana_account_info::AccountInfo<'a>) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "fetch")] +pub fn fetch_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_user_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = + Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + let account = accounts[i].as_ref().ok_or(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Account not found: {}", address), + ))?; + let data = UserVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }); + } + Ok(decoded_accounts) +} + +#[cfg(feature = "fetch")] +pub fn fetch_maybe_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + address: &solana_pubkey::Pubkey, +) -> Result, std::io::Error> { + let accounts = fetch_all_maybe_user_volume_accumulator(rpc, &[*address])?; + Ok(accounts[0].clone()) +} + +#[cfg(feature = "fetch")] +pub fn fetch_all_maybe_user_volume_accumulator( + rpc: &solana_client::rpc_client::RpcClient, + addresses: &[solana_pubkey::Pubkey], +) -> Result>, std::io::Error> { + let accounts = rpc + .get_multiple_accounts(addresses) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + let mut decoded_accounts: Vec> = Vec::new(); + for i in 0..addresses.len() { + let address = addresses[i]; + if let Some(account) = accounts[i].as_ref() { + let data = UserVolumeAccumulator::from_bytes(&account.data)?; + decoded_accounts.push(crate::shared::MaybeAccount::Exists( + crate::shared::DecodedAccount { + address, + account: account.clone(), + data, + }, + )); + } else { + decoded_accounts.push(crate::shared::MaybeAccount::NotFound(address)); + } + } + Ok(decoded_accounts) +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for UserVolumeAccumulator { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for UserVolumeAccumulator {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for UserVolumeAccumulator { + fn owner() -> Pubkey { + crate::PUMP_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for UserVolumeAccumulator {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for UserVolumeAccumulator { + const DISCRIMINATOR: &[u8] = &[0; 8]; +} diff --git a/crates/pumpfun-parser/src/generated_sdk/errors/pump.rs b/crates/pumpfun-parser/src/generated_sdk/errors/pump.rs index 66dd6b46..7f7dbe87 100644 --- a/crates/pumpfun-parser/src/generated_sdk/errors/pump.rs +++ b/crates/pumpfun-parser/src/generated_sdk/errors/pump.rs @@ -42,22 +42,22 @@ pub enum PumpError { NewSizeShouldBeGreaterThanCurrentSize = 0x1779, /// 6010 - Account type not supported #[error("Account type not supported")] - AccountTypeNotSupported = 0x177a, + AccountTypeNotSupported = 0x177A, /// 6011 - initial_real_token_reserves should be less than token_total_supply #[error("initial_real_token_reserves should be less than token_total_supply")] - InitialRealTokenReservesShouldBeLessThanTokenTotalSupply = 0x177b, + InitialRealTokenReservesShouldBeLessThanTokenTotalSupply = 0x177B, /// 6012 - initial_virtual_token_reserves should be greater than initial_real_token_reserves #[error("initial_virtual_token_reserves should be greater than initial_real_token_reserves")] - InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves = 0x177c, + InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves = 0x177C, /// 6013 - fee_basis_points greater than maximum #[error("fee_basis_points greater than maximum")] - FeeBasisPointsGreaterThanMaximum = 0x177d, + FeeBasisPointsGreaterThanMaximum = 0x177D, /// 6014 - Withdraw authority cannot be set to System Program ID #[error("Withdraw authority cannot be set to System Program ID")] - AllZerosWithdrawAuthority = 0x177e, + AllZerosWithdrawAuthority = 0x177E, /// 6015 - pool_migration_fee should be less than final_real_sol_reserves #[error("pool_migration_fee should be less than final_real_sol_reserves")] - PoolMigrationFeeShouldBeLessThanFinalRealSolReserves = 0x177f, + PoolMigrationFeeShouldBeLessThanFinalRealSolReserves = 0x177F, /// 6016 - pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES #[error("pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES")] PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees = 0x1780, @@ -90,29 +90,77 @@ pub enum PumpError { Truncation = 0x1789, /// 6026 - Division by zero #[error("Division by zero")] - DivisionByZero = 0x178a, + DivisionByZero = 0x178A, /// 6027 - Not enough remaining accounts #[error("Not enough remaining accounts")] - NotEnoughRemainingAccounts = 0x178b, + NotEnoughRemainingAccounts = 0x178B, /// 6028 - All fee recipients should be non-zero #[error("All fee recipients should be non-zero")] - AllFeeRecipientsShouldBeNonZero = 0x178c, + AllFeeRecipientsShouldBeNonZero = 0x178C, /// 6029 - Unsorted or not unique fee recipients #[error("Unsorted or not unique fee recipients")] - UnsortedNotUniqueFeeRecipients = 0x178d, + UnsortedNotUniqueFeeRecipients = 0x178D, /// 6030 - Creator should not be zero #[error("Creator should not be zero")] - CreatorShouldNotBeZero = 0x178e, + CreatorShouldNotBeZero = 0x178E, + /// 6031 - + #[error("")] + StartTimeInThePast = 0x178F, + /// 6032 - + #[error("")] + EndTimeInThePast = 0x1790, + /// 6033 - + #[error("")] + EndTimeBeforeStartTime = 0x1791, + /// 6034 - + #[error("")] + TimeRangeTooLarge = 0x1792, + /// 6035 - + #[error("")] + EndTimeBeforeCurrentDay = 0x1793, + /// 6036 - + #[error("")] + SupplyUpdateForFinishedRange = 0x1794, + /// 6037 - + #[error("")] + DayIndexAfterEndIndex = 0x1795, + /// 6038 - + #[error("")] + DayInActiveRange = 0x1796, + /// 6039 - + #[error("")] + InvalidIncentiveMint = 0x1797, + /// 6040 - Buy: Not enough SOL to cover for rent exemption. + #[error("Buy: Not enough SOL to cover for rent exemption.")] + BuyNotEnoughSolToCoverRent = 0x1798, + /// 6041 - Buy: Not enough SOL to cover for fees. + #[error("Buy: Not enough SOL to cover for fees.")] + BuyNotEnoughSolToCoverFees = 0x1799, + /// 6042 - Slippage: Would buy less tokens than expected min_tokens_out + #[error("Slippage: Would buy less tokens than expected min_tokens_out")] + BuySlippageBelowMinTokensOut = 0x179A, + /// 6043 - + #[error("")] + NameTooLong = 0x179B, + /// 6044 - + #[error("")] + SymbolTooLong = 0x179C, + /// 6045 - + #[error("")] + UriTooLong = 0x179D, + /// 6046 - + #[error("")] + CreateV2Disabled = 0x179E, + /// 6047 - + #[error("")] + CpitializeMayhemFailed = 0x179F, + /// 6048 - + #[error("")] + MayhemModeDisabled = 0x17A0, } -#[allow(deprecated)] -impl solana_program_error::PrintProgramError for PumpError { - fn print(&self) { - solana_msg::msg!(&self.to_string()); +impl From for solana_program_error::ProgramError { + fn from(e: PumpError) -> Self { + solana_program_error::ProgramError::Custom(e as u32) } } - -#[allow(deprecated)] -impl solana_decode_error::DecodeError for PumpError { - fn type_of() -> &'static str { "PumpError" } -} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/admin_set_creator.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/admin_set_creator.rs new file mode 100644 index 00000000..6ad32c2e --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/admin_set_creator.rs @@ -0,0 +1,511 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +pub const ADMIN_SET_CREATOR_DISCRIMINATOR: [u8; 8] = [69, 25, 171, 142, 57, 239, 13, 4]; + +/// Accounts. +#[derive(Debug)] +pub struct AdminSetCreator { + pub admin_set_creator_authority: solana_pubkey::Pubkey, + + pub global: solana_pubkey::Pubkey, + + pub mint: solana_pubkey::Pubkey, + + pub bonding_curve: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl AdminSetCreator { + pub fn instruction( + &self, + args: AdminSetCreatorInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AdminSetCreatorInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.admin_set_creator_authority, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.bonding_curve, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AdminSetCreatorInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetCreatorInstructionData { + discriminator: [u8; 8], +} + +impl AdminSetCreatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [69, 25, 171, 142, 57, 239, 13, 4], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for AdminSetCreatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetCreatorInstructionArgs { + pub creator: Pubkey, +} + +impl AdminSetCreatorInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `AdminSetCreator`. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin_set_creator_authority +/// 1. `[]` global +/// 2. `[]` mint +/// 3. `[writable]` bonding_curve +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug, Default)] +pub struct AdminSetCreatorBuilder { + admin_set_creator_authority: Option, + global: Option, + mint: Option, + bonding_curve: Option, + event_authority: Option, + program: Option, + creator: Option, + __remaining_accounts: Vec, +} + +impl AdminSetCreatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn admin_set_creator_authority( + &mut self, + admin_set_creator_authority: solana_pubkey::Pubkey, + ) -> &mut Self { + self.admin_set_creator_authority = Some(admin_set_creator_authority); + self + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { + self.bonding_curve = Some(bonding_curve); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn creator(&mut self, creator: Pubkey) -> &mut Self { + self.creator = Some(creator); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = AdminSetCreator { + admin_set_creator_authority: self + .admin_set_creator_authority + .expect("admin_set_creator_authority is not set"), + global: self.global.expect("global is not set"), + mint: self.mint.expect("mint is not set"), + bonding_curve: self.bonding_curve.expect("bonding_curve is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = AdminSetCreatorInstructionArgs { + creator: self.creator.clone().expect("creator is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `admin_set_creator` CPI accounts. +pub struct AdminSetCreatorCpiAccounts<'a, 'b> { + pub admin_set_creator_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `admin_set_creator` CPI instruction. +pub struct AdminSetCreatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub admin_set_creator_authority: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AdminSetCreatorInstructionArgs, +} + +impl<'a, 'b> AdminSetCreatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: AdminSetCreatorCpiAccounts<'a, 'b>, + args: AdminSetCreatorInstructionArgs, + ) -> Self { + Self { + __program: program, + admin_set_creator_authority: accounts.admin_set_creator_authority, + global: accounts.global, + mint: accounts.mint, + bonding_curve: accounts.bonding_curve, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.admin_set_creator_authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.bonding_curve.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AdminSetCreatorInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.admin_set_creator_authority.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.bonding_curve.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AdminSetCreator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[signer]` admin_set_creator_authority +/// 1. `[]` global +/// 2. `[]` mint +/// 3. `[writable]` bonding_curve +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug)] +pub struct AdminSetCreatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AdminSetCreatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AdminSetCreatorCpiBuilderInstruction { + __program: program, + admin_set_creator_authority: None, + global: None, + mint: None, + bonding_curve: None, + event_authority: None, + program: None, + creator: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn admin_set_creator_authority( + &mut self, + admin_set_creator_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.admin_set_creator_authority = Some(admin_set_creator_authority); + self + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn bonding_curve( + &mut self, + bonding_curve: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.bonding_curve = Some(bonding_curve); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn creator(&mut self, creator: Pubkey) -> &mut Self { + self.instruction.creator = Some(creator); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = AdminSetCreatorInstructionArgs { + creator: self + .instruction + .creator + .clone() + .expect("creator is not set"), + }; + let instruction = AdminSetCreatorCpi { + __program: self.instruction.__program, + + admin_set_creator_authority: self + .instruction + .admin_set_creator_authority + .expect("admin_set_creator_authority is not set"), + + global: self.instruction.global.expect("global is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + bonding_curve: self + .instruction + .bonding_curve + .expect("bonding_curve is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct AdminSetCreatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + admin_set_creator_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + bonding_curve: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + creator: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/admin_set_idl_authority.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/admin_set_idl_authority.rs new file mode 100644 index 00000000..cc07e0f1 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/admin_set_idl_authority.rs @@ -0,0 +1,557 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +pub const ADMIN_SET_IDL_AUTHORITY_DISCRIMINATOR: [u8; 8] = [8, 217, 96, 231, 144, 104, 192, 5]; + +/// Accounts. +#[derive(Debug)] +pub struct AdminSetIdlAuthority { + pub authority: solana_pubkey::Pubkey, + + pub global: solana_pubkey::Pubkey, + + pub idl_account: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub program_signer: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl AdminSetIdlAuthority { + pub fn instruction( + &self, + args: AdminSetIdlAuthorityInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AdminSetIdlAuthorityInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(7 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.idl_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program_signer, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AdminSetIdlAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetIdlAuthorityInstructionData { + discriminator: [u8; 8], +} + +impl AdminSetIdlAuthorityInstructionData { + pub fn new() -> Self { + Self { + discriminator: [8, 217, 96, 231, 144, 104, 192, 5], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for AdminSetIdlAuthorityInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetIdlAuthorityInstructionArgs { + pub idl_authority: Pubkey, +} + +impl AdminSetIdlAuthorityInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `AdminSetIdlAuthority`. +/// +/// ### Accounts: +/// +/// 0. `[signer]` authority +/// 1. `[]` global +/// 2. `[writable]` idl_account +/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 4. `[]` program_signer +/// 5. `[]` event_authority +/// 6. `[]` program +#[derive(Clone, Debug, Default)] +pub struct AdminSetIdlAuthorityBuilder { + authority: Option, + global: Option, + idl_account: Option, + system_program: Option, + program_signer: Option, + event_authority: Option, + program: Option, + idl_authority: Option, + __remaining_accounts: Vec, +} + +impl AdminSetIdlAuthorityBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn idl_account(&mut self, idl_account: solana_pubkey::Pubkey) -> &mut Self { + self.idl_account = Some(idl_account); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn program_signer(&mut self, program_signer: solana_pubkey::Pubkey) -> &mut Self { + self.program_signer = Some(program_signer); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn idl_authority(&mut self, idl_authority: Pubkey) -> &mut Self { + self.idl_authority = Some(idl_authority); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = AdminSetIdlAuthority { + authority: self.authority.expect("authority is not set"), + global: self.global.expect("global is not set"), + idl_account: self.idl_account.expect("idl_account is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + program_signer: self.program_signer.expect("program_signer is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = AdminSetIdlAuthorityInstructionArgs { + idl_authority: self + .idl_authority + .clone() + .expect("idl_authority is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `admin_set_idl_authority` CPI accounts. +pub struct AdminSetIdlAuthorityCpiAccounts<'a, 'b> { + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub idl_account: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub program_signer: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `admin_set_idl_authority` CPI instruction. +pub struct AdminSetIdlAuthorityCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub idl_account: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub program_signer: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AdminSetIdlAuthorityInstructionArgs, +} + +impl<'a, 'b> AdminSetIdlAuthorityCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: AdminSetIdlAuthorityCpiAccounts<'a, 'b>, + args: AdminSetIdlAuthorityInstructionArgs, + ) -> Self { + Self { + __program: program, + authority: accounts.authority, + global: accounts.global, + idl_account: accounts.idl_account, + system_program: accounts.system_program, + program_signer: accounts.program_signer, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(7 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.idl_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program_signer.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AdminSetIdlAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.idl_account.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.program_signer.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AdminSetIdlAuthority` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[signer]` authority +/// 1. `[]` global +/// 2. `[writable]` idl_account +/// 3. `[]` system_program +/// 4. `[]` program_signer +/// 5. `[]` event_authority +/// 6. `[]` program +#[derive(Clone, Debug)] +pub struct AdminSetIdlAuthorityCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AdminSetIdlAuthorityCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AdminSetIdlAuthorityCpiBuilderInstruction { + __program: program, + authority: None, + global: None, + idl_account: None, + system_program: None, + program_signer: None, + event_authority: None, + program: None, + idl_authority: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn idl_account( + &mut self, + idl_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.idl_account = Some(idl_account); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn program_signer( + &mut self, + program_signer: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.program_signer = Some(program_signer); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn idl_authority(&mut self, idl_authority: Pubkey) -> &mut Self { + self.instruction.idl_authority = Some(idl_authority); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = AdminSetIdlAuthorityInstructionArgs { + idl_authority: self + .instruction + .idl_authority + .clone() + .expect("idl_authority is not set"), + }; + let instruction = AdminSetIdlAuthorityCpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + global: self.instruction.global.expect("global is not set"), + + idl_account: self + .instruction + .idl_account + .expect("idl_account is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + program_signer: self + .instruction + .program_signer + .expect("program_signer is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct AdminSetIdlAuthorityCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + authority: Option<&'b solana_account_info::AccountInfo<'a>>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + idl_account: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + program_signer: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + idl_authority: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/admin_update_token_incentives.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/admin_update_token_incentives.rs new file mode 100644 index 00000000..dc82a459 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/admin_update_token_incentives.rs @@ -0,0 +1,769 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const ADMIN_UPDATE_TOKEN_INCENTIVES_DISCRIMINATOR: [u8; 8] = + [209, 11, 115, 87, 213, 23, 124, 204]; + +/// Accounts. +#[derive(Debug)] +pub struct AdminUpdateTokenIncentives { + pub authority: solana_pubkey::Pubkey, + + pub global: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub mint: solana_pubkey::Pubkey, + + pub global_incentive_token_account: solana_pubkey::Pubkey, + + pub associated_token_program: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub token_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl AdminUpdateTokenIncentives { + pub fn instruction( + &self, + args: AdminUpdateTokenIncentivesInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AdminUpdateTokenIncentivesInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(10 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.authority, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_incentive_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AdminUpdateTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminUpdateTokenIncentivesInstructionData { + discriminator: [u8; 8], +} + +impl AdminUpdateTokenIncentivesInstructionData { + pub fn new() -> Self { + Self { + discriminator: [209, 11, 115, 87, 213, 23, 124, 204], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for AdminUpdateTokenIncentivesInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminUpdateTokenIncentivesInstructionArgs { + pub start_time: i64, + pub end_time: i64, + pub seconds_in_a_day: i64, + pub day_number: u64, + pub pump_token_supply_per_day: u64, +} + +impl AdminUpdateTokenIncentivesInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `AdminUpdateTokenIncentives`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` authority +/// 1. `[]` global +/// 2. `[writable]` global_volume_accumulator +/// 3. `[]` mint +/// 4. `[writable]` global_incentive_token_account +/// 5. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 6. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 7. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 8. `[]` event_authority +/// 9. `[]` program +#[derive(Clone, Debug, Default)] +pub struct AdminUpdateTokenIncentivesBuilder { + authority: Option, + global: Option, + global_volume_accumulator: Option, + mint: Option, + global_incentive_token_account: Option, + associated_token_program: Option, + system_program: Option, + token_program: Option, + event_authority: Option, + program: Option, + start_time: Option, + end_time: Option, + seconds_in_a_day: Option, + day_number: Option, + pump_token_supply_per_day: Option, + __remaining_accounts: Vec, +} + +impl AdminUpdateTokenIncentivesBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_incentive_token_account = Some(global_incentive_token_account); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn start_time(&mut self, start_time: i64) -> &mut Self { + self.start_time = Some(start_time); + self + } + #[inline(always)] + pub fn end_time(&mut self, end_time: i64) -> &mut Self { + self.end_time = Some(end_time); + self + } + #[inline(always)] + pub fn seconds_in_a_day(&mut self, seconds_in_a_day: i64) -> &mut Self { + self.seconds_in_a_day = Some(seconds_in_a_day); + self + } + #[inline(always)] + pub fn day_number(&mut self, day_number: u64) -> &mut Self { + self.day_number = Some(day_number); + self + } + #[inline(always)] + pub fn pump_token_supply_per_day(&mut self, pump_token_supply_per_day: u64) -> &mut Self { + self.pump_token_supply_per_day = Some(pump_token_supply_per_day); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = AdminUpdateTokenIncentives { + authority: self.authority.expect("authority is not set"), + global: self.global.expect("global is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + mint: self.mint.expect("mint is not set"), + global_incentive_token_account: self + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + associated_token_program: self.associated_token_program.unwrap_or( + solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = AdminUpdateTokenIncentivesInstructionArgs { + start_time: self.start_time.clone().expect("start_time is not set"), + end_time: self.end_time.clone().expect("end_time is not set"), + seconds_in_a_day: self + .seconds_in_a_day + .clone() + .expect("seconds_in_a_day is not set"), + day_number: self.day_number.clone().expect("day_number is not set"), + pump_token_supply_per_day: self + .pump_token_supply_per_day + .clone() + .expect("pump_token_supply_per_day is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `admin_update_token_incentives` CPI accounts. +pub struct AdminUpdateTokenIncentivesCpiAccounts<'a, 'b> { + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `admin_update_token_incentives` CPI instruction. +pub struct AdminUpdateTokenIncentivesCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AdminUpdateTokenIncentivesInstructionArgs, +} + +impl<'a, 'b> AdminUpdateTokenIncentivesCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: AdminUpdateTokenIncentivesCpiAccounts<'a, 'b>, + args: AdminUpdateTokenIncentivesInstructionArgs, + ) -> Self { + Self { + __program: program, + authority: accounts.authority, + global: accounts.global, + global_volume_accumulator: accounts.global_volume_accumulator, + mint: accounts.mint, + global_incentive_token_account: accounts.global_incentive_token_account, + associated_token_program: accounts.associated_token_program, + system_program: accounts.system_program, + token_program: accounts.token_program, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(10 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_incentive_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AdminUpdateTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.global_incentive_token_account.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AdminUpdateTokenIncentives` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` authority +/// 1. `[]` global +/// 2. `[writable]` global_volume_accumulator +/// 3. `[]` mint +/// 4. `[writable]` global_incentive_token_account +/// 5. `[]` associated_token_program +/// 6. `[]` system_program +/// 7. `[]` token_program +/// 8. `[]` event_authority +/// 9. `[]` program +#[derive(Clone, Debug)] +pub struct AdminUpdateTokenIncentivesCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AdminUpdateTokenIncentivesCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AdminUpdateTokenIncentivesCpiBuilderInstruction { + __program: program, + authority: None, + global: None, + global_volume_accumulator: None, + mint: None, + global_incentive_token_account: None, + associated_token_program: None, + system_program: None, + token_program: None, + event_authority: None, + program: None, + start_time: None, + end_time: None, + seconds_in_a_day: None, + day_number: None, + pump_token_supply_per_day: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_incentive_token_account = Some(global_incentive_token_account); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn start_time(&mut self, start_time: i64) -> &mut Self { + self.instruction.start_time = Some(start_time); + self + } + #[inline(always)] + pub fn end_time(&mut self, end_time: i64) -> &mut Self { + self.instruction.end_time = Some(end_time); + self + } + #[inline(always)] + pub fn seconds_in_a_day(&mut self, seconds_in_a_day: i64) -> &mut Self { + self.instruction.seconds_in_a_day = Some(seconds_in_a_day); + self + } + #[inline(always)] + pub fn day_number(&mut self, day_number: u64) -> &mut Self { + self.instruction.day_number = Some(day_number); + self + } + #[inline(always)] + pub fn pump_token_supply_per_day(&mut self, pump_token_supply_per_day: u64) -> &mut Self { + self.instruction.pump_token_supply_per_day = Some(pump_token_supply_per_day); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = AdminUpdateTokenIncentivesInstructionArgs { + start_time: self + .instruction + .start_time + .clone() + .expect("start_time is not set"), + end_time: self + .instruction + .end_time + .clone() + .expect("end_time is not set"), + seconds_in_a_day: self + .instruction + .seconds_in_a_day + .clone() + .expect("seconds_in_a_day is not set"), + day_number: self + .instruction + .day_number + .clone() + .expect("day_number is not set"), + pump_token_supply_per_day: self + .instruction + .pump_token_supply_per_day + .clone() + .expect("pump_token_supply_per_day is not set"), + }; + let instruction = AdminUpdateTokenIncentivesCpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + global: self.instruction.global.expect("global is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + global_incentive_token_account: self + .instruction + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct AdminUpdateTokenIncentivesCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + authority: Option<&'b solana_account_info::AccountInfo<'a>>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + global_incentive_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + start_time: Option, + end_time: Option, + seconds_in_a_day: Option, + day_number: Option, + pump_token_supply_per_day: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/buy.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/buy.rs index ec164aba..a3a38f4f 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/buy.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/buy.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const BUY_DISCRIMINATOR: [u8; 8] = [102, 6, 61, 18, 1, 218, 235, 234]; /// Accounts. #[derive(Debug)] @@ -33,13 +36,20 @@ pub struct Buy { pub event_authority: solana_pubkey::Pubkey, pub program: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub fee_program: solana_pubkey::Pubkey, } impl Buy { pub fn instruction(&self, args: BuyInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -47,7 +57,7 @@ impl Buy { args: BuyInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta], ) -> solana_instruction::Instruction { - let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + let mut accounts = Vec::with_capacity(16 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( self.global, false, @@ -92,9 +102,25 @@ impl Buy { self.program, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_program, + false, + )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&BuyInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = BuyInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -117,10 +143,16 @@ impl BuyInstructionData { discriminator: [102, 6, 61, 18, 1, 218, 235, 234], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for BuyInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -130,6 +162,12 @@ pub struct BuyInstructionArgs { pub max_sol_cost: u64, } +impl BuyInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Buy`. /// /// ### Accounts: @@ -145,7 +183,11 @@ pub struct BuyInstructionArgs { /// 8. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) /// 9. `[writable]` creator_vault /// 10. `[]` event_authority -/// 11. `[]` program +/// 11. `[optional]` program (default to `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`) +/// 12. `[]` global_volume_accumulator +/// 13. `[writable]` user_volume_accumulator +/// 14. `[]` fee_config +/// 15. `[optional]` fee_program (default to `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`) #[derive(Clone, Debug, Default)] pub struct BuyBuilder { global: Option, @@ -160,38 +202,39 @@ pub struct BuyBuilder { creator_vault: Option, event_authority: Option, program: Option, + global_volume_accumulator: Option, + user_volume_accumulator: Option, + fee_config: Option, + fee_program: Option, amount: Option, max_sol_cost: Option, __remaining_accounts: Vec, } impl BuyBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn fee_recipient(&mut self, fee_recipient: solana_pubkey::Pubkey) -> &mut Self { self.fee_recipient = Some(fee_recipient); self } - #[inline(always)] pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { self.mint = Some(mint); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -200,70 +243,87 @@ impl BuyBuilder { self.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn associated_user(&mut self, associated_user: solana_pubkey::Pubkey) -> &mut Self { self.associated_user = Some(associated_user); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` #[inline(always)] pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { self.token_program = Some(token_program); self } - #[inline(always)] pub fn creator_vault(&mut self, creator_vault: solana_pubkey::Pubkey) -> &mut Self { self.creator_vault = Some(creator_vault); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - + /// `[optional account, default to '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P']` #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to 'pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ']` + #[inline(always)] + pub fn fee_program(&mut self, fee_program: solana_pubkey::Pubkey) -> &mut Self { + self.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn amount(&mut self, amount: u64) -> &mut Self { self.amount = Some(amount); self } - #[inline(always)] pub fn max_sol_cost(&mut self, max_sol_cost: u64) -> &mut Self { self.max_sol_cost = Some(max_sol_cost); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -273,7 +333,6 @@ impl BuyBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Buy { @@ -294,7 +353,19 @@ impl BuyBuilder { )), creator_vault: self.creator_vault.expect("creator_vault is not set"), event_authority: self.event_authority.expect("event_authority is not set"), - program: self.program.expect("program is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + )), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + fee_config: self.fee_config.expect("fee_config is not set"), + fee_program: self.fee_program.unwrap_or(solana_pubkey::pubkey!( + "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + )), }; let args = BuyInstructionArgs { amount: self.amount.clone().expect("amount is not set"), @@ -330,6 +401,14 @@ pub struct BuyCpiAccounts<'a, 'b> { pub event_authority: &'b solana_account_info::AccountInfo<'a>, pub program: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, } /// `buy` CPI instruction. @@ -360,6 +439,14 @@ pub struct BuyCpi<'a, 'b> { pub event_authority: &'b solana_account_info::AccountInfo<'a>, pub program: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, /// The arguments for the instruction. pub __args: BuyInstructionArgs, } @@ -384,31 +471,28 @@ impl<'a, 'b> BuyCpi<'a, 'b> { creator_vault: accounts.creator_vault, event_authority: accounts.event_authority, program: accounts.program, + global_volume_accumulator: accounts.global_volume_accumulator, + user_volume_accumulator: accounts.user_volume_accumulator, + fee_config: accounts.fee_config, + fee_program: accounts.fee_program, __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -416,8 +500,8 @@ impl<'a, 'b> BuyCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(16 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.global.key, false, @@ -463,6 +547,22 @@ impl<'a, 'b> BuyCpi<'a, 'b> { *self.program.key, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_program.key, + false, + )); remaining_accounts.iter().for_each(|remaining_account| { accounts.push(solana_instruction::AccountMeta { pubkey: *remaining_account.0.key, @@ -470,8 +570,8 @@ impl<'a, 'b> BuyCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&BuyInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = BuyInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -479,7 +579,7 @@ impl<'a, 'b> BuyCpi<'a, 'b> { accounts, data, }; - let mut account_infos = Vec::with_capacity(13 + remaining_accounts.len()); + let mut account_infos = Vec::with_capacity(17 + remaining_accounts.len()); account_infos.push(self.__program.clone()); account_infos.push(self.global.clone()); account_infos.push(self.fee_recipient.clone()); @@ -493,6 +593,10 @@ impl<'a, 'b> BuyCpi<'a, 'b> { account_infos.push(self.creator_vault.clone()); account_infos.push(self.event_authority.clone()); account_infos.push(self.program.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.fee_program.clone()); remaining_accounts .iter() .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); @@ -521,6 +625,10 @@ impl<'a, 'b> BuyCpi<'a, 'b> { /// 9. `[writable]` creator_vault /// 10. `[]` event_authority /// 11. `[]` program +/// 12. `[]` global_volume_accumulator +/// 13. `[writable]` user_volume_accumulator +/// 14. `[]` fee_config +/// 15. `[]` fee_program #[derive(Clone, Debug)] pub struct BuyCpiBuilder<'a, 'b> { instruction: Box>, @@ -542,19 +650,21 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { creator_vault: None, event_authority: None, program: None, + global_volume_accumulator: None, + user_volume_accumulator: None, + fee_config: None, + fee_program: None, amount: None, max_sol_cost: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn fee_recipient( &mut self, @@ -563,13 +673,11 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.fee_recipient = Some(fee_recipient); self } - #[inline(always)] pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.mint = Some(mint); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -578,7 +686,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -587,7 +694,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn associated_user( &mut self, @@ -596,13 +702,11 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.associated_user = Some(associated_user); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -611,7 +715,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn token_program( &mut self, @@ -620,7 +723,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.token_program = Some(token_program); self } - #[inline(always)] pub fn creator_vault( &mut self, @@ -629,7 +731,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.creator_vault = Some(creator_vault); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -638,25 +739,53 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn fee_program( + &mut self, + fee_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn amount(&mut self, amount: u64) -> &mut Self { self.instruction.amount = Some(amount); self } - #[inline(always)] pub fn max_sol_cost(&mut self, max_sol_cost: u64) -> &mut Self { self.instruction.max_sol_cost = Some(max_sol_cost); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -670,7 +799,6 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -685,16 +813,13 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = BuyInstructionArgs { amount: self.instruction.amount.clone().expect("amount is not set"), max_sol_cost: self @@ -753,6 +878,23 @@ impl<'a, 'b> BuyCpiBuilder<'a, 'b> { .expect("event_authority is not set"), program: self.instruction.program.expect("program is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + fee_program: self + .instruction + .fee_program + .expect("fee_program is not set"), __args: args, }; instruction.invoke_signed_with_remaining_accounts( @@ -777,6 +919,10 @@ struct BuyCpiBuilderInstruction<'a, 'b> { creator_vault: Option<&'b solana_account_info::AccountInfo<'a>>, event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, program: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_program: Option<&'b solana_account_info::AccountInfo<'a>>, amount: Option, max_sol_cost: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/buy_exact_sol_in.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/buy_exact_sol_in.rs new file mode 100644 index 00000000..cb6bf8d5 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/buy_exact_sol_in.rs @@ -0,0 +1,943 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const BUY_EXACT_SOL_IN_DISCRIMINATOR: [u8; 8] = [56, 252, 116, 8, 158, 223, 205, 95]; + +/// Accounts. +#[derive(Debug)] +pub struct BuyExactSolIn { + pub global: solana_pubkey::Pubkey, + + pub fee_recipient: solana_pubkey::Pubkey, + + pub mint: solana_pubkey::Pubkey, + + pub bonding_curve: solana_pubkey::Pubkey, + + pub associated_bonding_curve: solana_pubkey::Pubkey, + + pub associated_user: solana_pubkey::Pubkey, + + pub user: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub token_program: solana_pubkey::Pubkey, + + pub creator_vault: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub fee_program: solana_pubkey::Pubkey, +} + +impl BuyExactSolIn { + pub fn instruction( + &self, + args: BuyExactSolInInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: BuyExactSolInInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(16 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.fee_recipient, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.bonding_curve, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.associated_bonding_curve, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.associated_user, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.user, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.creator_vault, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = BuyExactSolInInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct BuyExactSolInInstructionData { + discriminator: [u8; 8], +} + +impl BuyExactSolInInstructionData { + pub fn new() -> Self { + Self { + discriminator: [56, 252, 116, 8, 158, 223, 205, 95], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for BuyExactSolInInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct BuyExactSolInInstructionArgs { + pub spendable_sol_in: u64, + pub min_tokens_out: u64, +} + +impl BuyExactSolInInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `BuyExactSolIn`. +/// +/// ### Accounts: +/// +/// 0. `[]` global +/// 1. `[writable]` fee_recipient +/// 2. `[]` mint +/// 3. `[writable]` bonding_curve +/// 4. `[writable]` associated_bonding_curve +/// 5. `[writable]` associated_user +/// 6. `[writable, signer]` user +/// 7. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 8. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 9. `[writable]` creator_vault +/// 10. `[]` event_authority +/// 11. `[optional]` program (default to `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`) +/// 12. `[]` global_volume_accumulator +/// 13. `[writable]` user_volume_accumulator +/// 14. `[]` fee_config +/// 15. `[optional]` fee_program (default to `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`) +#[derive(Clone, Debug, Default)] +pub struct BuyExactSolInBuilder { + global: Option, + fee_recipient: Option, + mint: Option, + bonding_curve: Option, + associated_bonding_curve: Option, + associated_user: Option, + user: Option, + system_program: Option, + token_program: Option, + creator_vault: Option, + event_authority: Option, + program: Option, + global_volume_accumulator: Option, + user_volume_accumulator: Option, + fee_config: Option, + fee_program: Option, + spendable_sol_in: Option, + min_tokens_out: Option, + __remaining_accounts: Vec, +} + +impl BuyExactSolInBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn fee_recipient(&mut self, fee_recipient: solana_pubkey::Pubkey) -> &mut Self { + self.fee_recipient = Some(fee_recipient); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { + self.bonding_curve = Some(bonding_curve); + self + } + #[inline(always)] + pub fn associated_bonding_curve( + &mut self, + associated_bonding_curve: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_bonding_curve = Some(associated_bonding_curve); + self + } + #[inline(always)] + pub fn associated_user(&mut self, associated_user: solana_pubkey::Pubkey) -> &mut Self { + self.associated_user = Some(associated_user); + self + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn creator_vault(&mut self, creator_vault: solana_pubkey::Pubkey) -> &mut Self { + self.creator_vault = Some(creator_vault); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + /// `[optional account, default to '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P']` + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to 'pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ']` + #[inline(always)] + pub fn fee_program(&mut self, fee_program: solana_pubkey::Pubkey) -> &mut Self { + self.fee_program = Some(fee_program); + self + } + #[inline(always)] + pub fn spendable_sol_in(&mut self, spendable_sol_in: u64) -> &mut Self { + self.spendable_sol_in = Some(spendable_sol_in); + self + } + #[inline(always)] + pub fn min_tokens_out(&mut self, min_tokens_out: u64) -> &mut Self { + self.min_tokens_out = Some(min_tokens_out); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = BuyExactSolIn { + global: self.global.expect("global is not set"), + fee_recipient: self.fee_recipient.expect("fee_recipient is not set"), + mint: self.mint.expect("mint is not set"), + bonding_curve: self.bonding_curve.expect("bonding_curve is not set"), + associated_bonding_curve: self + .associated_bonding_curve + .expect("associated_bonding_curve is not set"), + associated_user: self.associated_user.expect("associated_user is not set"), + user: self.user.expect("user is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + creator_vault: self.creator_vault.expect("creator_vault is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + )), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + fee_config: self.fee_config.expect("fee_config is not set"), + fee_program: self.fee_program.unwrap_or(solana_pubkey::pubkey!( + "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + )), + }; + let args = BuyExactSolInInstructionArgs { + spendable_sol_in: self + .spendable_sol_in + .clone() + .expect("spendable_sol_in is not set"), + min_tokens_out: self + .min_tokens_out + .clone() + .expect("min_tokens_out is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `buy_exact_sol_in` CPI accounts. +pub struct BuyExactSolInCpiAccounts<'a, 'b> { + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub fee_recipient: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub associated_bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub associated_user: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub creator_vault: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `buy_exact_sol_in` CPI instruction. +pub struct BuyExactSolInCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub fee_recipient: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub associated_bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub associated_user: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub creator_vault: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: BuyExactSolInInstructionArgs, +} + +impl<'a, 'b> BuyExactSolInCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: BuyExactSolInCpiAccounts<'a, 'b>, + args: BuyExactSolInInstructionArgs, + ) -> Self { + Self { + __program: program, + global: accounts.global, + fee_recipient: accounts.fee_recipient, + mint: accounts.mint, + bonding_curve: accounts.bonding_curve, + associated_bonding_curve: accounts.associated_bonding_curve, + associated_user: accounts.associated_user, + user: accounts.user, + system_program: accounts.system_program, + token_program: accounts.token_program, + creator_vault: accounts.creator_vault, + event_authority: accounts.event_authority, + program: accounts.program, + global_volume_accumulator: accounts.global_volume_accumulator, + user_volume_accumulator: accounts.user_volume_accumulator, + fee_config: accounts.fee_config, + fee_program: accounts.fee_program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(16 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.fee_recipient.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.bonding_curve.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.associated_bonding_curve.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.associated_user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.creator_vault.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = BuyExactSolInInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(17 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.fee_recipient.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.bonding_curve.clone()); + account_infos.push(self.associated_bonding_curve.clone()); + account_infos.push(self.associated_user.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.creator_vault.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.fee_program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `BuyExactSolIn` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` global +/// 1. `[writable]` fee_recipient +/// 2. `[]` mint +/// 3. `[writable]` bonding_curve +/// 4. `[writable]` associated_bonding_curve +/// 5. `[writable]` associated_user +/// 6. `[writable, signer]` user +/// 7. `[]` system_program +/// 8. `[]` token_program +/// 9. `[writable]` creator_vault +/// 10. `[]` event_authority +/// 11. `[]` program +/// 12. `[]` global_volume_accumulator +/// 13. `[writable]` user_volume_accumulator +/// 14. `[]` fee_config +/// 15. `[]` fee_program +#[derive(Clone, Debug)] +pub struct BuyExactSolInCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> BuyExactSolInCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(BuyExactSolInCpiBuilderInstruction { + __program: program, + global: None, + fee_recipient: None, + mint: None, + bonding_curve: None, + associated_bonding_curve: None, + associated_user: None, + user: None, + system_program: None, + token_program: None, + creator_vault: None, + event_authority: None, + program: None, + global_volume_accumulator: None, + user_volume_accumulator: None, + fee_config: None, + fee_program: None, + spendable_sol_in: None, + min_tokens_out: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn fee_recipient( + &mut self, + fee_recipient: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_recipient = Some(fee_recipient); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn bonding_curve( + &mut self, + bonding_curve: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.bonding_curve = Some(bonding_curve); + self + } + #[inline(always)] + pub fn associated_bonding_curve( + &mut self, + associated_bonding_curve: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_bonding_curve = Some(associated_bonding_curve); + self + } + #[inline(always)] + pub fn associated_user( + &mut self, + associated_user: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_user = Some(associated_user); + self + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn creator_vault( + &mut self, + creator_vault: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.creator_vault = Some(creator_vault); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn fee_program( + &mut self, + fee_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_program = Some(fee_program); + self + } + #[inline(always)] + pub fn spendable_sol_in(&mut self, spendable_sol_in: u64) -> &mut Self { + self.instruction.spendable_sol_in = Some(spendable_sol_in); + self + } + #[inline(always)] + pub fn min_tokens_out(&mut self, min_tokens_out: u64) -> &mut Self { + self.instruction.min_tokens_out = Some(min_tokens_out); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = BuyExactSolInInstructionArgs { + spendable_sol_in: self + .instruction + .spendable_sol_in + .clone() + .expect("spendable_sol_in is not set"), + min_tokens_out: self + .instruction + .min_tokens_out + .clone() + .expect("min_tokens_out is not set"), + }; + let instruction = BuyExactSolInCpi { + __program: self.instruction.__program, + + global: self.instruction.global.expect("global is not set"), + + fee_recipient: self + .instruction + .fee_recipient + .expect("fee_recipient is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + bonding_curve: self + .instruction + .bonding_curve + .expect("bonding_curve is not set"), + + associated_bonding_curve: self + .instruction + .associated_bonding_curve + .expect("associated_bonding_curve is not set"), + + associated_user: self + .instruction + .associated_user + .expect("associated_user is not set"), + + user: self.instruction.user.expect("user is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + creator_vault: self + .instruction + .creator_vault + .expect("creator_vault is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + fee_program: self + .instruction + .fee_program + .expect("fee_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct BuyExactSolInCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_recipient: Option<&'b solana_account_info::AccountInfo<'a>>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + bonding_curve: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_bonding_curve: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_user: Option<&'b solana_account_info::AccountInfo<'a>>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + creator_vault: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_program: Option<&'b solana_account_info::AccountInfo<'a>>, + spendable_sol_in: Option, + min_tokens_out: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/claim_token_incentives.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/claim_token_incentives.rs new file mode 100644 index 00000000..80fcc810 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/claim_token_incentives.rs @@ -0,0 +1,709 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const CLAIM_TOKEN_INCENTIVES_DISCRIMINATOR: [u8; 8] = [16, 4, 71, 28, 204, 1, 40, 27]; + +/// Accounts. +#[derive(Debug)] +pub struct ClaimTokenIncentives { + pub user: solana_pubkey::Pubkey, + + pub user_ata: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub global_incentive_token_account: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub mint: solana_pubkey::Pubkey, + + pub token_program: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub associated_token_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, + + pub payer: solana_pubkey::Pubkey, +} + +impl ClaimTokenIncentives { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.user_ata, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.global_incentive_token_account, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.payer, true)); + accounts.extend_from_slice(remaining_accounts); + let data = ClaimTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ClaimTokenIncentivesInstructionData { + discriminator: [u8; 8], +} + +impl ClaimTokenIncentivesInstructionData { + pub fn new() -> Self { + Self { + discriminator: [16, 4, 71, 28, 204, 1, 40, 27], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for ClaimTokenIncentivesInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `ClaimTokenIncentives`. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[writable]` user_ata +/// 2. `[]` global_volume_accumulator +/// 3. `[writable]` global_incentive_token_account +/// 4. `[writable]` user_volume_accumulator +/// 5. `[]` mint +/// 6. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 7. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 8. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 9. `[]` event_authority +/// 10. `[optional]` program (default to `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`) +/// 11. `[writable, signer]` payer +#[derive(Clone, Debug, Default)] +pub struct ClaimTokenIncentivesBuilder { + user: Option, + user_ata: Option, + global_volume_accumulator: Option, + global_incentive_token_account: Option, + user_volume_accumulator: Option, + mint: Option, + token_program: Option, + system_program: Option, + associated_token_program: Option, + event_authority: Option, + program: Option, + payer: Option, + __remaining_accounts: Vec, +} + +impl ClaimTokenIncentivesBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn user_ata(&mut self, user_ata: solana_pubkey::Pubkey) -> &mut Self { + self.user_ata = Some(user_ata); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_incentive_token_account = Some(global_incentive_token_account); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + /// `[optional account, default to '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P']` + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = ClaimTokenIncentives { + user: self.user.expect("user is not set"), + user_ata: self.user_ata.expect("user_ata is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + global_incentive_token_account: self + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + mint: self.mint.expect("mint is not set"), + token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + associated_token_program: self.associated_token_program.unwrap_or( + solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + )), + payer: self.payer.expect("payer is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `claim_token_incentives` CPI accounts. +pub struct ClaimTokenIncentivesCpiAccounts<'a, 'b> { + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_ata: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub payer: &'b solana_account_info::AccountInfo<'a>, +} + +/// `claim_token_incentives` CPI instruction. +pub struct ClaimTokenIncentivesCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_ata: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + + pub payer: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> ClaimTokenIncentivesCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: ClaimTokenIncentivesCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + user: accounts.user, + user_ata: accounts.user_ata, + global_volume_accumulator: accounts.global_volume_accumulator, + global_incentive_token_account: accounts.global_incentive_token_account, + user_volume_accumulator: accounts.user_volume_accumulator, + mint: accounts.mint, + token_program: accounts.token_program, + system_program: accounts.system_program, + associated_token_program: accounts.associated_token_program, + event_authority: accounts.event_authority, + program: accounts.program, + payer: accounts.payer, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_ata.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.global_incentive_token_account.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(*self.payer.key, true)); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = ClaimTokenIncentivesInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(13 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.user_ata.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.global_incentive_token_account.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + account_infos.push(self.payer.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ClaimTokenIncentives` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[writable]` user_ata +/// 2. `[]` global_volume_accumulator +/// 3. `[writable]` global_incentive_token_account +/// 4. `[writable]` user_volume_accumulator +/// 5. `[]` mint +/// 6. `[]` token_program +/// 7. `[]` system_program +/// 8. `[]` associated_token_program +/// 9. `[]` event_authority +/// 10. `[]` program +/// 11. `[writable, signer]` payer +#[derive(Clone, Debug)] +pub struct ClaimTokenIncentivesCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ClaimTokenIncentivesCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ClaimTokenIncentivesCpiBuilderInstruction { + __program: program, + user: None, + user_ata: None, + global_volume_accumulator: None, + global_incentive_token_account: None, + user_volume_accumulator: None, + mint: None, + token_program: None, + system_program: None, + associated_token_program: None, + event_authority: None, + program: None, + payer: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn user_ata(&mut self, user_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user_ata = Some(user_ata); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn global_incentive_token_account( + &mut self, + global_incentive_token_account: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_incentive_token_account = Some(global_incentive_token_account); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = ClaimTokenIncentivesCpi { + __program: self.instruction.__program, + + user: self.instruction.user.expect("user is not set"), + + user_ata: self.instruction.user_ata.expect("user_ata is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + global_incentive_token_account: self + .instruction + .global_incentive_token_account + .expect("global_incentive_token_account is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct ClaimTokenIncentivesCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + user_ata: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + global_incentive_token_account: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + payer: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/close_user_volume_accumulator.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/close_user_volume_accumulator.rs new file mode 100644 index 00000000..0b96a6a7 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/close_user_volume_accumulator.rs @@ -0,0 +1,388 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const CLOSE_USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = + [249, 69, 164, 218, 150, 103, 84, 138]; + +/// Accounts. +#[derive(Debug)] +pub struct CloseUserVolumeAccumulator { + pub user: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl CloseUserVolumeAccumulator { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.user, true)); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = CloseUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CloseUserVolumeAccumulatorInstructionData { + discriminator: [u8; 8], +} + +impl CloseUserVolumeAccumulatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [249, 69, 164, 218, 150, 103, 84, 138], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for CloseUserVolumeAccumulatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `CloseUserVolumeAccumulator`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` user +/// 1. `[writable]` user_volume_accumulator +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct CloseUserVolumeAccumulatorBuilder { + user: Option, + user_volume_accumulator: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl CloseUserVolumeAccumulatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = CloseUserVolumeAccumulator { + user: self.user.expect("user is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `close_user_volume_accumulator` CPI accounts. +pub struct CloseUserVolumeAccumulatorCpiAccounts<'a, 'b> { + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `close_user_volume_accumulator` CPI instruction. +pub struct CloseUserVolumeAccumulatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> CloseUserVolumeAccumulatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: CloseUserVolumeAccumulatorCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + user: accounts.user, + user_volume_accumulator: accounts.user_volume_accumulator, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = CloseUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `CloseUserVolumeAccumulator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` user +/// 1. `[writable]` user_volume_accumulator +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct CloseUserVolumeAccumulatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> CloseUserVolumeAccumulatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CloseUserVolumeAccumulatorCpiBuilderInstruction { + __program: program, + user: None, + user_volume_accumulator: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = CloseUserVolumeAccumulatorCpi { + __program: self.instruction.__program, + + user: self.instruction.user.expect("user is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct CloseUserVolumeAccumulatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/collect_creator_fee.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/collect_creator_fee.rs index 544e115a..14d0888c 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/collect_creator_fee.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/collect_creator_fee.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const COLLECT_CREATOR_FEE_DISCRIMINATOR: [u8; 8] = [20, 22, 86, 123, 198, 28, 219, 132]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl CollectCreatorFee { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -33,7 +35,7 @@ impl CollectCreatorFee { remaining_accounts: &[solana_instruction::AccountMeta], ) -> solana_instruction::Instruction { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); - accounts.push(solana_instruction::AccountMeta::new(self.creator, true)); + accounts.push(solana_instruction::AccountMeta::new(self.creator, false)); accounts.push(solana_instruction::AccountMeta::new( self.creator_vault, false, @@ -51,7 +53,9 @@ impl CollectCreatorFee { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&CollectCreatorFeeInstructionData::new()).unwrap(); + let data = CollectCreatorFeeInstructionData::new() + .try_to_vec() + .unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -73,17 +77,23 @@ impl CollectCreatorFeeInstructionData { discriminator: [20, 22, 86, 123, 198, 28, 219, 132], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for CollectCreatorFeeInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `CollectCreatorFee`. /// /// ### Accounts: /// -/// 0. `[writable, signer]` creator +/// 0. `[writable]` creator /// 1. `[writable]` creator_vault /// 2. `[optional]` system_program (default to `11111111111111111111111111111111`) /// 3. `[]` event_authority @@ -99,46 +109,41 @@ pub struct CollectCreatorFeeBuilder { } impl CollectCreatorFeeBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn creator(&mut self, creator: solana_pubkey::Pubkey) -> &mut Self { self.creator = Some(creator); self } - #[inline(always)] pub fn creator_vault(&mut self, creator_vault: solana_pubkey::Pubkey) -> &mut Self { self.creator_vault = Some(creator_vault); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -148,7 +153,6 @@ impl CollectCreatorFeeBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = CollectCreatorFee { @@ -208,28 +212,21 @@ impl<'a, 'b> CollectCreatorFeeCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -237,11 +234,11 @@ impl<'a, 'b> CollectCreatorFeeCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new( *self.creator.key, - true, + false, )); accounts.push(solana_instruction::AccountMeta::new( *self.creator_vault.key, @@ -266,7 +263,9 @@ impl<'a, 'b> CollectCreatorFeeCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&CollectCreatorFeeInstructionData::new()).unwrap(); + let data = CollectCreatorFeeInstructionData::new() + .try_to_vec() + .unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -296,7 +295,7 @@ impl<'a, 'b> CollectCreatorFeeCpi<'a, 'b> { /// /// ### Accounts: /// -/// 0. `[writable, signer]` creator +/// 0. `[writable]` creator /// 1. `[writable]` creator_vault /// 2. `[]` system_program /// 3. `[]` event_authority @@ -319,13 +318,11 @@ impl<'a, 'b> CollectCreatorFeeCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn creator(&mut self, creator: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.creator = Some(creator); self } - #[inline(always)] pub fn creator_vault( &mut self, @@ -334,7 +331,6 @@ impl<'a, 'b> CollectCreatorFeeCpiBuilder<'a, 'b> { self.instruction.creator_vault = Some(creator_vault); self } - #[inline(always)] pub fn system_program( &mut self, @@ -343,7 +339,6 @@ impl<'a, 'b> CollectCreatorFeeCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -352,13 +347,11 @@ impl<'a, 'b> CollectCreatorFeeCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -372,7 +365,6 @@ impl<'a, 'b> CollectCreatorFeeCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -387,16 +379,13 @@ impl<'a, 'b> CollectCreatorFeeCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = CollectCreatorFeeCpi { __program: self.instruction.__program, diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/create.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/create.rs index 67508303..fa30fed2 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/create.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/create.rs @@ -5,9 +5,12 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +pub const CREATE_DISCRIMINATOR: [u8; 8] = [24, 30, 200, 40, 5, 28, 7, 119]; + /// Accounts. #[derive(Debug)] pub struct Create { @@ -44,7 +47,6 @@ impl Create { pub fn instruction(&self, args: CreateInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -100,8 +102,8 @@ impl Create { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&CreateInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = CreateInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -124,10 +126,16 @@ impl CreateInstructionData { discriminator: [24, 30, 200, 40, 5, 28, 7, 119], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for CreateInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -139,6 +147,12 @@ pub struct CreateInstructionArgs { pub creator: Pubkey, } +impl CreateInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Create`. /// /// ### Accounts: @@ -181,26 +195,24 @@ pub struct CreateBuilder { } impl CreateBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { self.mint = Some(mint); self } - #[inline(always)] pub fn mint_authority(&mut self, mint_authority: solana_pubkey::Pubkey) -> &mut Self { self.mint_authority = Some(mint_authority); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -209,46 +221,39 @@ impl CreateBuilder { self.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - /// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']` #[inline(always)] pub fn mpl_token_metadata(&mut self, mpl_token_metadata: solana_pubkey::Pubkey) -> &mut Self { self.mpl_token_metadata = Some(mpl_token_metadata); self } - #[inline(always)] pub fn metadata(&mut self, metadata: solana_pubkey::Pubkey) -> &mut Self { self.metadata = Some(metadata); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` #[inline(always)] pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { self.token_program = Some(token_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` #[inline(always)] pub fn associated_token_program( @@ -258,57 +263,48 @@ impl CreateBuilder { self.associated_token_program = Some(associated_token_program); self } - /// `[optional account, default to 'SysvarRent111111111111111111111111111111111']` #[inline(always)] pub fn rent(&mut self, rent: solana_pubkey::Pubkey) -> &mut Self { self.rent = Some(rent); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn name(&mut self, name: String) -> &mut Self { self.name = Some(name); self } - #[inline(always)] pub fn symbol(&mut self, symbol: String) -> &mut Self { self.symbol = Some(symbol); self } - #[inline(always)] pub fn uri(&mut self, uri: String) -> &mut Self { self.uri = Some(uri); self } - #[inline(always)] pub fn creator(&mut self, creator: Pubkey) -> &mut Self { self.creator = Some(creator); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -318,7 +314,6 @@ impl CreateBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Create { @@ -452,28 +447,21 @@ impl<'a, 'b> CreateCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -481,7 +469,7 @@ impl<'a, 'b> CreateCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(14 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new(*self.mint.key, true)); accounts.push(solana_instruction::AccountMeta::new_readonly( @@ -540,8 +528,8 @@ impl<'a, 'b> CreateCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&CreateInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = CreateInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -626,13 +614,11 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.mint = Some(mint); self } - #[inline(always)] pub fn mint_authority( &mut self, @@ -641,7 +627,6 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.mint_authority = Some(mint_authority); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -650,7 +635,6 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -659,13 +643,11 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn mpl_token_metadata( &mut self, @@ -674,19 +656,16 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.mpl_token_metadata = Some(mpl_token_metadata); self } - #[inline(always)] pub fn metadata(&mut self, metadata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.metadata = Some(metadata); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -695,7 +674,6 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn token_program( &mut self, @@ -704,7 +682,6 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.token_program = Some(token_program); self } - #[inline(always)] pub fn associated_token_program( &mut self, @@ -713,13 +690,11 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn rent(&mut self, rent: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.rent = Some(rent); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -728,37 +703,31 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn name(&mut self, name: String) -> &mut Self { self.instruction.name = Some(name); self } - #[inline(always)] pub fn symbol(&mut self, symbol: String) -> &mut Self { self.instruction.symbol = Some(symbol); self } - #[inline(always)] pub fn uri(&mut self, uri: String) -> &mut Self { self.instruction.uri = Some(uri); self } - #[inline(always)] pub fn creator(&mut self, creator: Pubkey) -> &mut Self { self.instruction.creator = Some(creator); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -772,7 +741,6 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -787,16 +755,13 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = CreateInstructionArgs { name: self.instruction.name.clone().expect("name is not set"), symbol: self.instruction.symbol.clone().expect("symbol is not set"), diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/create_v2.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/create_v2.rs new file mode 100644 index 00000000..fe2924fe --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/create_v2.rs @@ -0,0 +1,970 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +pub const CREATE_V2_DISCRIMINATOR: [u8; 8] = [214, 144, 76, 236, 95, 139, 49, 180]; + +/// Accounts. +#[derive(Debug)] +pub struct CreateV2 { + pub mint: solana_pubkey::Pubkey, + + pub mint_authority: solana_pubkey::Pubkey, + + pub bonding_curve: solana_pubkey::Pubkey, + + pub associated_bonding_curve: solana_pubkey::Pubkey, + + pub global: solana_pubkey::Pubkey, + + pub user: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub token_program: solana_pubkey::Pubkey, + + pub associated_token_program: solana_pubkey::Pubkey, + + pub mayhem_program_id: solana_pubkey::Pubkey, + + pub global_params: solana_pubkey::Pubkey, + + pub sol_vault: solana_pubkey::Pubkey, + + pub mayhem_state: solana_pubkey::Pubkey, + + pub mayhem_token_vault: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl CreateV2 { + pub fn instruction(&self, args: CreateV2InstructionArgs) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: CreateV2InstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(16 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.mint, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.mint_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.bonding_curve, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.associated_bonding_curve, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.user, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.mayhem_program_id, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_params, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(self.sol_vault, false)); + accounts.push(solana_instruction::AccountMeta::new( + self.mayhem_state, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.mayhem_token_vault, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = CreateV2InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CreateV2InstructionData { + discriminator: [u8; 8], +} + +impl CreateV2InstructionData { + pub fn new() -> Self { + Self { + discriminator: [214, 144, 76, 236, 95, 139, 49, 180], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for CreateV2InstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CreateV2InstructionArgs { + pub name: String, + pub symbol: String, + pub uri: String, + pub creator: Pubkey, + pub is_mayhem_mode: bool, +} + +impl CreateV2InstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `CreateV2`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` mint +/// 1. `[]` mint_authority +/// 2. `[writable]` bonding_curve +/// 3. `[writable]` associated_bonding_curve +/// 4. `[]` global +/// 5. `[writable, signer]` user +/// 6. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 7. `[optional]` token_program (default to `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`) +/// 8. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 9. `[writable, optional]` mayhem_program_id (default to `MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e`) +/// 10. `[]` global_params +/// 11. `[writable]` sol_vault +/// 12. `[writable]` mayhem_state +/// 13. `[writable]` mayhem_token_vault +/// 14. `[]` event_authority +/// 15. `[]` program +#[derive(Clone, Debug, Default)] +pub struct CreateV2Builder { + mint: Option, + mint_authority: Option, + bonding_curve: Option, + associated_bonding_curve: Option, + global: Option, + user: Option, + system_program: Option, + token_program: Option, + associated_token_program: Option, + mayhem_program_id: Option, + global_params: Option, + sol_vault: Option, + mayhem_state: Option, + mayhem_token_vault: Option, + event_authority: Option, + program: Option, + name: Option, + symbol: Option, + uri: Option, + creator: Option, + is_mayhem_mode: Option, + __remaining_accounts: Vec, +} + +impl CreateV2Builder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn mint_authority(&mut self, mint_authority: solana_pubkey::Pubkey) -> &mut Self { + self.mint_authority = Some(mint_authority); + self + } + #[inline(always)] + pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { + self.bonding_curve = Some(bonding_curve); + self + } + #[inline(always)] + pub fn associated_bonding_curve( + &mut self, + associated_bonding_curve: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_bonding_curve = Some(associated_bonding_curve); + self + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + /// `[optional account, default to 'MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e']` + #[inline(always)] + pub fn mayhem_program_id(&mut self, mayhem_program_id: solana_pubkey::Pubkey) -> &mut Self { + self.mayhem_program_id = Some(mayhem_program_id); + self + } + #[inline(always)] + pub fn global_params(&mut self, global_params: solana_pubkey::Pubkey) -> &mut Self { + self.global_params = Some(global_params); + self + } + #[inline(always)] + pub fn sol_vault(&mut self, sol_vault: solana_pubkey::Pubkey) -> &mut Self { + self.sol_vault = Some(sol_vault); + self + } + #[inline(always)] + pub fn mayhem_state(&mut self, mayhem_state: solana_pubkey::Pubkey) -> &mut Self { + self.mayhem_state = Some(mayhem_state); + self + } + #[inline(always)] + pub fn mayhem_token_vault(&mut self, mayhem_token_vault: solana_pubkey::Pubkey) -> &mut Self { + self.mayhem_token_vault = Some(mayhem_token_vault); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn name(&mut self, name: String) -> &mut Self { + self.name = Some(name); + self + } + #[inline(always)] + pub fn symbol(&mut self, symbol: String) -> &mut Self { + self.symbol = Some(symbol); + self + } + #[inline(always)] + pub fn uri(&mut self, uri: String) -> &mut Self { + self.uri = Some(uri); + self + } + #[inline(always)] + pub fn creator(&mut self, creator: Pubkey) -> &mut Self { + self.creator = Some(creator); + self + } + #[inline(always)] + pub fn is_mayhem_mode(&mut self, is_mayhem_mode: bool) -> &mut Self { + self.is_mayhem_mode = Some(is_mayhem_mode); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = CreateV2 { + mint: self.mint.expect("mint is not set"), + mint_authority: self.mint_authority.expect("mint_authority is not set"), + bonding_curve: self.bonding_curve.expect("bonding_curve is not set"), + associated_bonding_curve: self + .associated_bonding_curve + .expect("associated_bonding_curve is not set"), + global: self.global.expect("global is not set"), + user: self.user.expect("user is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!( + "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + )), + associated_token_program: self.associated_token_program.unwrap_or( + solana_pubkey::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + mayhem_program_id: self.mayhem_program_id.unwrap_or(solana_pubkey::pubkey!( + "MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e" + )), + global_params: self.global_params.expect("global_params is not set"), + sol_vault: self.sol_vault.expect("sol_vault is not set"), + mayhem_state: self.mayhem_state.expect("mayhem_state is not set"), + mayhem_token_vault: self + .mayhem_token_vault + .expect("mayhem_token_vault is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = CreateV2InstructionArgs { + name: self.name.clone().expect("name is not set"), + symbol: self.symbol.clone().expect("symbol is not set"), + uri: self.uri.clone().expect("uri is not set"), + creator: self.creator.clone().expect("creator is not set"), + is_mayhem_mode: self + .is_mayhem_mode + .clone() + .expect("is_mayhem_mode is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `create_v2` CPI accounts. +pub struct CreateV2CpiAccounts<'a, 'b> { + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub mint_authority: &'b solana_account_info::AccountInfo<'a>, + + pub bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub associated_bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub mayhem_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub global_params: &'b solana_account_info::AccountInfo<'a>, + + pub sol_vault: &'b solana_account_info::AccountInfo<'a>, + + pub mayhem_state: &'b solana_account_info::AccountInfo<'a>, + + pub mayhem_token_vault: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `create_v2` CPI instruction. +pub struct CreateV2Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub mint: &'b solana_account_info::AccountInfo<'a>, + + pub mint_authority: &'b solana_account_info::AccountInfo<'a>, + + pub bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub associated_bonding_curve: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub token_program: &'b solana_account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_account_info::AccountInfo<'a>, + + pub mayhem_program_id: &'b solana_account_info::AccountInfo<'a>, + + pub global_params: &'b solana_account_info::AccountInfo<'a>, + + pub sol_vault: &'b solana_account_info::AccountInfo<'a>, + + pub mayhem_state: &'b solana_account_info::AccountInfo<'a>, + + pub mayhem_token_vault: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: CreateV2InstructionArgs, +} + +impl<'a, 'b> CreateV2Cpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: CreateV2CpiAccounts<'a, 'b>, + args: CreateV2InstructionArgs, + ) -> Self { + Self { + __program: program, + mint: accounts.mint, + mint_authority: accounts.mint_authority, + bonding_curve: accounts.bonding_curve, + associated_bonding_curve: accounts.associated_bonding_curve, + global: accounts.global, + user: accounts.user, + system_program: accounts.system_program, + token_program: accounts.token_program, + associated_token_program: accounts.associated_token_program, + mayhem_program_id: accounts.mayhem_program_id, + global_params: accounts.global_params, + sol_vault: accounts.sol_vault, + mayhem_state: accounts.mayhem_state, + mayhem_token_vault: accounts.mayhem_token_vault, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(16 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.mint.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.mint_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.bonding_curve.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.associated_bonding_curve.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new(*self.user.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.mayhem_program_id.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_params.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.sol_vault.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.mayhem_state.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.mayhem_token_vault.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = CreateV2InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(17 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.mint_authority.clone()); + account_infos.push(self.bonding_curve.clone()); + account_infos.push(self.associated_bonding_curve.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.mayhem_program_id.clone()); + account_infos.push(self.global_params.clone()); + account_infos.push(self.sol_vault.clone()); + account_infos.push(self.mayhem_state.clone()); + account_infos.push(self.mayhem_token_vault.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `CreateV2` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` mint +/// 1. `[]` mint_authority +/// 2. `[writable]` bonding_curve +/// 3. `[writable]` associated_bonding_curve +/// 4. `[]` global +/// 5. `[writable, signer]` user +/// 6. `[]` system_program +/// 7. `[]` token_program +/// 8. `[]` associated_token_program +/// 9. `[writable]` mayhem_program_id +/// 10. `[]` global_params +/// 11. `[writable]` sol_vault +/// 12. `[writable]` mayhem_state +/// 13. `[writable]` mayhem_token_vault +/// 14. `[]` event_authority +/// 15. `[]` program +#[derive(Clone, Debug)] +pub struct CreateV2CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> CreateV2CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CreateV2CpiBuilderInstruction { + __program: program, + mint: None, + mint_authority: None, + bonding_curve: None, + associated_bonding_curve: None, + global: None, + user: None, + system_program: None, + token_program: None, + associated_token_program: None, + mayhem_program_id: None, + global_params: None, + sol_vault: None, + mayhem_state: None, + mayhem_token_vault: None, + event_authority: None, + program: None, + name: None, + symbol: None, + uri: None, + creator: None, + is_mayhem_mode: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn mint_authority( + &mut self, + mint_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mint_authority = Some(mint_authority); + self + } + #[inline(always)] + pub fn bonding_curve( + &mut self, + bonding_curve: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.bonding_curve = Some(bonding_curve); + self + } + #[inline(always)] + pub fn associated_bonding_curve( + &mut self, + associated_bonding_curve: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_bonding_curve = Some(associated_bonding_curve); + self + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn mayhem_program_id( + &mut self, + mayhem_program_id: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mayhem_program_id = Some(mayhem_program_id); + self + } + #[inline(always)] + pub fn global_params( + &mut self, + global_params: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_params = Some(global_params); + self + } + #[inline(always)] + pub fn sol_vault(&mut self, sol_vault: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.sol_vault = Some(sol_vault); + self + } + #[inline(always)] + pub fn mayhem_state( + &mut self, + mayhem_state: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mayhem_state = Some(mayhem_state); + self + } + #[inline(always)] + pub fn mayhem_token_vault( + &mut self, + mayhem_token_vault: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mayhem_token_vault = Some(mayhem_token_vault); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn name(&mut self, name: String) -> &mut Self { + self.instruction.name = Some(name); + self + } + #[inline(always)] + pub fn symbol(&mut self, symbol: String) -> &mut Self { + self.instruction.symbol = Some(symbol); + self + } + #[inline(always)] + pub fn uri(&mut self, uri: String) -> &mut Self { + self.instruction.uri = Some(uri); + self + } + #[inline(always)] + pub fn creator(&mut self, creator: Pubkey) -> &mut Self { + self.instruction.creator = Some(creator); + self + } + #[inline(always)] + pub fn is_mayhem_mode(&mut self, is_mayhem_mode: bool) -> &mut Self { + self.instruction.is_mayhem_mode = Some(is_mayhem_mode); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = CreateV2InstructionArgs { + name: self.instruction.name.clone().expect("name is not set"), + symbol: self.instruction.symbol.clone().expect("symbol is not set"), + uri: self.instruction.uri.clone().expect("uri is not set"), + creator: self + .instruction + .creator + .clone() + .expect("creator is not set"), + is_mayhem_mode: self + .instruction + .is_mayhem_mode + .clone() + .expect("is_mayhem_mode is not set"), + }; + let instruction = CreateV2Cpi { + __program: self.instruction.__program, + + mint: self.instruction.mint.expect("mint is not set"), + + mint_authority: self + .instruction + .mint_authority + .expect("mint_authority is not set"), + + bonding_curve: self + .instruction + .bonding_curve + .expect("bonding_curve is not set"), + + associated_bonding_curve: self + .instruction + .associated_bonding_curve + .expect("associated_bonding_curve is not set"), + + global: self.instruction.global.expect("global is not set"), + + user: self.instruction.user.expect("user is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + mayhem_program_id: self + .instruction + .mayhem_program_id + .expect("mayhem_program_id is not set"), + + global_params: self + .instruction + .global_params + .expect("global_params is not set"), + + sol_vault: self.instruction.sol_vault.expect("sol_vault is not set"), + + mayhem_state: self + .instruction + .mayhem_state + .expect("mayhem_state is not set"), + + mayhem_token_vault: self + .instruction + .mayhem_token_vault + .expect("mayhem_token_vault is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct CreateV2CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + mint: Option<&'b solana_account_info::AccountInfo<'a>>, + mint_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + bonding_curve: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_bonding_curve: Option<&'b solana_account_info::AccountInfo<'a>>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>, + mayhem_program_id: Option<&'b solana_account_info::AccountInfo<'a>>, + global_params: Option<&'b solana_account_info::AccountInfo<'a>>, + sol_vault: Option<&'b solana_account_info::AccountInfo<'a>>, + mayhem_state: Option<&'b solana_account_info::AccountInfo<'a>>, + mayhem_token_vault: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + name: Option, + symbol: Option, + uri: Option, + creator: Option, + is_mayhem_mode: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/extend_account.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/extend_account.rs index 20c68b3b..66f0136b 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/extend_account.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/extend_account.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const EXTEND_ACCOUNT_DISCRIMINATOR: [u8; 8] = [234, 102, 194, 203, 150, 72, 62, 229]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl ExtendAccount { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -50,7 +52,7 @@ impl ExtendAccount { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&ExtendAccountInstructionData::new()).unwrap(); + let data = ExtendAccountInstructionData::new().try_to_vec().unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -72,10 +74,16 @@ impl ExtendAccountInstructionData { discriminator: [234, 102, 194, 203, 150, 72, 62, 229], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for ExtendAccountInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `ExtendAccount`. @@ -98,46 +106,41 @@ pub struct ExtendAccountBuilder { } impl ExtendAccountBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn account(&mut self, account: solana_pubkey::Pubkey) -> &mut Self { self.account = Some(account); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -147,7 +150,6 @@ impl ExtendAccountBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = ExtendAccount { @@ -207,28 +209,21 @@ impl<'a, 'b> ExtendAccountCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -236,7 +231,7 @@ impl<'a, 'b> ExtendAccountCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new( *self.account.key, @@ -265,7 +260,7 @@ impl<'a, 'b> ExtendAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&ExtendAccountInstructionData::new()).unwrap(); + let data = ExtendAccountInstructionData::new().try_to_vec().unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -318,19 +313,16 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn account(&mut self, account: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.account = Some(account); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -339,7 +331,6 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -348,13 +339,11 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -368,7 +357,6 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -383,16 +371,13 @@ impl<'a, 'b> ExtendAccountCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = ExtendAccountCpi { __program: self.instruction.__program, diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/init_user_volume_accumulator.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/init_user_volume_accumulator.rs new file mode 100644 index 00000000..891c2e37 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/init_user_volume_accumulator.rs @@ -0,0 +1,464 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const INIT_USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = + [94, 6, 202, 115, 255, 96, 232, 183]; + +/// Accounts. +#[derive(Debug)] +pub struct InitUserVolumeAccumulator { + pub payer: solana_pubkey::Pubkey, + + pub user: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub system_program: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl InitUserVolumeAccumulator { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.payer, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = InitUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitUserVolumeAccumulatorInstructionData { + discriminator: [u8; 8], +} + +impl InitUserVolumeAccumulatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [94, 6, 202, 115, 255, 96, 232, 183], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for InitUserVolumeAccumulatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `InitUserVolumeAccumulator`. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` payer +/// 1. `[]` user +/// 2. `[writable]` user_volume_accumulator +/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug, Default)] +pub struct InitUserVolumeAccumulatorBuilder { + payer: Option, + user: Option, + user_volume_accumulator: Option, + system_program: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl InitUserVolumeAccumulatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = InitUserVolumeAccumulator { + payer: self.payer.expect("payer is not set"), + user: self.user.expect("user is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + system_program: self + .system_program + .unwrap_or(solana_pubkey::pubkey!("11111111111111111111111111111111")), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `init_user_volume_accumulator` CPI accounts. +pub struct InitUserVolumeAccumulatorCpiAccounts<'a, 'b> { + pub payer: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `init_user_volume_accumulator` CPI instruction. +pub struct InitUserVolumeAccumulatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub payer: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub system_program: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> InitUserVolumeAccumulatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: InitUserVolumeAccumulatorCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + payer: accounts.payer, + user: accounts.user, + user_volume_accumulator: accounts.user_volume_accumulator, + system_program: accounts.system_program, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(*self.payer.key, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = InitUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `InitUserVolumeAccumulator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable, signer]` payer +/// 1. `[]` user +/// 2. `[writable]` user_volume_accumulator +/// 3. `[]` system_program +/// 4. `[]` event_authority +/// 5. `[]` program +#[derive(Clone, Debug)] +pub struct InitUserVolumeAccumulatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> InitUserVolumeAccumulatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(InitUserVolumeAccumulatorCpiBuilderInstruction { + __program: program, + payer: None, + user: None, + user_volume_accumulator: None, + system_program: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = InitUserVolumeAccumulatorCpi { + __program: self.instruction.__program, + + payer: self.instruction.payer.expect("payer is not set"), + + user: self.instruction.user.expect("user is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct InitUserVolumeAccumulatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + payer: Option<&'b solana_account_info::AccountInfo<'a>>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/initialize.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/initialize.rs index d8cea9c7..ddc2dea4 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/initialize.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/initialize.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const INITIALIZE_DISCRIMINATOR: [u8; 8] = [175, 175, 109, 31, 13, 152, 155, 237]; /// Accounts. #[derive(Debug)] @@ -21,7 +24,6 @@ impl Initialize { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -36,7 +38,7 @@ impl Initialize { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&InitializeInstructionData::new()).unwrap(); + let data = InitializeInstructionData::new().try_to_vec().unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -58,10 +60,16 @@ impl InitializeInstructionData { discriminator: [175, 175, 109, 31, 13, 152, 155, 237], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for InitializeInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `Initialize`. @@ -80,34 +88,31 @@ pub struct InitializeBuilder { } impl InitializeBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -117,7 +122,6 @@ impl InitializeBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Initialize { @@ -165,28 +169,21 @@ impl<'a, 'b> InitializeCpi<'a, 'b> { system_program: accounts.system_program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -194,7 +191,7 @@ impl<'a, 'b> InitializeCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(3 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new( *self.global.key, @@ -212,7 +209,7 @@ impl<'a, 'b> InitializeCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&InitializeInstructionData::new()).unwrap(); + let data = InitializeInstructionData::new().try_to_vec().unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -259,19 +256,16 @@ impl<'a, 'b> InitializeCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -280,7 +274,6 @@ impl<'a, 'b> InitializeCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -294,7 +287,6 @@ impl<'a, 'b> InitializeCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -309,16 +301,13 @@ impl<'a, 'b> InitializeCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = InitializeCpi { __program: self.instruction.__program, diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/migrate.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/migrate.rs index 26003c4f..295c7fa4 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/migrate.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/migrate.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const MIGRATE_DISCRIMINATOR: [u8; 8] = [155, 234, 231, 146, 236, 158, 162, 30]; /// Accounts. #[derive(Debug)] @@ -63,7 +66,6 @@ impl Migrate { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -160,7 +162,7 @@ impl Migrate { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&MigrateInstructionData::new()).unwrap(); + let data = MigrateInstructionData::new().try_to_vec().unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -182,10 +184,16 @@ impl MigrateInstructionData { discriminator: [155, 234, 231, 146, 236, 158, 162, 30], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for MigrateInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `Migrate`. @@ -246,32 +254,29 @@ pub struct MigrateBuilder { } impl MigrateBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn withdraw_authority(&mut self, withdraw_authority: solana_pubkey::Pubkey) -> &mut Self { self.withdraw_authority = Some(withdraw_authority); self } - #[inline(always)] pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { self.mint = Some(mint); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -280,46 +285,39 @@ impl MigrateBuilder { self.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` #[inline(always)] pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { self.token_program = Some(token_program); self } - /// `[optional account, default to 'pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA']` #[inline(always)] pub fn pump_amm(&mut self, pump_amm: solana_pubkey::Pubkey) -> &mut Self { self.pump_amm = Some(pump_amm); self } - #[inline(always)] pub fn pool(&mut self, pool: solana_pubkey::Pubkey) -> &mut Self { self.pool = Some(pool); self } - #[inline(always)] pub fn pool_authority(&mut self, pool_authority: solana_pubkey::Pubkey) -> &mut Self { self.pool_authority = Some(pool_authority); self } - #[inline(always)] pub fn pool_authority_mint_account( &mut self, @@ -328,7 +326,6 @@ impl MigrateBuilder { self.pool_authority_mint_account = Some(pool_authority_mint_account); self } - #[inline(always)] pub fn pool_authority_wsol_account( &mut self, @@ -337,26 +334,22 @@ impl MigrateBuilder { self.pool_authority_wsol_account = Some(pool_authority_wsol_account); self } - #[inline(always)] pub fn amm_global_config(&mut self, amm_global_config: solana_pubkey::Pubkey) -> &mut Self { self.amm_global_config = Some(amm_global_config); self } - /// `[optional account, default to 'So11111111111111111111111111111111111111112']` #[inline(always)] pub fn wsol_mint(&mut self, wsol_mint: solana_pubkey::Pubkey) -> &mut Self { self.wsol_mint = Some(wsol_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: solana_pubkey::Pubkey) -> &mut Self { self.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -365,7 +358,6 @@ impl MigrateBuilder { self.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -374,7 +366,6 @@ impl MigrateBuilder { self.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -383,14 +374,12 @@ impl MigrateBuilder { self.pool_quote_token_account = Some(pool_quote_token_account); self } - /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` #[inline(always)] pub fn token2022_program(&mut self, token2022_program: solana_pubkey::Pubkey) -> &mut Self { self.token2022_program = Some(token2022_program); self } - /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` #[inline(always)] pub fn associated_token_program( @@ -400,7 +389,6 @@ impl MigrateBuilder { self.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn pump_amm_event_authority( &mut self, @@ -409,26 +397,22 @@ impl MigrateBuilder { self.pump_amm_event_authority = Some(pump_amm_event_authority); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -438,7 +422,6 @@ impl MigrateBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Migrate { @@ -640,28 +623,21 @@ impl<'a, 'b> MigrateCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -669,7 +645,7 @@ impl<'a, 'b> MigrateCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(24 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.global.key, @@ -771,7 +747,7 @@ impl<'a, 'b> MigrateCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&MigrateInstructionData::new()).unwrap(); + let data = MigrateInstructionData::new().try_to_vec().unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -881,13 +857,11 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn withdraw_authority( &mut self, @@ -896,13 +870,11 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.withdraw_authority = Some(withdraw_authority); self } - #[inline(always)] pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.mint = Some(mint); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -911,7 +883,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -920,13 +891,11 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -935,7 +904,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn token_program( &mut self, @@ -944,19 +912,16 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.token_program = Some(token_program); self } - #[inline(always)] pub fn pump_amm(&mut self, pump_amm: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pump_amm = Some(pump_amm); self } - #[inline(always)] pub fn pool(&mut self, pool: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.pool = Some(pool); self } - #[inline(always)] pub fn pool_authority( &mut self, @@ -965,7 +930,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.pool_authority = Some(pool_authority); self } - #[inline(always)] pub fn pool_authority_mint_account( &mut self, @@ -974,7 +938,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.pool_authority_mint_account = Some(pool_authority_mint_account); self } - #[inline(always)] pub fn pool_authority_wsol_account( &mut self, @@ -983,7 +946,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.pool_authority_wsol_account = Some(pool_authority_wsol_account); self } - #[inline(always)] pub fn amm_global_config( &mut self, @@ -992,19 +954,16 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.amm_global_config = Some(amm_global_config); self } - #[inline(always)] pub fn wsol_mint(&mut self, wsol_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.wsol_mint = Some(wsol_mint); self } - #[inline(always)] pub fn lp_mint(&mut self, lp_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.lp_mint = Some(lp_mint); self } - #[inline(always)] pub fn user_pool_token_account( &mut self, @@ -1013,7 +972,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.user_pool_token_account = Some(user_pool_token_account); self } - #[inline(always)] pub fn pool_base_token_account( &mut self, @@ -1022,7 +980,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.pool_base_token_account = Some(pool_base_token_account); self } - #[inline(always)] pub fn pool_quote_token_account( &mut self, @@ -1031,7 +988,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.pool_quote_token_account = Some(pool_quote_token_account); self } - #[inline(always)] pub fn token2022_program( &mut self, @@ -1040,7 +996,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.token2022_program = Some(token2022_program); self } - #[inline(always)] pub fn associated_token_program( &mut self, @@ -1049,7 +1004,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.associated_token_program = Some(associated_token_program); self } - #[inline(always)] pub fn pump_amm_event_authority( &mut self, @@ -1058,7 +1012,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.pump_amm_event_authority = Some(pump_amm_event_authority); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -1067,13 +1020,11 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -1087,7 +1038,6 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -1102,16 +1052,13 @@ impl<'a, 'b> MigrateCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = MigrateCpi { __program: self.instruction.__program, diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/mod.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/mod.rs index a004d02b..4c00b886 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/mod.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/mod.rs @@ -5,20 +5,50 @@ //! //! +pub(crate) mod r#admin_set_creator; +pub(crate) mod r#admin_set_idl_authority; +pub(crate) mod r#admin_update_token_incentives; pub(crate) mod r#buy; +pub(crate) mod r#buy_exact_sol_in; +pub(crate) mod r#claim_token_incentives; +pub(crate) mod r#close_user_volume_accumulator; pub(crate) mod r#collect_creator_fee; pub(crate) mod r#create; +pub(crate) mod r#create_v2; pub(crate) mod r#extend_account; +pub(crate) mod r#init_user_volume_accumulator; pub(crate) mod r#initialize; pub(crate) mod r#migrate; pub(crate) mod r#sell; pub(crate) mod r#set_creator; pub(crate) mod r#set_metaplex_creator; pub(crate) mod r#set_params; +pub(crate) mod r#set_reserved_fee_recipients; +pub(crate) mod r#sync_user_volume_accumulator; +pub(crate) mod r#toggle_create_v2; +pub(crate) mod r#toggle_mayhem_mode; pub(crate) mod r#update_global_authority; -pub use self::{ - r#buy::*, r#collect_creator_fee::*, r#create::*, r#extend_account::*, r#initialize::*, - r#migrate::*, r#sell::*, r#set_creator::*, r#set_metaplex_creator::*, r#set_params::*, - r#update_global_authority::*, -}; +pub use self::r#admin_set_creator::*; +pub use self::r#admin_set_idl_authority::*; +pub use self::r#admin_update_token_incentives::*; +pub use self::r#buy::*; +pub use self::r#buy_exact_sol_in::*; +pub use self::r#claim_token_incentives::*; +pub use self::r#close_user_volume_accumulator::*; +pub use self::r#collect_creator_fee::*; +pub use self::r#create::*; +pub use self::r#create_v2::*; +pub use self::r#extend_account::*; +pub use self::r#init_user_volume_accumulator::*; +pub use self::r#initialize::*; +pub use self::r#migrate::*; +pub use self::r#sell::*; +pub use self::r#set_creator::*; +pub use self::r#set_metaplex_creator::*; +pub use self::r#set_params::*; +pub use self::r#set_reserved_fee_recipients::*; +pub use self::r#sync_user_volume_accumulator::*; +pub use self::r#toggle_create_v2::*; +pub use self::r#toggle_mayhem_mode::*; +pub use self::r#update_global_authority::*; diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/sell.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/sell.rs index 06f9b4ee..83392ec2 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/sell.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/sell.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const SELL_DISCRIMINATOR: [u8; 8] = [51, 230, 133, 164, 1, 127, 131, 173]; /// Accounts. #[derive(Debug)] @@ -33,13 +36,16 @@ pub struct Sell { pub event_authority: solana_pubkey::Pubkey, pub program: solana_pubkey::Pubkey, + + pub fee_config: solana_pubkey::Pubkey, + + pub fee_program: solana_pubkey::Pubkey, } impl Sell { pub fn instruction(&self, args: SellInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -47,7 +53,7 @@ impl Sell { args: SellInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta], ) -> solana_instruction::Instruction { - let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + let mut accounts = Vec::with_capacity(14 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( self.global, false, @@ -92,9 +98,17 @@ impl Sell { self.program, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_config, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.fee_program, + false, + )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&SellInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = SellInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -117,10 +131,16 @@ impl SellInstructionData { discriminator: [51, 230, 133, 164, 1, 127, 131, 173], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for SellInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -130,6 +150,12 @@ pub struct SellInstructionArgs { pub min_sol_output: u64, } +impl SellInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `Sell`. /// /// ### Accounts: @@ -145,7 +171,9 @@ pub struct SellInstructionArgs { /// 8. `[writable]` creator_vault /// 9. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) /// 10. `[]` event_authority -/// 11. `[]` program +/// 11. `[optional]` program (default to `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`) +/// 12. `[]` fee_config +/// 13. `[optional]` fee_program (default to `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ`) #[derive(Clone, Debug, Default)] pub struct SellBuilder { global: Option, @@ -160,38 +188,37 @@ pub struct SellBuilder { token_program: Option, event_authority: Option, program: Option, + fee_config: Option, + fee_program: Option, amount: Option, min_sol_output: Option, __remaining_accounts: Vec, } impl SellBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn fee_recipient(&mut self, fee_recipient: solana_pubkey::Pubkey) -> &mut Self { self.fee_recipient = Some(fee_recipient); self } - #[inline(always)] pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { self.mint = Some(mint); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -200,70 +227,71 @@ impl SellBuilder { self.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn associated_user(&mut self, associated_user: solana_pubkey::Pubkey) -> &mut Self { self.associated_user = Some(associated_user); self } - #[inline(always)] pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { self.user = Some(user); self } - /// `[optional account, default to '11111111111111111111111111111111']` #[inline(always)] pub fn system_program(&mut self, system_program: solana_pubkey::Pubkey) -> &mut Self { self.system_program = Some(system_program); self } - #[inline(always)] pub fn creator_vault(&mut self, creator_vault: solana_pubkey::Pubkey) -> &mut Self { self.creator_vault = Some(creator_vault); self } - /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']` #[inline(always)] pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self { self.token_program = Some(token_program); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - + /// `[optional account, default to '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P']` #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - + #[inline(always)] + pub fn fee_config(&mut self, fee_config: solana_pubkey::Pubkey) -> &mut Self { + self.fee_config = Some(fee_config); + self + } + /// `[optional account, default to 'pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ']` + #[inline(always)] + pub fn fee_program(&mut self, fee_program: solana_pubkey::Pubkey) -> &mut Self { + self.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn amount(&mut self, amount: u64) -> &mut Self { self.amount = Some(amount); self } - #[inline(always)] pub fn min_sol_output(&mut self, min_sol_output: u64) -> &mut Self { self.min_sol_output = Some(min_sol_output); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -273,7 +301,6 @@ impl SellBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = Sell { @@ -294,7 +321,13 @@ impl SellBuilder { "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), event_authority: self.event_authority.expect("event_authority is not set"), - program: self.program.expect("program is not set"), + program: self.program.unwrap_or(solana_pubkey::pubkey!( + "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + )), + fee_config: self.fee_config.expect("fee_config is not set"), + fee_program: self.fee_program.unwrap_or(solana_pubkey::pubkey!( + "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + )), }; let args = SellInstructionArgs { amount: self.amount.clone().expect("amount is not set"), @@ -333,6 +366,10 @@ pub struct SellCpiAccounts<'a, 'b> { pub event_authority: &'b solana_account_info::AccountInfo<'a>, pub program: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, } /// `sell` CPI instruction. @@ -363,6 +400,10 @@ pub struct SellCpi<'a, 'b> { pub event_authority: &'b solana_account_info::AccountInfo<'a>, pub program: &'b solana_account_info::AccountInfo<'a>, + + pub fee_config: &'b solana_account_info::AccountInfo<'a>, + + pub fee_program: &'b solana_account_info::AccountInfo<'a>, /// The arguments for the instruction. pub __args: SellInstructionArgs, } @@ -387,31 +428,26 @@ impl<'a, 'b> SellCpi<'a, 'b> { token_program: accounts.token_program, event_authority: accounts.event_authority, program: accounts.program, + fee_config: accounts.fee_config, + fee_program: accounts.fee_program, __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -419,8 +455,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(14 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.global.key, false, @@ -466,6 +502,14 @@ impl<'a, 'b> SellCpi<'a, 'b> { *self.program.key, false, )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_config.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.fee_program.key, + false, + )); remaining_accounts.iter().for_each(|remaining_account| { accounts.push(solana_instruction::AccountMeta { pubkey: *remaining_account.0.key, @@ -473,8 +517,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&SellInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = SellInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -482,7 +526,7 @@ impl<'a, 'b> SellCpi<'a, 'b> { accounts, data, }; - let mut account_infos = Vec::with_capacity(13 + remaining_accounts.len()); + let mut account_infos = Vec::with_capacity(15 + remaining_accounts.len()); account_infos.push(self.__program.clone()); account_infos.push(self.global.clone()); account_infos.push(self.fee_recipient.clone()); @@ -496,6 +540,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { account_infos.push(self.token_program.clone()); account_infos.push(self.event_authority.clone()); account_infos.push(self.program.clone()); + account_infos.push(self.fee_config.clone()); + account_infos.push(self.fee_program.clone()); remaining_accounts .iter() .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); @@ -524,6 +570,8 @@ impl<'a, 'b> SellCpi<'a, 'b> { /// 9. `[]` token_program /// 10. `[]` event_authority /// 11. `[]` program +/// 12. `[]` fee_config +/// 13. `[]` fee_program #[derive(Clone, Debug)] pub struct SellCpiBuilder<'a, 'b> { instruction: Box>, @@ -545,19 +593,19 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { token_program: None, event_authority: None, program: None, + fee_config: None, + fee_program: None, amount: None, min_sol_output: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn fee_recipient( &mut self, @@ -566,13 +614,11 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.fee_recipient = Some(fee_recipient); self } - #[inline(always)] pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.mint = Some(mint); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -581,7 +627,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn associated_bonding_curve( &mut self, @@ -590,7 +635,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.associated_bonding_curve = Some(associated_bonding_curve); self } - #[inline(always)] pub fn associated_user( &mut self, @@ -599,13 +643,11 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.associated_user = Some(associated_user); self } - #[inline(always)] pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.user = Some(user); self } - #[inline(always)] pub fn system_program( &mut self, @@ -614,7 +656,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.system_program = Some(system_program); self } - #[inline(always)] pub fn creator_vault( &mut self, @@ -623,7 +664,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.creator_vault = Some(creator_vault); self } - #[inline(always)] pub fn token_program( &mut self, @@ -632,7 +672,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.token_program = Some(token_program); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -641,25 +680,37 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - + #[inline(always)] + pub fn fee_config( + &mut self, + fee_config: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_config = Some(fee_config); + self + } + #[inline(always)] + pub fn fee_program( + &mut self, + fee_program: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_program = Some(fee_program); + self + } #[inline(always)] pub fn amount(&mut self, amount: u64) -> &mut Self { self.instruction.amount = Some(amount); self } - #[inline(always)] pub fn min_sol_output(&mut self, min_sol_output: u64) -> &mut Self { self.instruction.min_sol_output = Some(min_sol_output); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -673,7 +724,6 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -688,16 +738,13 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = SellInstructionArgs { amount: self.instruction.amount.clone().expect("amount is not set"), min_sol_output: self @@ -756,6 +803,13 @@ impl<'a, 'b> SellCpiBuilder<'a, 'b> { .expect("event_authority is not set"), program: self.instruction.program.expect("program is not set"), + + fee_config: self.instruction.fee_config.expect("fee_config is not set"), + + fee_program: self + .instruction + .fee_program + .expect("fee_program is not set"), __args: args, }; instruction.invoke_signed_with_remaining_accounts( @@ -780,6 +834,8 @@ struct SellCpiBuilderInstruction<'a, 'b> { token_program: Option<&'b solana_account_info::AccountInfo<'a>>, event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, program: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_config: Option<&'b solana_account_info::AccountInfo<'a>>, + fee_program: Option<&'b solana_account_info::AccountInfo<'a>>, amount: Option, min_sol_output: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/set_creator.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/set_creator.rs index 176140bf..c5ec18c4 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/set_creator.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/set_creator.rs @@ -5,9 +5,12 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +pub const SET_CREATOR_DISCRIMINATOR: [u8; 8] = [254, 148, 255, 112, 207, 142, 170, 165]; + /// Accounts. #[derive(Debug)] pub struct SetCreator { @@ -30,7 +33,6 @@ impl SetCreator { pub fn instruction(&self, args: SetCreatorInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -67,8 +69,8 @@ impl SetCreator { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&SetCreatorInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = SetCreatorInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -91,10 +93,16 @@ impl SetCreatorInstructionData { discriminator: [254, 148, 255, 112, 207, 142, 170, 165], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for SetCreatorInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -103,6 +111,12 @@ pub struct SetCreatorInstructionArgs { pub creator: Pubkey, } +impl SetCreatorInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + /// Instruction builder for `SetCreator`. /// /// ### Accounts: @@ -128,8 +142,9 @@ pub struct SetCreatorBuilder { } impl SetCreatorBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn set_creator_authority( &mut self, @@ -138,56 +153,47 @@ impl SetCreatorBuilder { self.set_creator_authority = Some(set_creator_authority); self } - #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { self.mint = Some(mint); self } - #[inline(always)] pub fn metadata(&mut self, metadata: solana_pubkey::Pubkey) -> &mut Self { self.metadata = Some(metadata); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn creator(&mut self, creator: Pubkey) -> &mut Self { self.creator = Some(creator); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -197,7 +203,6 @@ impl SetCreatorBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = SetCreator { @@ -276,28 +281,21 @@ impl<'a, 'b> SetCreatorCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -305,7 +303,7 @@ impl<'a, 'b> SetCreatorCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(7 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.set_creator_authority.key, @@ -342,8 +340,8 @@ impl<'a, 'b> SetCreatorCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&SetCreatorInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = SetCreatorInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -404,7 +402,6 @@ impl<'a, 'b> SetCreatorCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn set_creator_authority( &mut self, @@ -413,25 +410,21 @@ impl<'a, 'b> SetCreatorCpiBuilder<'a, 'b> { self.instruction.set_creator_authority = Some(set_creator_authority); self } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.mint = Some(mint); self } - #[inline(always)] pub fn metadata(&mut self, metadata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.metadata = Some(metadata); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -440,7 +433,6 @@ impl<'a, 'b> SetCreatorCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -449,19 +441,16 @@ impl<'a, 'b> SetCreatorCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn creator(&mut self, creator: Pubkey) -> &mut Self { self.instruction.creator = Some(creator); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -475,7 +464,6 @@ impl<'a, 'b> SetCreatorCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -490,16 +478,13 @@ impl<'a, 'b> SetCreatorCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = SetCreatorInstructionArgs { creator: self .instruction diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/set_metaplex_creator.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/set_metaplex_creator.rs index 27b1d387..22390f80 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/set_metaplex_creator.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/set_metaplex_creator.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const SET_METAPLEX_CREATOR_DISCRIMINATOR: [u8; 8] = [138, 96, 174, 217, 48, 85, 197, 246]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl SetMetaplexCreator { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -53,7 +55,9 @@ impl SetMetaplexCreator { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&SetMetaplexCreatorInstructionData::new()).unwrap(); + let data = SetMetaplexCreatorInstructionData::new() + .try_to_vec() + .unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -75,10 +79,16 @@ impl SetMetaplexCreatorInstructionData { discriminator: [138, 96, 174, 217, 48, 85, 197, 246], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for SetMetaplexCreatorInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `SetMetaplexCreator`. @@ -101,45 +111,40 @@ pub struct SetMetaplexCreatorBuilder { } impl SetMetaplexCreatorBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn mint(&mut self, mint: solana_pubkey::Pubkey) -> &mut Self { self.mint = Some(mint); self } - #[inline(always)] pub fn metadata(&mut self, metadata: solana_pubkey::Pubkey) -> &mut Self { self.metadata = Some(metadata); self } - #[inline(always)] pub fn bonding_curve(&mut self, bonding_curve: solana_pubkey::Pubkey) -> &mut Self { self.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -149,7 +154,6 @@ impl SetMetaplexCreatorBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = SetMetaplexCreator { @@ -207,28 +211,21 @@ impl<'a, 'b> SetMetaplexCreatorCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -236,7 +233,7 @@ impl<'a, 'b> SetMetaplexCreatorCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new_readonly( *self.mint.key, @@ -265,7 +262,9 @@ impl<'a, 'b> SetMetaplexCreatorCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&SetMetaplexCreatorInstructionData::new()).unwrap(); + let data = SetMetaplexCreatorInstructionData::new() + .try_to_vec() + .unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -318,19 +317,16 @@ impl<'a, 'b> SetMetaplexCreatorCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn mint(&mut self, mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.mint = Some(mint); self } - #[inline(always)] pub fn metadata(&mut self, metadata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.metadata = Some(metadata); self } - #[inline(always)] pub fn bonding_curve( &mut self, @@ -339,7 +335,6 @@ impl<'a, 'b> SetMetaplexCreatorCpiBuilder<'a, 'b> { self.instruction.bonding_curve = Some(bonding_curve); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -348,13 +343,11 @@ impl<'a, 'b> SetMetaplexCreatorCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -368,7 +361,6 @@ impl<'a, 'b> SetMetaplexCreatorCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -383,16 +375,13 @@ impl<'a, 'b> SetMetaplexCreatorCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = SetMetaplexCreatorCpi { __program: self.instruction.__program, diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/set_params.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/set_params.rs index c96158cc..dfb22831 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/set_params.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/set_params.rs @@ -5,9 +5,12 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +pub const SET_PARAMS_DISCRIMINATOR: [u8; 8] = [27, 234, 178, 52, 147, 2, 187, 141]; + /// Accounts. #[derive(Debug)] pub struct SetParams { @@ -24,7 +27,6 @@ impl SetParams { pub fn instruction(&self, args: SetParamsInstructionArgs) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(args, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -44,8 +46,8 @@ impl SetParams { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = borsh::to_vec(&SetParamsInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&args).unwrap(); + let mut data = SetParamsInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); data.append(&mut args); solana_instruction::Instruction { @@ -68,10 +70,16 @@ impl SetParamsInstructionData { discriminator: [27, 234, 178, 52, 147, 2, 187, 141], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for SetParamsInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -87,6 +95,13 @@ pub struct SetParamsInstructionArgs { pub pool_migration_fee: u64, pub creator_fee_basis_points: u64, pub set_creator_authority: Pubkey, + pub admin_set_creator_authority: Pubkey, +} + +impl SetParamsInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } /// Instruction builder for `SetParams`. @@ -113,36 +128,34 @@ pub struct SetParamsBuilder { pool_migration_fee: Option, creator_fee_basis_points: Option, set_creator_authority: Option, + admin_set_creator_authority: Option, __remaining_accounts: Vec, } impl SetParamsBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { self.authority = Some(authority); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - #[inline(always)] pub fn initial_virtual_token_reserves( &mut self, @@ -151,68 +164,65 @@ impl SetParamsBuilder { self.initial_virtual_token_reserves = Some(initial_virtual_token_reserves); self } - #[inline(always)] pub fn initial_virtual_sol_reserves(&mut self, initial_virtual_sol_reserves: u64) -> &mut Self { self.initial_virtual_sol_reserves = Some(initial_virtual_sol_reserves); self } - #[inline(always)] pub fn initial_real_token_reserves(&mut self, initial_real_token_reserves: u64) -> &mut Self { self.initial_real_token_reserves = Some(initial_real_token_reserves); self } - #[inline(always)] pub fn token_total_supply(&mut self, token_total_supply: u64) -> &mut Self { self.token_total_supply = Some(token_total_supply); self } - #[inline(always)] pub fn fee_basis_points(&mut self, fee_basis_points: u64) -> &mut Self { self.fee_basis_points = Some(fee_basis_points); self } - #[inline(always)] pub fn withdraw_authority(&mut self, withdraw_authority: Pubkey) -> &mut Self { self.withdraw_authority = Some(withdraw_authority); self } - #[inline(always)] pub fn enable_migrate(&mut self, enable_migrate: bool) -> &mut Self { self.enable_migrate = Some(enable_migrate); self } - #[inline(always)] pub fn pool_migration_fee(&mut self, pool_migration_fee: u64) -> &mut Self { self.pool_migration_fee = Some(pool_migration_fee); self } - #[inline(always)] pub fn creator_fee_basis_points(&mut self, creator_fee_basis_points: u64) -> &mut Self { self.creator_fee_basis_points = Some(creator_fee_basis_points); self } - #[inline(always)] pub fn set_creator_authority(&mut self, set_creator_authority: Pubkey) -> &mut Self { self.set_creator_authority = Some(set_creator_authority); self } - + #[inline(always)] + pub fn admin_set_creator_authority( + &mut self, + admin_set_creator_authority: Pubkey, + ) -> &mut Self { + self.admin_set_creator_authority = Some(admin_set_creator_authority); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -222,7 +232,6 @@ impl SetParamsBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = SetParams { @@ -272,6 +281,10 @@ impl SetParamsBuilder { .set_creator_authority .clone() .expect("set_creator_authority is not set"), + admin_set_creator_authority: self + .admin_set_creator_authority + .clone() + .expect("admin_set_creator_authority is not set"), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -320,28 +333,21 @@ impl<'a, 'b> SetParamsCpi<'a, 'b> { __args: args, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -349,7 +355,7 @@ impl<'a, 'b> SetParamsCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new( *self.global.key, @@ -374,8 +380,8 @@ impl<'a, 'b> SetParamsCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = borsh::to_vec(&SetParamsInstructionData::new()).unwrap(); - let mut args = borsh::to_vec(&self.__args).unwrap(); + let mut data = SetParamsInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); data.append(&mut args); let instruction = solana_instruction::Instruction { @@ -432,23 +438,21 @@ impl<'a, 'b> SetParamsCpiBuilder<'a, 'b> { pool_migration_fee: None, creator_fee_basis_points: None, set_creator_authority: None, + admin_set_creator_authority: None, __remaining_accounts: Vec::new(), }); Self { instruction } } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.authority = Some(authority); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -457,13 +461,11 @@ impl<'a, 'b> SetParamsCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - #[inline(always)] pub fn initial_virtual_token_reserves( &mut self, @@ -472,61 +474,59 @@ impl<'a, 'b> SetParamsCpiBuilder<'a, 'b> { self.instruction.initial_virtual_token_reserves = Some(initial_virtual_token_reserves); self } - #[inline(always)] pub fn initial_virtual_sol_reserves(&mut self, initial_virtual_sol_reserves: u64) -> &mut Self { self.instruction.initial_virtual_sol_reserves = Some(initial_virtual_sol_reserves); self } - #[inline(always)] pub fn initial_real_token_reserves(&mut self, initial_real_token_reserves: u64) -> &mut Self { self.instruction.initial_real_token_reserves = Some(initial_real_token_reserves); self } - #[inline(always)] pub fn token_total_supply(&mut self, token_total_supply: u64) -> &mut Self { self.instruction.token_total_supply = Some(token_total_supply); self } - #[inline(always)] pub fn fee_basis_points(&mut self, fee_basis_points: u64) -> &mut Self { self.instruction.fee_basis_points = Some(fee_basis_points); self } - #[inline(always)] pub fn withdraw_authority(&mut self, withdraw_authority: Pubkey) -> &mut Self { self.instruction.withdraw_authority = Some(withdraw_authority); self } - #[inline(always)] pub fn enable_migrate(&mut self, enable_migrate: bool) -> &mut Self { self.instruction.enable_migrate = Some(enable_migrate); self } - #[inline(always)] pub fn pool_migration_fee(&mut self, pool_migration_fee: u64) -> &mut Self { self.instruction.pool_migration_fee = Some(pool_migration_fee); self } - #[inline(always)] pub fn creator_fee_basis_points(&mut self, creator_fee_basis_points: u64) -> &mut Self { self.instruction.creator_fee_basis_points = Some(creator_fee_basis_points); self } - #[inline(always)] pub fn set_creator_authority(&mut self, set_creator_authority: Pubkey) -> &mut Self { self.instruction.set_creator_authority = Some(set_creator_authority); self } - + #[inline(always)] + pub fn admin_set_creator_authority( + &mut self, + admin_set_creator_authority: Pubkey, + ) -> &mut Self { + self.instruction.admin_set_creator_authority = Some(admin_set_creator_authority); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -540,7 +540,6 @@ impl<'a, 'b> SetParamsCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -555,16 +554,13 @@ impl<'a, 'b> SetParamsCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let args = SetParamsInstructionArgs { initial_virtual_token_reserves: self .instruction @@ -616,6 +612,11 @@ impl<'a, 'b> SetParamsCpiBuilder<'a, 'b> { .set_creator_authority .clone() .expect("set_creator_authority is not set"), + admin_set_creator_authority: self + .instruction + .admin_set_creator_authority + .clone() + .expect("admin_set_creator_authority is not set"), }; let instruction = SetParamsCpi { __program: self.instruction.__program, @@ -656,6 +657,7 @@ struct SetParamsCpiBuilderInstruction<'a, 'b> { pool_migration_fee: Option, creator_fee_basis_points: Option, set_creator_authority: Option, + admin_set_creator_authority: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, } diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/set_reserved_fee_recipients.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/set_reserved_fee_recipients.rs new file mode 100644 index 00000000..1495846a --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/set_reserved_fee_recipients.rs @@ -0,0 +1,432 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +pub const SET_RESERVED_FEE_RECIPIENTS_DISCRIMINATOR: [u8; 8] = + [111, 172, 162, 232, 114, 89, 213, 142]; + +/// Accounts. +#[derive(Debug)] +pub struct SetReservedFeeRecipients { + pub global: solana_pubkey::Pubkey, + + pub authority: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl SetReservedFeeRecipients { + pub fn instruction( + &self, + args: SetReservedFeeRecipientsInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: SetReservedFeeRecipientsInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.global, false)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = SetReservedFeeRecipientsInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SetReservedFeeRecipientsInstructionData { + discriminator: [u8; 8], +} + +impl SetReservedFeeRecipientsInstructionData { + pub fn new() -> Self { + Self { + discriminator: [111, 172, 162, 232, 114, 89, 213, 142], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for SetReservedFeeRecipientsInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SetReservedFeeRecipientsInstructionArgs { + pub whitelist_pda: Pubkey, +} + +impl SetReservedFeeRecipientsInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `SetReservedFeeRecipients`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global +/// 1. `[signer]` authority +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct SetReservedFeeRecipientsBuilder { + global: Option, + authority: Option, + event_authority: Option, + program: Option, + whitelist_pda: Option, + __remaining_accounts: Vec, +} + +impl SetReservedFeeRecipientsBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn whitelist_pda(&mut self, whitelist_pda: Pubkey) -> &mut Self { + self.whitelist_pda = Some(whitelist_pda); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = SetReservedFeeRecipients { + global: self.global.expect("global is not set"), + authority: self.authority.expect("authority is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = SetReservedFeeRecipientsInstructionArgs { + whitelist_pda: self + .whitelist_pda + .clone() + .expect("whitelist_pda is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `set_reserved_fee_recipients` CPI accounts. +pub struct SetReservedFeeRecipientsCpiAccounts<'a, 'b> { + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `set_reserved_fee_recipients` CPI instruction. +pub struct SetReservedFeeRecipientsCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: SetReservedFeeRecipientsInstructionArgs, +} + +impl<'a, 'b> SetReservedFeeRecipientsCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: SetReservedFeeRecipientsCpiAccounts<'a, 'b>, + args: SetReservedFeeRecipientsInstructionArgs, + ) -> Self { + Self { + __program: program, + global: accounts.global, + authority: accounts.authority, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = SetReservedFeeRecipientsInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `SetReservedFeeRecipients` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global +/// 1. `[signer]` authority +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct SetReservedFeeRecipientsCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> SetReservedFeeRecipientsCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SetReservedFeeRecipientsCpiBuilderInstruction { + __program: program, + global: None, + authority: None, + event_authority: None, + program: None, + whitelist_pda: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn whitelist_pda(&mut self, whitelist_pda: Pubkey) -> &mut Self { + self.instruction.whitelist_pda = Some(whitelist_pda); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = SetReservedFeeRecipientsInstructionArgs { + whitelist_pda: self + .instruction + .whitelist_pda + .clone() + .expect("whitelist_pda is not set"), + }; + let instruction = SetReservedFeeRecipientsCpi { + __program: self.instruction.__program, + + global: self.instruction.global.expect("global is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct SetReservedFeeRecipientsCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + authority: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + whitelist_pda: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/sync_user_volume_accumulator.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/sync_user_volume_accumulator.rs new file mode 100644 index 00000000..ddf506f8 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/sync_user_volume_accumulator.rs @@ -0,0 +1,437 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const SYNC_USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: [u8; 8] = [86, 31, 192, 87, 163, 87, 79, 238]; + +/// Accounts. +#[derive(Debug)] +pub struct SyncUserVolumeAccumulator { + pub user: solana_pubkey::Pubkey, + + pub global_volume_accumulator: solana_pubkey::Pubkey, + + pub user_volume_accumulator: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl SyncUserVolumeAccumulator { + pub fn instruction(&self) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.global_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + self.user_volume_accumulator, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let data = SyncUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SyncUserVolumeAccumulatorInstructionData { + discriminator: [u8; 8], +} + +impl SyncUserVolumeAccumulatorInstructionData { + pub fn new() -> Self { + Self { + discriminator: [86, 31, 192, 87, 163, 87, 79, 238], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for SyncUserVolumeAccumulatorInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `SyncUserVolumeAccumulator`. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[]` global_volume_accumulator +/// 2. `[writable]` user_volume_accumulator +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug, Default)] +pub struct SyncUserVolumeAccumulatorBuilder { + user: Option, + global_volume_accumulator: Option, + user_volume_accumulator: Option, + event_authority: Option, + program: Option, + __remaining_accounts: Vec, +} + +impl SyncUserVolumeAccumulatorBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn user(&mut self, user: solana_pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: solana_pubkey::Pubkey, + ) -> &mut Self { + self.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = SyncUserVolumeAccumulator { + user: self.user.expect("user is not set"), + global_volume_accumulator: self + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + user_volume_accumulator: self + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `sync_user_volume_accumulator` CPI accounts. +pub struct SyncUserVolumeAccumulatorCpiAccounts<'a, 'b> { + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `sync_user_volume_accumulator` CPI instruction. +pub struct SyncUserVolumeAccumulatorCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub user: &'b solana_account_info::AccountInfo<'a>, + + pub global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +impl<'a, 'b> SyncUserVolumeAccumulatorCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: SyncUserVolumeAccumulatorCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + user: accounts.user, + global_volume_accumulator: accounts.global_volume_accumulator, + user_volume_accumulator: accounts.user_volume_accumulator, + event_authority: accounts.event_authority, + program: accounts.program, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.global_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.user_volume_accumulator.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = SyncUserVolumeAccumulatorInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.global_volume_accumulator.clone()); + account_infos.push(self.user_volume_accumulator.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `SyncUserVolumeAccumulator` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` user +/// 1. `[]` global_volume_accumulator +/// 2. `[writable]` user_volume_accumulator +/// 3. `[]` event_authority +/// 4. `[]` program +#[derive(Clone, Debug)] +pub struct SyncUserVolumeAccumulatorCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> SyncUserVolumeAccumulatorCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SyncUserVolumeAccumulatorCpiBuilderInstruction { + __program: program, + user: None, + global_volume_accumulator: None, + user_volume_accumulator: None, + event_authority: None, + program: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn user(&mut self, user: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + #[inline(always)] + pub fn global_volume_accumulator( + &mut self, + global_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.global_volume_accumulator = Some(global_volume_accumulator); + self + } + #[inline(always)] + pub fn user_volume_accumulator( + &mut self, + user_volume_accumulator: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.user_volume_accumulator = Some(user_volume_accumulator); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let instruction = SyncUserVolumeAccumulatorCpi { + __program: self.instruction.__program, + + user: self.instruction.user.expect("user is not set"), + + global_volume_accumulator: self + .instruction + .global_volume_accumulator + .expect("global_volume_accumulator is not set"), + + user_volume_accumulator: self + .instruction + .user_volume_accumulator + .expect("user_volume_accumulator is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct SyncUserVolumeAccumulatorCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + user: Option<&'b solana_account_info::AccountInfo<'a>>, + global_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + user_volume_accumulator: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/toggle_create_v2.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/toggle_create_v2.rs new file mode 100644 index 00000000..97709dbf --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/toggle_create_v2.rs @@ -0,0 +1,420 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const TOGGLE_CREATE_V2_DISCRIMINATOR: [u8; 8] = [28, 255, 230, 240, 172, 107, 203, 171]; + +/// Accounts. +#[derive(Debug)] +pub struct ToggleCreateV2 { + pub global: solana_pubkey::Pubkey, + + pub authority: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl ToggleCreateV2 { + pub fn instruction( + &self, + args: ToggleCreateV2InstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: ToggleCreateV2InstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.global, false)); + accounts.push(solana_instruction::AccountMeta::new(self.authority, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = ToggleCreateV2InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ToggleCreateV2InstructionData { + discriminator: [u8; 8], +} + +impl ToggleCreateV2InstructionData { + pub fn new() -> Self { + Self { + discriminator: [28, 255, 230, 240, 172, 107, 203, 171], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for ToggleCreateV2InstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ToggleCreateV2InstructionArgs { + pub enabled: bool, +} + +impl ToggleCreateV2InstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `ToggleCreateV2`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global +/// 1. `[writable, signer]` authority +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct ToggleCreateV2Builder { + global: Option, + authority: Option, + event_authority: Option, + program: Option, + enabled: Option, + __remaining_accounts: Vec, +} + +impl ToggleCreateV2Builder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn enabled(&mut self, enabled: bool) -> &mut Self { + self.enabled = Some(enabled); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = ToggleCreateV2 { + global: self.global.expect("global is not set"), + authority: self.authority.expect("authority is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = ToggleCreateV2InstructionArgs { + enabled: self.enabled.clone().expect("enabled is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `toggle_create_v2` CPI accounts. +pub struct ToggleCreateV2CpiAccounts<'a, 'b> { + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `toggle_create_v2` CPI instruction. +pub struct ToggleCreateV2Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: ToggleCreateV2InstructionArgs, +} + +impl<'a, 'b> ToggleCreateV2Cpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: ToggleCreateV2CpiAccounts<'a, 'b>, + args: ToggleCreateV2InstructionArgs, + ) -> Self { + Self { + __program: program, + global: accounts.global, + authority: accounts.authority, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = ToggleCreateV2InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ToggleCreateV2` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global +/// 1. `[writable, signer]` authority +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct ToggleCreateV2CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ToggleCreateV2CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ToggleCreateV2CpiBuilderInstruction { + __program: program, + global: None, + authority: None, + event_authority: None, + program: None, + enabled: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn enabled(&mut self, enabled: bool) -> &mut Self { + self.instruction.enabled = Some(enabled); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = ToggleCreateV2InstructionArgs { + enabled: self + .instruction + .enabled + .clone() + .expect("enabled is not set"), + }; + let instruction = ToggleCreateV2Cpi { + __program: self.instruction.__program, + + global: self.instruction.global.expect("global is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct ToggleCreateV2CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + authority: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + enabled: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/toggle_mayhem_mode.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/toggle_mayhem_mode.rs new file mode 100644 index 00000000..92fedd58 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/toggle_mayhem_mode.rs @@ -0,0 +1,420 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const TOGGLE_MAYHEM_MODE_DISCRIMINATOR: [u8; 8] = [1, 9, 111, 208, 100, 31, 255, 163]; + +/// Accounts. +#[derive(Debug)] +pub struct ToggleMayhemMode { + pub global: solana_pubkey::Pubkey, + + pub authority: solana_pubkey::Pubkey, + + pub event_authority: solana_pubkey::Pubkey, + + pub program: solana_pubkey::Pubkey, +} + +impl ToggleMayhemMode { + pub fn instruction( + &self, + args: ToggleMayhemModeInstructionArgs, + ) -> solana_instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: ToggleMayhemModeInstructionArgs, + remaining_accounts: &[solana_instruction::AccountMeta], + ) -> solana_instruction::Instruction { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new(self.global, false)); + accounts.push(solana_instruction::AccountMeta::new(self.authority, true)); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.event_authority, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + self.program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = ToggleMayhemModeInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ToggleMayhemModeInstructionData { + discriminator: [u8; 8], +} + +impl ToggleMayhemModeInstructionData { + pub fn new() -> Self { + Self { + discriminator: [1, 9, 111, 208, 100, 31, 255, 163], + } + } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +impl Default for ToggleMayhemModeInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ToggleMayhemModeInstructionArgs { + pub enabled: bool, +} + +impl ToggleMayhemModeInstructionArgs { + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } +} + +/// Instruction builder for `ToggleMayhemMode`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global +/// 1. `[writable, signer]` authority +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug, Default)] +pub struct ToggleMayhemModeBuilder { + global: Option, + authority: Option, + event_authority: Option, + program: Option, + enabled: Option, + __remaining_accounts: Vec, +} + +impl ToggleMayhemModeBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { + self.global = Some(global); + self + } + #[inline(always)] + pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + #[inline(always)] + pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { + self.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { + self.program = Some(program); + self + } + #[inline(always)] + pub fn enabled(&mut self, enabled: bool) -> &mut Self { + self.enabled = Some(enabled); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_instruction::Instruction { + let accounts = ToggleMayhemMode { + global: self.global.expect("global is not set"), + authority: self.authority.expect("authority is not set"), + event_authority: self.event_authority.expect("event_authority is not set"), + program: self.program.expect("program is not set"), + }; + let args = ToggleMayhemModeInstructionArgs { + enabled: self.enabled.clone().expect("enabled is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `toggle_mayhem_mode` CPI accounts. +pub struct ToggleMayhemModeCpiAccounts<'a, 'b> { + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, +} + +/// `toggle_mayhem_mode` CPI instruction. +pub struct ToggleMayhemModeCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_account_info::AccountInfo<'a>, + + pub global: &'b solana_account_info::AccountInfo<'a>, + + pub authority: &'b solana_account_info::AccountInfo<'a>, + + pub event_authority: &'b solana_account_info::AccountInfo<'a>, + + pub program: &'b solana_account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: ToggleMayhemModeInstructionArgs, +} + +impl<'a, 'b> ToggleMayhemModeCpi<'a, 'b> { + pub fn new( + program: &'b solana_account_info::AccountInfo<'a>, + accounts: ToggleMayhemModeCpiAccounts<'a, 'b>, + args: ToggleMayhemModeInstructionArgs, + ) -> Self { + Self { + __program: program, + global: accounts.global, + authority: accounts.authority, + event_authority: accounts.event_authority, + program: accounts.program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::arithmetic_side_effects)] + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> solana_program_error::ProgramResult { + let mut accounts = Vec::with_capacity(4 + remaining_accounts.len()); + accounts.push(solana_instruction::AccountMeta::new( + *self.global.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new( + *self.authority.key, + true, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.event_authority.key, + false, + )); + accounts.push(solana_instruction::AccountMeta::new_readonly( + *self.program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = ToggleMayhemModeInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_instruction::Instruction { + program_id: crate::PUMP_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.global.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.event_authority.clone()); + account_infos.push(self.program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_cpi::invoke(&instruction, &account_infos) + } else { + solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ToggleMayhemMode` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` global +/// 1. `[writable, signer]` authority +/// 2. `[]` event_authority +/// 3. `[]` program +#[derive(Clone, Debug)] +pub struct ToggleMayhemModeCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ToggleMayhemModeCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ToggleMayhemModeCpiBuilderInstruction { + __program: program, + global: None, + authority: None, + event_authority: None, + program: None, + enabled: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.global = Some(global); + self + } + #[inline(always)] + pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + #[inline(always)] + pub fn event_authority( + &mut self, + event_authority: &'b solana_account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.event_authority = Some(event_authority); + self + } + #[inline(always)] + pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.program = Some(program); + self + } + #[inline(always)] + pub fn enabled(&mut self, enabled: bool) -> &mut Self { + self.instruction.enabled = Some(enabled); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { + let args = ToggleMayhemModeInstructionArgs { + enabled: self + .instruction + .enabled + .clone() + .expect("enabled is not set"), + }; + let instruction = ToggleMayhemModeCpi { + __program: self.instruction.__program, + + global: self.instruction.global.expect("global is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + event_authority: self + .instruction + .event_authority + .expect("event_authority is not set"), + + program: self.instruction.program.expect("program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct ToggleMayhemModeCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_account_info::AccountInfo<'a>, + global: Option<&'b solana_account_info::AccountInfo<'a>>, + authority: Option<&'b solana_account_info::AccountInfo<'a>>, + event_authority: Option<&'b solana_account_info::AccountInfo<'a>>, + program: Option<&'b solana_account_info::AccountInfo<'a>>, + enabled: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/instructions/update_global_authority.rs b/crates/pumpfun-parser/src/generated_sdk/instructions/update_global_authority.rs index b588b148..0b6a35be 100644 --- a/crates/pumpfun-parser/src/generated_sdk/instructions/update_global_authority.rs +++ b/crates/pumpfun-parser/src/generated_sdk/instructions/update_global_authority.rs @@ -5,7 +5,10 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +pub const UPDATE_GLOBAL_AUTHORITY_DISCRIMINATOR: [u8; 8] = [227, 181, 74, 196, 208, 21, 97, 213]; /// Accounts. #[derive(Debug)] @@ -25,7 +28,6 @@ impl UpdateGlobalAuthority { pub fn instruction(&self) -> solana_instruction::Instruction { self.instruction_with_remaining_accounts(&[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::vec_init_then_push)] pub fn instruction_with_remaining_accounts( @@ -51,7 +53,9 @@ impl UpdateGlobalAuthority { false, )); accounts.extend_from_slice(remaining_accounts); - let data = borsh::to_vec(&UpdateGlobalAuthorityInstructionData::new()).unwrap(); + let data = UpdateGlobalAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -73,10 +77,16 @@ impl UpdateGlobalAuthorityInstructionData { discriminator: [227, 181, 74, 196, 208, 21, 97, 213], } } + + pub(crate) fn try_to_vec(&self) -> Result, std::io::Error> { + borsh::to_vec(self) + } } impl Default for UpdateGlobalAuthorityInstructionData { - fn default() -> Self { Self::new() } + fn default() -> Self { + Self::new() + } } /// Instruction builder for `UpdateGlobalAuthority`. @@ -99,45 +109,40 @@ pub struct UpdateGlobalAuthorityBuilder { } impl UpdateGlobalAuthorityBuilder { - pub fn new() -> Self { Self::default() } - + pub fn new() -> Self { + Self::default() + } #[inline(always)] pub fn global(&mut self, global: solana_pubkey::Pubkey) -> &mut Self { self.global = Some(global); self } - #[inline(always)] pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self { self.authority = Some(authority); self } - #[inline(always)] pub fn new_authority(&mut self, new_authority: solana_pubkey::Pubkey) -> &mut Self { self.new_authority = Some(new_authority); self } - #[inline(always)] pub fn event_authority(&mut self, event_authority: solana_pubkey::Pubkey) -> &mut Self { self.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: solana_pubkey::Pubkey) -> &mut Self { self.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self { self.__remaining_accounts.push(account); self } - /// Add additional accounts to the instruction. #[inline(always)] pub fn add_remaining_accounts( @@ -147,7 +152,6 @@ impl UpdateGlobalAuthorityBuilder { self.__remaining_accounts.extend_from_slice(accounts); self } - #[allow(clippy::clone_on_copy)] pub fn instruction(&self) -> solana_instruction::Instruction { let accounts = UpdateGlobalAuthority { @@ -205,28 +209,21 @@ impl<'a, 'b> UpdateGlobalAuthorityCpi<'a, 'b> { program: accounts.program, } } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { + pub fn invoke(&self) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], &[]) } - #[inline(always)] pub fn invoke_with_remaining_accounts( &self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) } - #[allow(clippy::arithmetic_side_effects)] #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] @@ -234,7 +231,7 @@ impl<'a, 'b> UpdateGlobalAuthorityCpi<'a, 'b> { &self, signers_seeds: &[&[&[u8]]], remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)], - ) -> solana_program_entrypoint::ProgramResult { + ) -> solana_program_error::ProgramResult { let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); accounts.push(solana_instruction::AccountMeta::new( *self.global.key, @@ -263,7 +260,9 @@ impl<'a, 'b> UpdateGlobalAuthorityCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = borsh::to_vec(&UpdateGlobalAuthorityInstructionData::new()).unwrap(); + let data = UpdateGlobalAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); let instruction = solana_instruction::Instruction { program_id: crate::PUMP_ID, @@ -316,19 +315,16 @@ impl<'a, 'b> UpdateGlobalAuthorityCpiBuilder<'a, 'b> { }); Self { instruction } } - #[inline(always)] pub fn global(&mut self, global: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.global = Some(global); self } - #[inline(always)] pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.authority = Some(authority); self } - #[inline(always)] pub fn new_authority( &mut self, @@ -337,7 +333,6 @@ impl<'a, 'b> UpdateGlobalAuthorityCpiBuilder<'a, 'b> { self.instruction.new_authority = Some(new_authority); self } - #[inline(always)] pub fn event_authority( &mut self, @@ -346,13 +341,11 @@ impl<'a, 'b> UpdateGlobalAuthorityCpiBuilder<'a, 'b> { self.instruction.event_authority = Some(event_authority); self } - #[inline(always)] pub fn program(&mut self, program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self { self.instruction.program = Some(program); self } - /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -366,7 +359,6 @@ impl<'a, 'b> UpdateGlobalAuthorityCpiBuilder<'a, 'b> { .push((account, is_writable, is_signer)); self } - /// Add additional accounts to the instruction. /// /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, @@ -381,16 +373,13 @@ impl<'a, 'b> UpdateGlobalAuthorityCpiBuilder<'a, 'b> { .extend_from_slice(accounts); self } - #[inline(always)] - pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult { self.invoke_signed(&[]) } - + pub fn invoke(&self) -> solana_program_error::ProgramResult { + self.invoke_signed(&[]) + } #[allow(clippy::clone_on_copy)] #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program_entrypoint::ProgramResult { + pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult { let instruction = UpdateGlobalAuthorityCpi { __program: self.instruction.__program, diff --git a/crates/pumpfun-parser/src/generated_sdk/types/admin_set_creator_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/admin_set_creator_event.rs new file mode 100644 index 00000000..7f47249e --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/admin_set_creator_event.rs @@ -0,0 +1,41 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetCreatorEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_creator_authority: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub bonding_curve: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub old_creator: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub new_creator: Pubkey, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/admin_set_idl_authority_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/admin_set_idl_authority_event.rs new file mode 100644 index 00000000..5d58b716 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/admin_set_idl_authority_event.rs @@ -0,0 +1,20 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminSetIdlAuthorityEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub idl_authority: Pubkey, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/admin_update_token_incentives_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/admin_update_token_incentives_event.rs new file mode 100644 index 00000000..883bc4c3 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/admin_update_token_incentives_event.rs @@ -0,0 +1,26 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AdminUpdateTokenIncentivesEvent { + pub start_time: i64, + pub end_time: i64, + pub day_number: u64, + pub token_supply_per_day: u64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + pub seconds_in_a_day: i64, + pub timestamp: i64, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/claim_token_incentives_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/claim_token_incentives_event.rs new file mode 100644 index 00000000..cb76a65e --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/claim_token_incentives_event.rs @@ -0,0 +1,29 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ClaimTokenIncentivesEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + pub amount: u64, + pub timestamp: i64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/close_user_volume_accumulator_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/close_user_volume_accumulator_event.rs new file mode 100644 index 00000000..dc04332d --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/close_user_volume_accumulator_event.rs @@ -0,0 +1,25 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CloseUserVolumeAccumulatorEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub timestamp: i64, + pub total_unclaimed_tokens: u64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, + pub last_update_timestamp: i64, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/collect_creator_fee_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/collect_creator_fee_event.rs index 03f11c8f..36143603 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/collect_creator_fee_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/collect_creator_fee_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/src/generated_sdk/types/complete_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/complete_event.rs index 1f779f9a..ef7c9f50 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/complete_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/complete_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/src/generated_sdk/types/complete_pump_amm_migration_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/complete_pump_amm_migration_event.rs index 10e915d5..422a6774 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/complete_pump_amm_migration_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/complete_pump_amm_migration_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/src/generated_sdk/types/create_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/create_event.rs index 3ae90a47..86a639d5 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/create_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/create_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -39,4 +40,10 @@ pub struct CreateEvent { pub virtual_sol_reserves: u64, pub real_token_reserves: u64, pub token_total_supply: u64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub token_program: Pubkey, + pub is_mayhem_mode: bool, } diff --git a/crates/pumpfun-parser/src/generated_sdk/types/extend_account_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/extend_account_event.rs index 7c1808b1..ab81a069 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/extend_account_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/extend_account_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/src/generated_sdk/types/fee_tier.rs b/crates/pumpfun-parser/src/generated_sdk/types/fee_tier.rs new file mode 100644 index 00000000..7d52af95 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/fee_tier.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::Fees; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FeeTier { + pub market_cap_lamports_threshold: u128, + pub fees: Fees, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/fees.rs b/crates/pumpfun-parser/src/generated_sdk/types/fees.rs new file mode 100644 index 00000000..c248d91f --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/fees.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct Fees { + pub lp_fee_bps: u64, + pub protocol_fee_bps: u64, + pub creator_fee_bps: u64, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/init_user_volume_accumulator_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/init_user_volume_accumulator_event.rs new file mode 100644 index 00000000..7fdcebcd --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/init_user_volume_accumulator_event.rs @@ -0,0 +1,26 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitUserVolumeAccumulatorEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub payer: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub timestamp: i64, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/mod.rs b/crates/pumpfun-parser/src/generated_sdk/types/mod.rs index d1a91dc6..da3e5b9c 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/mod.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/mod.rs @@ -5,20 +5,44 @@ //! //! +pub(crate) mod r#admin_set_creator_event; +pub(crate) mod r#admin_set_idl_authority_event; +pub(crate) mod r#admin_update_token_incentives_event; +pub(crate) mod r#claim_token_incentives_event; +pub(crate) mod r#close_user_volume_accumulator_event; pub(crate) mod r#collect_creator_fee_event; pub(crate) mod r#complete_event; pub(crate) mod r#complete_pump_amm_migration_event; pub(crate) mod r#create_event; pub(crate) mod r#extend_account_event; +pub(crate) mod r#fee_tier; +pub(crate) mod r#fees; +pub(crate) mod r#init_user_volume_accumulator_event; +pub(crate) mod r#reserved_fee_recipients_event; pub(crate) mod r#set_creator_event; pub(crate) mod r#set_metaplex_creator_event; pub(crate) mod r#set_params_event; +pub(crate) mod r#sync_user_volume_accumulator_event; pub(crate) mod r#trade_event; pub(crate) mod r#update_global_authority_event; -pub use self::{ - r#collect_creator_fee_event::*, r#complete_event::*, r#complete_pump_amm_migration_event::*, - r#create_event::*, r#extend_account_event::*, r#set_creator_event::*, - r#set_metaplex_creator_event::*, r#set_params_event::*, r#trade_event::*, - r#update_global_authority_event::*, -}; +pub use self::r#admin_set_creator_event::*; +pub use self::r#admin_set_idl_authority_event::*; +pub use self::r#admin_update_token_incentives_event::*; +pub use self::r#claim_token_incentives_event::*; +pub use self::r#close_user_volume_accumulator_event::*; +pub use self::r#collect_creator_fee_event::*; +pub use self::r#complete_event::*; +pub use self::r#complete_pump_amm_migration_event::*; +pub use self::r#create_event::*; +pub use self::r#extend_account_event::*; +pub use self::r#fee_tier::*; +pub use self::r#fees::*; +pub use self::r#init_user_volume_accumulator_event::*; +pub use self::r#reserved_fee_recipients_event::*; +pub use self::r#set_creator_event::*; +pub use self::r#set_metaplex_creator_event::*; +pub use self::r#set_params_event::*; +pub use self::r#sync_user_volume_accumulator_event::*; +pub use self::r#trade_event::*; +pub use self::r#update_global_authority_event::*; diff --git a/crates/pumpfun-parser/src/generated_sdk/types/reserved_fee_recipients_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/reserved_fee_recipients_event.rs new file mode 100644 index 00000000..2d6b5af0 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/reserved_fee_recipients_event.rs @@ -0,0 +1,22 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ReservedFeeRecipientsEvent { + pub timestamp: i64, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub reserved_fee_recipient: Pubkey, + pub reserved_fee_recipients: [Pubkey; 7], +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/set_creator_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/set_creator_event.rs index 173125b1..4b85a879 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/set_creator_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/set_creator_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/src/generated_sdk/types/set_metaplex_creator_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/set_metaplex_creator_event.rs index d0d2902e..853386e8 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/set_metaplex_creator_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/set_metaplex_creator_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] diff --git a/crates/pumpfun-parser/src/generated_sdk/types/set_params_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/set_params_event.rs index 498a7168..5f943003 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/set_params_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/set_params_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] @@ -32,4 +33,9 @@ pub struct SetParamsEvent { serde(with = "serde_with::As::") )] pub set_creator_authority: Pubkey, + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub admin_set_creator_authority: Pubkey, } diff --git a/crates/pumpfun-parser/src/generated_sdk/types/sync_user_volume_accumulator_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/sync_user_volume_accumulator_event.rs new file mode 100644 index 00000000..28a50909 --- /dev/null +++ b/crates/pumpfun-parser/src/generated_sdk/types/sync_user_volume_accumulator_event.rs @@ -0,0 +1,23 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct SyncUserVolumeAccumulatorEvent { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub user: Pubkey, + pub total_claimed_tokens_before: u64, + pub total_claimed_tokens_after: u64, + pub timestamp: i64, +} diff --git a/crates/pumpfun-parser/src/generated_sdk/types/trade_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/trade_event.rs index 40aaab3e..3b23cc46 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/trade_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/trade_event.rs @@ -5,9 +5,11 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; +/// ix_name: "buy" | "sell" | "buy_exact_sol_in" #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TradeEvent { @@ -43,4 +45,10 @@ pub struct TradeEvent { pub creator: Pubkey, pub creator_fee_basis_points: u64, pub creator_fee: u64, + pub track_volume: bool, + pub total_unclaimed_tokens: u64, + pub total_claimed_tokens: u64, + pub current_sol_volume: u64, + pub last_update_timestamp: i64, + pub ix_name: String, } diff --git a/crates/pumpfun-parser/src/generated_sdk/types/update_global_authority_event.rs b/crates/pumpfun-parser/src/generated_sdk/types/update_global_authority_event.rs index d62488cf..7f218153 100644 --- a/crates/pumpfun-parser/src/generated_sdk/types/update_global_authority_event.rs +++ b/crates/pumpfun-parser/src/generated_sdk/types/update_global_authority_event.rs @@ -5,7 +5,8 @@ //! //! -use borsh::{BorshDeserialize, BorshSerialize}; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; use solana_pubkey::Pubkey; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]