diff --git a/Cargo.toml b/Cargo.toml index 4683e3b..9072b32 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "4.0.7" +version = "4.0.8" edition = "2021" authors = [ "William ", diff --git a/README.md b/README.md index a20db39..06c6a45 100644 --- a/README.md +++ b/README.md @@ -108,14 +108,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.7" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.8" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "4.0.7" +sol-trade-sdk = "4.0.8" ``` ## 🛠️ Usage Examples diff --git a/README_CN.md b/README_CN.md index dc088b5..d714818 100755 --- a/README_CN.md +++ b/README_CN.md @@ -108,14 +108,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.7" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.8" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "4.0.7" +sol-trade-sdk = "4.0.8" ``` ## 🛠️ 使用示例 diff --git a/examples/address_lookup/src/main.rs b/examples/address_lookup/src/main.rs index 4081715..8038519 100644 --- a/examples/address_lookup/src/main.rs +++ b/examples/address_lookup/src/main.rs @@ -176,7 +176,7 @@ async fn pumpfun_copy_trade_with_grpc( gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/bonk_copy_trading/src/main.rs b/examples/bonk_copy_trading/src/main.rs index 85a60c7..834be9b 100644 --- a/examples/bonk_copy_trading/src/main.rs +++ b/examples/bonk_copy_trading/src/main.rs @@ -179,7 +179,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/bonk_sniper_trading/src/main.rs b/examples/bonk_sniper_trading/src/main.rs index 88173c4..4fe0c2a 100644 --- a/examples/bonk_sniper_trading/src/main.rs +++ b/examples/bonk_sniper_trading/src/main.rs @@ -147,7 +147,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/cli_trading/src/main.rs b/examples/cli_trading/src/main.rs index 917fc18..e57ded9 100644 --- a/examples/cli_trading/src/main.rs +++ b/examples/cli_trading/src/main.rs @@ -636,7 +636,7 @@ async fn handle_buy_pumpfun( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { @@ -693,7 +693,7 @@ async fn handle_buy_pumpswap( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { @@ -750,7 +750,7 @@ async fn handle_buy_bonk( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { @@ -811,7 +811,7 @@ async fn handle_buy_raydium_v4( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { @@ -873,7 +873,7 @@ async fn handle_buy_raydium_cpmm( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { diff --git a/examples/meteora_damm_v2_direct_trading/src/main.rs b/examples/meteora_damm_v2_direct_trading/src/main.rs index e8ec36f..6c38f3d 100644 --- a/examples/meteora_damm_v2_direct_trading/src/main.rs +++ b/examples/meteora_damm_v2_direct_trading/src/main.rs @@ -51,7 +51,7 @@ async fn main() -> Result<(), Box> { gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/middleware_system/src/main.rs b/examples/middleware_system/src/main.rs index af9d3af..7c02e94 100644 --- a/examples/middleware_system/src/main.rs +++ b/examples/middleware_system/src/main.rs @@ -112,7 +112,7 @@ async fn test_middleware() -> AnyResult<()> { gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/nonce_cache/src/main.rs b/examples/nonce_cache/src/main.rs index d8808ee..456249c 100644 --- a/examples/nonce_cache/src/main.rs +++ b/examples/nonce_cache/src/main.rs @@ -172,7 +172,7 @@ async fn pumpfun_copy_trade_with_grpc( gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/pumpfun_copy_trading/src/main.rs b/examples/pumpfun_copy_trading/src/main.rs index 6e6b13f..df3836c 100644 --- a/examples/pumpfun_copy_trading/src/main.rs +++ b/examples/pumpfun_copy_trading/src/main.rs @@ -169,7 +169,7 @@ async fn pumpfun_copy_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent) gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/pumpfun_sniper_trading/src/main.rs b/examples/pumpfun_sniper_trading/src/main.rs index d0a04d3..1d4912d 100644 --- a/examples/pumpfun_sniper_trading/src/main.rs +++ b/examples/pumpfun_sniper_trading/src/main.rs @@ -159,7 +159,7 @@ async fn pumpfun_sniper_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/pumpswap_direct_trading/src/main.rs b/examples/pumpswap_direct_trading/src/main.rs index ba50207..9760600 100644 --- a/examples/pumpswap_direct_trading/src/main.rs +++ b/examples/pumpswap_direct_trading/src/main.rs @@ -50,7 +50,7 @@ async fn main() -> Result<(), Box> { gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/pumpswap_trading/src/main.rs b/examples/pumpswap_trading/src/main.rs index 9d22f87..54b0a1a 100644 --- a/examples/pumpswap_trading/src/main.rs +++ b/examples/pumpswap_trading/src/main.rs @@ -244,7 +244,7 @@ async fn pumpswap_trade_with_grpc( gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/raydium_amm_v4_trading/src/main.rs b/examples/raydium_amm_v4_trading/src/main.rs index ff88f9e..ee3dd39 100644 --- a/examples/raydium_amm_v4_trading/src/main.rs +++ b/examples/raydium_amm_v4_trading/src/main.rs @@ -181,7 +181,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/raydium_cpmm_trading/src/main.rs b/examples/raydium_cpmm_trading/src/main.rs index c8720eb..9f4fbc2 100644 --- a/examples/raydium_cpmm_trading/src/main.rs +++ b/examples/raydium_cpmm_trading/src/main.rs @@ -169,7 +169,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/seed_trading/src/main.rs b/examples/seed_trading/src/main.rs index c4a18ac..863236a 100644 --- a/examples/seed_trading/src/main.rs +++ b/examples/seed_trading/src/main.rs @@ -50,7 +50,7 @@ async fn main() -> Result<(), Box> { gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, + use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/idl/pump.json b/idl/pump.json index 9977ae3..1b4d4b5 100644 --- a/idl/pump.json +++ b/idl/pump.json @@ -7,28 +7,64 @@ "description": "Created with Anchor" }, "instructions": [ + { + "name": "add_quote_mint", + "discriminator": [111, 121, 21, 56, 40, 24, 94, 209], + "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": "quote_mint", + "type": "pubkey" + } + ] + }, { "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 - ], + "discriminator": [69, 25, 171, 142, 57, 239, 13, 4], "accounts": [ { "name": "admin_set_creator_authority", "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "global", @@ -36,14 +72,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -59,19 +88,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -88,23 +105,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -123,23 +125,12 @@ }, { "name": "admin_set_idl_authority", - "discriminator": [ - 8, - 217, - 96, - 231, - 144, - 104, - 192, - 5 - ], + "discriminator": [8, 217, 96, 231, 144, 104, 192, 5], "accounts": [ { "name": "authority", "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "global", @@ -147,14 +138,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -180,23 +164,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -215,24 +184,13 @@ }, { "name": "admin_update_token_incentives", - "discriminator": [ - 209, - 11, - 115, - 87, - 213, - 23, - 124, - 204 - ], + "discriminator": [209, 11, 115, 87, 213, 23, 124, 204], "accounts": [ { "name": "authority", "writable": true, "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "global", @@ -240,14 +198,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -260,31 +211,8 @@ { "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 + 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 ] } ] @@ -314,38 +242,9 @@ "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 + 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 ] } } @@ -368,23 +267,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -419,19 +303,8 @@ }, { "name": "buy", - "docs": [ - "Buys tokens from a bonding curve." - ], - "discriminator": [ - 102, - 6, - 61, - 18, - 1, - 218, - 235, - 234 - ], + "docs": ["Buys tokens from a bonding curve."], + "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], "accounts": [ { "name": "global", @@ -439,14 +312,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -466,19 +332,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -509,38 +363,9 @@ "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 + 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 ] } } @@ -569,19 +394,7 @@ { "kind": "const", "value": [ - 99, - 114, - 101, - 97, - 116, - 111, - 114, - 45, - 118, - 97, - 117, - 108, - 116 + 99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116 ] }, { @@ -599,23 +412,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -632,31 +430,8 @@ { "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 + 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 ] } ] @@ -670,29 +445,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -708,54 +462,14 @@ "seeds": [ { "kind": "const", - "value": [ - 102, - 101, - 101, - 95, - 99, - 111, - 110, - 102, - 105, - 103 - ] + "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 + 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 ] } ], @@ -789,6 +503,412 @@ } ] }, + { + "name": "buy_exact_quote_in_v2", + "discriminator": [194, 171, 28, 70, 104, 77, 91, 47], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "associated_quote_fee_recipient", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "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": "buyback_fee_recipient", + "writable": true + }, + { + "name": "associated_quote_buyback_fee_recipient", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "buyback_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": "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": "base_mint" + } + ] + } + }, + { + "name": "associated_base_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "associated_quote_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "user", + "writable": true, + "signer": true + }, + { + "name": "associated_base_user", + "writable": true + }, + { + "name": "associated_quote_user", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "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": "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": "associated_creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator_vault" + }, + { + "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": "sharing_config", + "docs": [ + "seeds; the account is intentionally not deserialized here because it may be uninitialized", + "for mints that have not created a fee sharing config. Handlers must check", + "`data_is_empty()` / owner before reading." + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, + 103 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 12, 53, 255, 169, 5, 90, 142, 86, 141, 168, 247, 188, 7, 86, 21, + 39, 76, 241, 201, 44, 164, 31, 64, 0, 156, 81, 106, 164, 20, + 194, 124, 112 + ] + } + } + }, + { + "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": "associated_user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user_volume_accumulator" + }, + { + "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": "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" + }, + { + "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", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + } + ], + "args": [ + { + "name": "spendable_quote_in", + "type": "u64" + }, + { + "name": "min_tokens_out", + "type": "u64" + } + ] + }, { "name": "buy_exact_sol_in", "docs": [ @@ -818,16 +938,7 @@ "- creator_vault: rent.minimum_balance(0)", "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)" ], - "discriminator": [ - 56, - 252, - 116, - 8, - 158, - 223, - 205, - 95 - ], + "discriminator": [56, 252, 116, 8, 158, 223, 205, 95], "accounts": [ { "name": "global", @@ -835,14 +946,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -862,19 +966,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -905,38 +997,9 @@ "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 + 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 ] } } @@ -965,19 +1028,7 @@ { "kind": "const", "value": [ - 99, - 114, - 101, - 97, - 116, - 111, - 114, - 45, - 118, - 97, - 117, - 108, - 116 + 99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116 ] }, { @@ -995,23 +1046,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1028,31 +1064,8 @@ { "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 + 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 ] } ] @@ -1066,29 +1079,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -1104,54 +1096,14 @@ "seeds": [ { "kind": "const", - "value": [ - 102, - 101, - 101, - 95, - 99, - 111, - 110, - 102, - 105, - 103 - ] + "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 + 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 ] } ], @@ -1186,17 +1138,414 @@ ] }, { - "name": "claim_cashback", - "discriminator": [ - 37, - 58, - 35, - 126, - 190, - 53, - 228, - 197 + "name": "buy_v2", + "discriminator": [184, 23, 238, 97, 103, 197, 211, 61], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "associated_quote_fee_recipient", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "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": "buyback_fee_recipient", + "writable": true + }, + { + "name": "associated_quote_buyback_fee_recipient", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "buyback_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": "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": "base_mint" + } + ] + } + }, + { + "name": "associated_base_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "associated_quote_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "user", + "writable": true, + "signer": true + }, + { + "name": "associated_base_user", + "writable": true + }, + { + "name": "associated_quote_user", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "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": "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": "associated_creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator_vault" + }, + { + "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": "sharing_config", + "docs": [ + "seeds; the account is intentionally not deserialized here because it may be uninitialized", + "for mints that have not created a fee sharing config. Handlers must check", + "`data_is_empty()` / owner before reading." + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, + 103 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 12, 53, 255, 169, 5, 90, 142, 86, 141, 168, 247, 188, 7, 86, 21, + 39, 76, 241, 201, 44, 164, 31, 64, 0, 156, 81, 106, 164, 20, + 194, 124, 112 + ] + } + } + }, + { + "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": "associated_user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user_volume_accumulator" + }, + { + "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": "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" + }, + { + "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", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + } ], + "args": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "max_sol_cost", + "type": "u64" + } + ] + }, + { + "name": "claim_cashback", + "discriminator": [37, 58, 35, 126, 190, 53, 228, 197], "accounts": [ { "name": "user", @@ -1210,29 +1559,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -1253,23 +1581,118 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + } + ], + "args": [] + }, + { + "name": "claim_cashback_v2", + "discriminator": [122, 243, 204, 65, 94, 116, 29, 55], + "accounts": [ + { + "name": "user", + "writable": 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": "quote_mint" + }, + { + "name": "quote_token_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "associated_user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user_volume_accumulator" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "associated_quote_user", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "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 ] } ] @@ -1284,16 +1707,7 @@ }, { "name": "claim_token_incentives", - "discriminator": [ - 16, - 4, - 71, - 28, - 204, - 1, - 40, - 27 - ], + "discriminator": [16, 4, 71, 28, 204, 1, 40, 27], "accounts": [ { "name": "user" @@ -1319,38 +1733,9 @@ "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 + 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 ] } } @@ -1362,31 +1747,8 @@ { "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 + 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 ] } ] @@ -1413,38 +1775,9 @@ "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 + 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 ] } } @@ -1457,29 +1790,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -1491,9 +1803,7 @@ }, { "name": "mint", - "relations": [ - "global_volume_accumulator" - ] + "relations": ["global_volume_accumulator"] }, { "name": "token_program" @@ -1513,23 +1823,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1549,16 +1844,7 @@ }, { "name": "close_user_volume_accumulator", - "discriminator": [ - 249, - 69, - 164, - 218, - 150, - 103, - 84, - 138 - ], + "discriminator": [249, 69, 164, 218, 150, 103, 84, 138], "accounts": [ { "name": "user", @@ -1573,29 +1859,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -1612,23 +1877,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1645,16 +1895,7 @@ "docs": [ "Collects creator_fee from creator_vault to the coin creator account" ], - "discriminator": [ - 20, - 22, - 86, - 123, - 198, - 28, - 219, - 132 - ], + "discriminator": [20, 22, 86, 123, 198, 28, 219, 132], "accounts": [ { "name": "creator", @@ -1668,19 +1909,7 @@ { "kind": "const", "value": [ - 99, - 114, - 101, - 97, - 116, - 111, - 114, - 45, - 118, - 97, - 117, - 108, - 116 + 99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116 ] }, { @@ -1701,23 +1930,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1731,19 +1945,8 @@ }, { "name": "create", - "docs": [ - "Creates a new coin and bonding curve." - ], - "discriminator": [ - 24, - 30, - 200, - 40, - 5, - 28, - 7, - 119 - ], + "docs": ["Creates a new coin and bonding curve."], + "discriminator": [24, 30, 200, 40, 5, 28, 7, 119], "accounts": [ { "name": "mint", @@ -1757,19 +1960,7 @@ { "kind": "const", "value": [ - 109, - 105, - 110, - 116, - 45, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, + 109, 105, 110, 116, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121 ] } @@ -1784,19 +1975,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -1818,38 +1997,9 @@ { "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 + 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 ] }, { @@ -1860,38 +2010,9 @@ "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 + 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 ] } } @@ -1902,14 +2023,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -1925,52 +2039,14 @@ "seeds": [ { "kind": "const", - "value": [ - 109, - 101, - 116, - 97, - 100, - 97, - 116, - 97 - ] + "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 + 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 ] }, { @@ -2012,23 +2088,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2059,19 +2120,8 @@ }, { "name": "create_v2", - "docs": [ - "Creates a new spl-22 coin and bonding curve." - ], - "discriminator": [ - 214, - 144, - 76, - 236, - 95, - 139, - 49, - 180 - ], + "docs": ["Creates a new spl-22 coin and bonding curve."], + "discriminator": [214, 144, 76, 236, 95, 139, 49, 180], "accounts": [ { "name": "mint", @@ -2085,19 +2135,7 @@ { "kind": "const", "value": [ - 109, - 105, - 110, - 116, - 45, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, + 109, 105, 110, 116, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121 ] } @@ -2112,19 +2150,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -2155,38 +2181,9 @@ "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 + 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 ] } } @@ -2197,14 +2194,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -2238,57 +2228,16 @@ { "kind": "const", "value": [ - 103, - 108, - 111, - 98, - 97, - 108, - 45, - 112, - 97, - 114, - 97, - 109, - 115 + 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 + 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 ] } } @@ -2300,54 +2249,15 @@ "seeds": [ { "kind": "const", - "value": [ - 115, - 111, - 108, - 45, - 118, - 97, - 117, - 108, - 116 - ] + "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 + 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 ] } } @@ -2360,18 +2270,7 @@ { "kind": "const", "value": [ - 109, - 97, - 121, - 104, - 101, - 109, - 45, - 115, - 116, - 97, - 116, - 101 + 109, 97, 121, 104, 101, 109, 45, 115, 116, 97, 116, 101 ] }, { @@ -2382,38 +2281,9 @@ "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 + 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 ] } } @@ -2429,23 +2299,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2493,22 +2348,11 @@ "The creator vault needs to have at least the minimum distributable amount to distribute fees", "This can be checked with the get_minimum_distributable_fee instruction" ], - "discriminator": [ - 165, - 114, - 103, - 0, - 121, - 206, - 247, - 81 - ], + "discriminator": [165, 114, 103, 0, 121, 206, 247, 81], "accounts": [ { "name": "mint", - "relations": [ - "sharing_config" - ] + "relations": ["sharing_config"] }, { "name": "bonding_curve", @@ -2517,19 +2361,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -2546,19 +2378,7 @@ { "kind": "const", "value": [ - 115, - 104, - 97, - 114, - 105, - 110, - 103, - 45, - 99, - 111, - 110, - 102, - 105, + 115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, 103 ] }, @@ -2570,38 +2390,9 @@ "program": { "kind": "const", "value": [ - 12, - 53, - 255, - 169, - 5, - 90, - 142, - 86, - 141, - 168, - 247, - 188, - 7, - 86, - 21, - 39, - 76, - 241, - 201, - 44, - 164, - 31, - 64, - 0, - 156, - 81, - 106, - 164, - 20, - 194, - 124, - 112 + 12, 53, 255, 169, 5, 90, 142, 86, 141, 168, 247, 188, 7, 86, 21, + 39, 76, 241, 201, 44, 164, 31, 64, 0, 156, 81, 106, 164, 20, + 194, 124, 112 ] } } @@ -2614,19 +2405,7 @@ { "kind": "const", "value": [ - 99, - 114, - 101, - 97, - 116, - 111, - 114, - 45, - 118, - 97, - 117, - 108, - 116 + 99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116 ] }, { @@ -2648,23 +2427,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2684,19 +2448,8 @@ }, { "name": "extend_account", - "docs": [ - "Extends the size of program-owned accounts" - ], - "discriminator": [ - 234, - 102, - 194, - 203, - 150, - 72, - 62, - 229 - ], + "docs": ["Extends the size of program-owned accounts"], + "discriminator": [234, 102, 194, 203, 150, 72, 62, 229], "accounts": [ { "name": "account", @@ -2717,23 +2470,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2751,22 +2489,11 @@ "Permissionless instruction to check the minimum required fees for distribution", "Returns the minimum required balance from the creator_vault and whether distribution can proceed" ], - "discriminator": [ - 117, - 225, - 127, - 202, - 134, - 95, - 68, - 35 - ], + "discriminator": [117, 225, 127, 202, 134, 95, 68, 35], "accounts": [ { "name": "mint", - "relations": [ - "sharing_config" - ] + "relations": ["sharing_config"] }, { "name": "bonding_curve", @@ -2775,19 +2502,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -2804,19 +2519,7 @@ { "kind": "const", "value": [ - 115, - 104, - 97, - 114, - 105, - 110, - 103, - 45, - 99, - 111, - 110, - 102, - 105, + 115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, 103 ] }, @@ -2828,38 +2531,9 @@ "program": { "kind": "const", "value": [ - 12, - 53, - 255, - 169, - 5, - 90, - 142, - 86, - 141, - 168, - 247, - 188, - 7, - 86, - 21, - 39, - 76, - 241, - 201, - 44, - 164, - 31, - 64, - 0, - 156, - 81, - 106, - 164, - 20, - 194, - 124, - 112 + 12, 53, 255, 169, 5, 90, 142, 86, 141, 168, 247, 188, 7, 86, 21, + 39, 76, 241, 201, 44, 164, 31, 64, 0, 156, 81, 106, 164, 20, + 194, 124, 112 ] } } @@ -2871,19 +2545,7 @@ { "kind": "const", "value": [ - 99, - 114, - 101, - 97, - 116, - 111, - 114, - 45, - 118, - 97, - 117, - 108, - 116 + 99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116 ] }, { @@ -2904,16 +2566,7 @@ }, { "name": "init_user_volume_accumulator", - "discriminator": [ - 94, - 6, - 202, - 115, - 255, - 96, - 232, - 183 - ], + "discriminator": [94, 6, 202, 115, 255, 96, 232, 183], "accounts": [ { "name": "payer", @@ -2931,29 +2584,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -2974,23 +2606,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3004,19 +2621,8 @@ }, { "name": "initialize", - "docs": [ - "Creates the global state." - ], - "discriminator": [ - 175, - 175, - 109, - 31, - 13, - 152, - 155, - 237 - ], + "docs": ["Creates the global state."], + "discriminator": [175, 175, 109, 31, 13, 152, 155, 237], "accounts": [ { "name": "global", @@ -3025,14 +2631,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -3054,16 +2653,7 @@ "docs": [ "Migrates liquidity to pump_amm if the bonding curve is complete" ], - "discriminator": [ - 155, - 234, - 231, - 146, - 236, - 158, - 162, - 30 - ], + "discriminator": [155, 234, 231, 146, 236, 158, 162, 30], "accounts": [ { "name": "global", @@ -3071,14 +2661,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -3086,9 +2669,7 @@ { "name": "withdraw_authority", "writable": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "mint" @@ -3101,19 +2682,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -3144,38 +2713,9 @@ "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 + 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 ] } } @@ -3203,19 +2743,11 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 111, - 111, - 108 - ] + "value": [112, 111, 111, 108] }, { "kind": "const", - "value": [ - 0, - 0 - ] + "value": [0, 0] }, { "kind": "account", @@ -3244,19 +2776,7 @@ { "kind": "const", "value": [ - 112, - 111, - 111, - 108, - 45, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, + 112, 111, 111, 108, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121 ] }, @@ -3322,19 +2842,7 @@ { "kind": "const", "value": [ - 103, - 108, - 111, - 98, - 97, - 108, - 95, - 99, - 111, - 110, - 102, - 105, - 103 + 103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103 ] } ], @@ -3356,18 +2864,7 @@ { "kind": "const", "value": [ - 112, - 111, - 111, - 108, - 95, - 108, - 112, - 95, - 109, - 105, - 110, - 116 + 112, 111, 111, 108, 95, 108, 112, 95, 109, 105, 110, 116 ] }, { @@ -3468,23 +2965,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ], @@ -3501,52 +2983,31 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] } }, { - "name": "program" + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" } ], "args": [] }, { "name": "migrate_bonding_curve_creator", - "discriminator": [ - 87, - 124, - 52, - 191, - 52, - 38, - 214, - 232 - ], + "discriminator": [87, 124, 52, 191, 52, 38, 214, 232], "accounts": [ { "name": "mint", - "relations": [ - "sharing_config" - ] + "relations": ["sharing_config"] }, { "name": "bonding_curve", @@ -3556,19 +3017,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -3585,19 +3034,7 @@ { "kind": "const", "value": [ - 115, - 104, - 97, - 114, - 105, - 110, - 103, - 45, - 99, - 111, - 110, - 102, - 105, + 115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, 103 ] }, @@ -3609,38 +3046,9 @@ "program": { "kind": "const", "value": [ - 12, - 53, - 255, - 169, - 5, - 90, - 142, - 86, - 141, - 168, - 247, - 188, - 7, - 86, - 21, - 39, - 76, - 241, - 201, - 44, - 164, - 31, - 64, - 0, - 156, - 81, - 106, - 164, - 20, - 194, - 124, - 112 + 12, 53, 255, 169, 5, 90, 142, 86, 141, 168, 247, 188, 7, 86, 21, + 39, 76, 241, 201, 44, 164, 31, 64, 0, 156, 81, 106, 164, 20, + 194, 124, 112 ] } } @@ -3652,23 +3060,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3681,38 +3074,431 @@ "args": [] }, { - "name": "sell", + "name": "migrate_v2", "docs": [ - "Sells tokens into a bonding curve.", - "For cashback coins, optionally pass user_volume_accumulator as remaining_accounts[0].", - "If provided and valid, creator_fee goes to user_volume_accumulator.", - "Otherwise, falls back to transferring creator_fee to creator_vault." - ], - "discriminator": [ - 51, - 230, - 133, - 164, - 1, - 127, - 131, - 173 + "Migrates liquidity to pump_amm if the bonding curve is complete" ], + "discriminator": [187, 203, 18, 31, 206, 237, 254, 41], "accounts": [ { "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "withdraw_authority", + "writable": true, + "relations": ["global"] + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "bonding_curve", + "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 103, - 108, - 111, - 98, - 97, - 108 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "associated_base_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "associated_quote_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "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": "base_mint" + }, + { + "kind": "account", + "path": "quote_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": "base_mint" + } + ] + } + }, + { + "name": "pool_authority_mint_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "base_token_program" + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_authority_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_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": "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": "base_token_program" + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "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": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "pump_amm_event_authority" + }, + { + "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": "remove_quote_mint", + "discriminator": [177, 65, 223, 38, 88, 209, 158, 155], + "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": "quote_mint", + "type": "pubkey" + } + ] + }, + { + "name": "sell", + "docs": [ + "Sells tokens into a bonding curve.", + "For cashback coins, pass as remaining_accounts: [0] user_volume_accumulator,", + "[1] bonding_curve_v2. If provided and valid, creator_fee goes to user_volume_accumulator.", + "Otherwise, falls back to transferring creator_fee to creator_vault." + ], + "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -3732,19 +3518,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -3775,38 +3549,9 @@ "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 + 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 ] } } @@ -3832,19 +3577,7 @@ { "kind": "const", "value": [ - 99, - 114, - 101, - 97, - 116, - 111, - 114, - 45, - 118, - 97, - 117, - 108, - 116 + 99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116 ] }, { @@ -3865,23 +3598,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3897,54 +3615,14 @@ "seeds": [ { "kind": "const", - "value": [ - 102, - 101, - 101, - 95, - 99, - 111, - 110, - 102, - 105, - 103 - ] + "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 + 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 ] } ], @@ -3970,28 +3648,409 @@ } ] }, + { + "name": "sell_v2", + "discriminator": [93, 246, 130, 60, 231, 233, 64, 178], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "associated_quote_fee_recipient", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "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": "buyback_fee_recipient", + "writable": true + }, + { + "name": "associated_quote_buyback_fee_recipient", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "buyback_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": "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": "base_mint" + } + ] + } + }, + { + "name": "associated_base_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "associated_quote_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "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": "user", + "writable": true, + "signer": true + }, + { + "name": "associated_base_user", + "writable": true + }, + { + "name": "associated_quote_user", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "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": "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": "associated_creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator_vault" + }, + { + "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": "sharing_config", + "docs": [ + "seeds; the account is intentionally not deserialized here because it may be uninitialized", + "for mints that have not created a fee sharing config. Handlers must check", + "`data_is_empty()` / owner before reading." + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, + 103 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 12, 53, 255, 169, 5, 90, 142, 86, 141, 168, 247, 188, 7, 86, 21, + 39, 76, 241, 201, 44, 164, 31, 64, 0, 156, 81, 106, 164, 20, + 194, 124, 112 + ] + } + } + }, + { + "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": "associated_user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user_volume_accumulator" + }, + { + "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": "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" + }, + { + "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", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + } + ], + "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 - ], + "discriminator": [254, 148, 255, 112, 207, 142, 170, 165], "accounts": [ { "name": "set_creator_authority", "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "global", @@ -3999,14 +4058,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -4020,52 +4072,14 @@ "seeds": [ { "kind": "const", - "value": [ - 109, - 101, - 116, - 97, - 100, - 97, - 116, - 97 - ] + "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 + 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 ] }, { @@ -4076,38 +4090,9 @@ "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 + 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 ] } } @@ -4120,19 +4105,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -4149,23 +4122,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4184,16 +4142,7 @@ }, { "name": "set_mayhem_virtual_params", - "discriminator": [ - 61, - 169, - 188, - 191, - 153, - 149, - 42, - 97 - ], + "discriminator": [61, 169, 188, 191, 153, 149, 42, 97], "accounts": [ { "name": "sol_vault_authority", @@ -4203,54 +4152,15 @@ "seeds": [ { "kind": "const", - "value": [ - 115, - 111, - 108, - 45, - 118, - 97, - 117, - 108, - 116 - ] + "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 + 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 ] } } @@ -4276,38 +4186,9 @@ "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 + 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 ] } } @@ -4321,14 +4202,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -4341,19 +4215,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -4374,23 +4236,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4407,16 +4254,7 @@ "docs": [ "Syncs the bonding curve creator with the Metaplex metadata creator if it exists" ], - "discriminator": [ - 138, - 96, - 174, - 217, - 48, - 85, - 197, - 246 - ], + "discriminator": [138, 96, 174, 217, 48, 85, 197, 246], "accounts": [ { "name": "mint" @@ -4427,52 +4265,14 @@ "seeds": [ { "kind": "const", - "value": [ - 109, - 101, - 116, - 97, - 100, - 97, - 116, - 97 - ] + "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 + 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 ] }, { @@ -4483,38 +4283,9 @@ "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 + 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 ] } } @@ -4527,19 +4298,7 @@ { "kind": "const", "value": [ - 98, - 111, - 110, - 100, - 105, - 110, - 103, - 45, - 99, - 117, - 114, - 118, - 101 + 98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101 ] }, { @@ -4556,23 +4315,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4586,19 +4330,8 @@ }, { "name": "set_params", - "docs": [ - "Sets the global state parameters." - ], - "discriminator": [ - 27, - 234, - 178, - 52, - 147, - 2, - 187, - 141 - ], + "docs": ["Sets the global state parameters."], + "discriminator": [27, 234, 178, 52, 147, 2, 187, 141], "accounts": [ { "name": "global", @@ -4607,14 +4340,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -4623,9 +4349,7 @@ "name": "authority", "writable": true, "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "event_authority", @@ -4634,23 +4358,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4709,16 +4418,7 @@ }, { "name": "set_reserved_fee_recipients", - "discriminator": [ - 111, - 172, - 162, - 232, - 114, - 89, - 213, - 142 - ], + "discriminator": [111, 172, 162, 232, 114, 89, 213, 142], "accounts": [ { "name": "global", @@ -4727,14 +4427,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -4742,9 +4435,7 @@ { "name": "authority", "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "event_authority", @@ -4753,23 +4444,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4787,17 +4463,55 @@ ] }, { - "name": "sync_user_volume_accumulator", - "discriminator": [ - 86, - 31, - 192, - 87, - 163, - 87, - 79, - 238 + "name": "set_virtual_quote_reserves", + "discriminator": [101, 135, 191, 104, 9, 88, 20, 96], + "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_quote_reserves", + "type": "u64" + } + ] + }, + { + "name": "sync_user_volume_accumulator", + "discriminator": [86, 31, 192, 87, 163, 87, 79, 238], "accounts": [ { "name": "user" @@ -4809,31 +4523,8 @@ { "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 + 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 ] } ] @@ -4847,29 +4538,8 @@ { "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 + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, + 99, 99, 117, 109, 117, 108, 97, 116, 111, 114 ] }, { @@ -4886,23 +4556,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4916,16 +4571,7 @@ }, { "name": "toggle_cashback_enabled", - "discriminator": [ - 115, - 103, - 224, - 255, - 189, - 89, - 86, - 195 - ], + "discriminator": [115, 103, 224, 255, 189, 89, 86, 195], "accounts": [ { "name": "global", @@ -4934,14 +4580,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -4950,9 +4589,7 @@ "name": "authority", "writable": true, "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "event_authority", @@ -4961,23 +4598,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -4996,16 +4618,7 @@ }, { "name": "toggle_create_v2", - "discriminator": [ - 28, - 255, - 230, - 240, - 172, - 107, - 203, - 171 - ], + "discriminator": [28, 255, 230, 240, 172, 107, 203, 171], "accounts": [ { "name": "global", @@ -5014,14 +4627,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -5030,9 +4636,7 @@ "name": "authority", "writable": true, "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "event_authority", @@ -5041,23 +4645,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -5076,16 +4665,7 @@ }, { "name": "toggle_mayhem_mode", - "discriminator": [ - 1, - 9, - 111, - 208, - 100, - 31, - 255, - 163 - ], + "discriminator": [1, 9, 111, 208, 100, 31, 255, 163], "accounts": [ { "name": "global", @@ -5094,14 +4674,7 @@ "seeds": [ { "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] + "value": [103, 108, 111, 98, 97, 108] } ] } @@ -5110,9 +4683,7 @@ "name": "authority", "writable": true, "signer": true, - "relations": [ - "global" - ] + "relations": ["global"] }, { "name": "event_authority", @@ -5121,23 +4692,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -5155,43 +4711,74 @@ ] }, { - "name": "update_global_authority", - "discriminator": [ - 227, - 181, - 74, - 196, - 208, - 21, - 97, - 213 - ], + "name": "update_buyback_config", + "discriminator": [251, 224, 171, 146, 160, 26, 113, 233], "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": [ - 103, - 108, - 111, - 98, - 97, - 108 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] } }, + { + "name": "program" + } + ], + "args": [ + { + "name": "buyback_basis_points", + "type": { + "option": "u64" + } + } + ] + }, + { + "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" - ] + "relations": ["global"] }, { "name": "new_authority" @@ -5203,23 +4790,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -5235,382 +4807,121 @@ "accounts": [ { "name": "BondingCurve", - "discriminator": [ - 23, - 183, - 248, - 55, - 96, - 216, - 172, - 96 - ] + "discriminator": [23, 183, 248, 55, 96, 216, 172, 96] }, { "name": "FeeConfig", - "discriminator": [ - 143, - 52, - 146, - 187, - 219, - 123, - 76, - 155 - ] + "discriminator": [143, 52, 146, 187, 219, 123, 76, 155] }, { "name": "Global", - "discriminator": [ - 167, - 232, - 232, - 177, - 200, - 108, - 114, - 127 - ] + "discriminator": [167, 232, 232, 177, 200, 108, 114, 127] }, { "name": "GlobalVolumeAccumulator", - "discriminator": [ - 202, - 42, - 246, - 43, - 142, - 190, - 30, - 255 - ] + "discriminator": [202, 42, 246, 43, 142, 190, 30, 255] }, { "name": "SharingConfig", - "discriminator": [ - 216, - 74, - 9, - 0, - 56, - 140, - 93, - 75 - ] + "discriminator": [216, 74, 9, 0, 56, 140, 93, 75] }, { "name": "UserVolumeAccumulator", - "discriminator": [ - 86, - 255, - 112, - 14, - 102, - 53, - 154, - 250 - ] + "discriminator": [86, 255, 112, 14, 102, 53, 154, 250] } ], "events": [ { "name": "AdminSetCreatorEvent", - "discriminator": [ - 64, - 69, - 192, - 104, - 29, - 30, - 25, - 107 - ] + "discriminator": [64, 69, 192, 104, 29, 30, 25, 107] }, { "name": "AdminSetIdlAuthorityEvent", - "discriminator": [ - 245, - 59, - 70, - 34, - 75, - 185, - 109, - 92 - ] + "discriminator": [245, 59, 70, 34, 75, 185, 109, 92] }, { "name": "AdminUpdateTokenIncentivesEvent", - "discriminator": [ - 147, - 250, - 108, - 120, - 247, - 29, - 67, - 222 - ] + "discriminator": [147, 250, 108, 120, 247, 29, 67, 222] }, { "name": "ClaimCashbackEvent", - "discriminator": [ - 226, - 214, - 246, - 33, - 7, - 242, - 147, - 229 - ] + "discriminator": [226, 214, 246, 33, 7, 242, 147, 229] }, { "name": "ClaimTokenIncentivesEvent", - "discriminator": [ - 79, - 172, - 246, - 49, - 205, - 91, - 206, - 232 - ] + "discriminator": [79, 172, 246, 49, 205, 91, 206, 232] }, { "name": "CloseUserVolumeAccumulatorEvent", - "discriminator": [ - 146, - 159, - 189, - 172, - 146, - 88, - 56, - 244 - ] + "discriminator": [146, 159, 189, 172, 146, 88, 56, 244] }, { "name": "CollectCreatorFeeEvent", - "discriminator": [ - 122, - 2, - 127, - 1, - 14, - 191, - 12, - 175 - ] + "discriminator": [122, 2, 127, 1, 14, 191, 12, 175] }, { "name": "CompleteEvent", - "discriminator": [ - 95, - 114, - 97, - 156, - 212, - 46, - 152, - 8 - ] + "discriminator": [95, 114, 97, 156, 212, 46, 152, 8] }, { "name": "CompletePumpAmmMigrationEvent", - "discriminator": [ - 189, - 233, - 93, - 185, - 92, - 148, - 234, - 148 - ] + "discriminator": [189, 233, 93, 185, 92, 148, 234, 148] }, { "name": "CreateEvent", - "discriminator": [ - 27, - 114, - 169, - 77, - 222, - 235, - 99, - 118 - ] + "discriminator": [27, 114, 169, 77, 222, 235, 99, 118] }, { "name": "DistributeCreatorFeesEvent", - "discriminator": [ - 165, - 55, - 129, - 112, - 4, - 179, - 202, - 40 - ] + "discriminator": [165, 55, 129, 112, 4, 179, 202, 40] }, { "name": "ExtendAccountEvent", - "discriminator": [ - 97, - 97, - 215, - 144, - 93, - 146, - 22, - 124 - ] + "discriminator": [97, 97, 215, 144, 93, 146, 22, 124] }, { "name": "InitUserVolumeAccumulatorEvent", - "discriminator": [ - 134, - 36, - 13, - 72, - 232, - 101, - 130, - 216 - ] + "discriminator": [134, 36, 13, 72, 232, 101, 130, 216] }, { "name": "MigrateBondingCurveCreatorEvent", - "discriminator": [ - 155, - 167, - 104, - 220, - 213, - 108, - 243, - 3 - ] + "discriminator": [155, 167, 104, 220, 213, 108, 243, 3] }, { "name": "MinimumDistributableFeeEvent", - "discriminator": [ - 168, - 216, - 132, - 239, - 235, - 182, - 49, - 52 - ] + "discriminator": [168, 216, 132, 239, 235, 182, 49, 52] }, { "name": "ReservedFeeRecipientsEvent", - "discriminator": [ - 43, - 188, - 250, - 18, - 221, - 75, - 187, - 95 - ] + "discriminator": [43, 188, 250, 18, 221, 75, 187, 95] }, { "name": "SetCreatorEvent", - "discriminator": [ - 237, - 52, - 123, - 37, - 245, - 251, - 72, - 210 - ] + "discriminator": [237, 52, 123, 37, 245, 251, 72, 210] }, { "name": "SetMetaplexCreatorEvent", - "discriminator": [ - 142, - 203, - 6, - 32, - 127, - 105, - 191, - 162 - ] + "discriminator": [142, 203, 6, 32, 127, 105, 191, 162] }, { "name": "SetParamsEvent", - "discriminator": [ - 223, - 195, - 159, - 246, - 62, - 48, - 143, - 131 - ] + "discriminator": [223, 195, 159, 246, 62, 48, 143, 131] }, { "name": "SyncUserVolumeAccumulatorEvent", - "discriminator": [ - 197, - 122, - 167, - 124, - 116, - 81, - 91, - 255 - ] + "discriminator": [197, 122, 167, 124, 116, 81, 91, 255] }, { "name": "TradeEvent", - "discriminator": [ - 189, - 219, - 127, - 211, - 78, - 230, - 97, - 238 - ] + "discriminator": [189, 219, 127, 211, 78, 230, 97, 238] }, { "name": "UpdateGlobalAuthorityEvent", - "discriminator": [ - 182, - 195, - 137, - 42, - 35, - 206, - 207, - 247 - ] + "discriminator": [182, 195, 137, 42, 35, 206, 207, 247] }, { "name": "UpdateMayhemVirtualParamsEvent", - "discriminator": [ - 117, - 123, - 228, - 182, - 161, - 168, - 220, - 214 - ] + "discriminator": [117, 123, 228, 182, 161, 168, 220, 214] } ], "errors": [ @@ -5883,6 +5194,68 @@ "code": 6056, "name": "CashbackNotEnabled", "msg": "Cashback is not enabled" + }, + { + "code": 6057, + "name": "BuybackFeeRecipientNotAuthorized", + "msg": "Buyback fee recipient not authorized" + }, + { + "code": 6058, + "name": "AllBuybackFeeRecipientsShouldBeNonZero" + }, + { + "code": 6059, + "name": "NotUniqueBuybackFeeRecipients" + }, + { + "code": 6060, + "name": "BuybackBasisPointsOutOfRange", + "msg": "buyback_basis_points must be <= 10_000" + }, + { + "code": 6061, + "name": "WrongBuybackFeeRecipientsCount", + "msg": "buyback fee recipients require exactly 8 remaining accounts (or none)" + }, + { + "code": 6062, + "name": "BuybackFeeRecipientMissing" + }, + { + "code": 6063, + "name": "UnsupportedQuoteMint", + "msg": "Unsupported quote mint" + }, + { + "code": 6064, + "name": "InvalidQuoteTokenProgram", + "msg": "Create v2: quote token program must be legacy SPL Token" + }, + { + "code": 6065, + "name": "InvalidAssociatedQuoteBondingCurve", + "msg": "Create v2: associated quote bonding curve address does not match derivation" + }, + { + "code": 6066, + "name": "QuoteMintWhitelistFull", + "msg": "Quote mint whitelist is full" + }, + { + "code": 6067, + "name": "QuoteMintAlreadyWhitelisted", + "msg": "Quote mint is already whitelisted" + }, + { + "code": 6068, + "name": "QuoteMintNotWhitelisted", + "msg": "Quote mint is not in the whitelist" + }, + { + "code": 6069, + "name": "QuoteMintNotEligibleForWhitelist", + "msg": "Quote mint cannot be added or removed via whitelist (default or native SOL mint)" } ], "types": [ @@ -5976,7 +5349,7 @@ "type": "u64" }, { - "name": "virtual_sol_reserves", + "name": "virtual_quote_reserves", "type": "u64" }, { @@ -5984,7 +5357,7 @@ "type": "u64" }, { - "name": "real_sol_reserves", + "name": "real_quote_reserves", "type": "u64" }, { @@ -6006,6 +5379,10 @@ { "name": "is_cashback_coin", "type": "bool" + }, + { + "name": "quote_mint", + "type": "pubkey" } ] } @@ -6142,6 +5519,10 @@ { "name": "timestamp", "type": "i64" + }, + { + "name": "quote_mint", + "type": "pubkey" } ] } @@ -6264,6 +5645,14 @@ { "name": "is_cashback_enabled", "type": "bool" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "virtual_quote_reserves", + "type": "u64" } ] } @@ -6368,6 +5757,16 @@ } } } + }, + { + "name": "stable_fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } } ] } @@ -6419,9 +5818,7 @@ "fields": [ { "name": "initialized", - "docs": [ - "Unused" - ], + "docs": ["Unused"], "type": "bool" }, { @@ -6458,9 +5855,7 @@ }, { "name": "enable_migrate", - "docs": [ - "Unused" - ], + "docs": ["Unused"], "type": "bool" }, { @@ -6474,10 +5869,7 @@ { "name": "fee_recipients", "type": { - "array": [ - "pubkey", - 7 - ] + "array": ["pubkey", 7] } }, { @@ -6507,15 +5899,32 @@ { "name": "reserved_fee_recipients", "type": { - "array": [ - "pubkey", - 7 - ] + "array": ["pubkey", 7] } }, { "name": "is_cashback_enabled", "type": "bool" + }, + { + "name": "buyback_fee_recipients", + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "buyback_basis_points", + "type": "u64" + }, + { + "name": "initial_virtual_quote_reserves", + "type": "u64" + }, + { + "name": "whitelisted_quote_mints", + "type": { + "array": ["pubkey", 1] + } } ] } @@ -6544,19 +5953,13 @@ { "name": "total_token_supply", "type": { - "array": [ - "u64", - 30 - ] + "array": ["u64", 30] } }, { "name": "sol_volumes", "type": { - "array": [ - "u64", - 30 - ] + "array": ["u64", 30] } } ] @@ -6638,9 +6041,7 @@ "name": "OptionBool", "type": { "kind": "struct", - "fields": [ - "bool" - ] + "fields": ["bool"] } }, { @@ -6659,10 +6060,7 @@ { "name": "reserved_fee_recipients", "type": { - "array": [ - "pubkey", - 7 - ] + "array": ["pubkey", 7] } } ] @@ -6768,10 +6166,7 @@ { "name": "fee_recipients", "type": { - "array": [ - "pubkey", - 8 - ] + "array": ["pubkey", 8] } }, { @@ -6877,9 +6272,7 @@ }, { "name": "TradeEvent", - "docs": [ - "ix_name: \"buy\" | \"sell\" | \"buy_exact_sol_in\"" - ], + "docs": ["ix_name: \"buy\" | \"sell\" | \"buy_exact_sol_in\""], "type": { "kind": "struct", "fields": [ @@ -6982,6 +6375,40 @@ { "name": "cashback", "type": "u64" + }, + { + "name": "buyback_fee_basis_points", + "type": "u64" + }, + { + "name": "buyback_fee", + "type": "u64" + }, + { + "name": "shareholders", + "type": { + "vec": { + "defined": { + "name": "Shareholder" + } + } + } + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "virtual_quote_reserves", + "type": "u64" + }, + { + "name": "real_quote_reserves", + "type": "u64" } ] } @@ -7095,4 +6522,4 @@ } } ] -} \ No newline at end of file +} diff --git a/idl/pump_amm.json b/idl/pump_amm.json index 372cf2a..47d7b95 100644 --- a/idl/pump_amm.json +++ b/idl/pump_amm.json @@ -4835,7 +4835,7 @@ }, { "code": 6052, - "name": "TokensInVaultLessThanCashbackEarned" + "name": "CashbackEarnedDoesNotMatchTokenInVault" } ], "types": [ diff --git a/idl/pump_fees.json b/idl/pump_fees.json index fc21546..8b45bbb 100644 --- a/idl/pump_fees.json +++ b/idl/pump_fees.json @@ -7,6 +7,115 @@ "description": "Created with Anchor" }, "instructions": [ + { + "name": "claim_social_fee_pda", + "discriminator": [ + 225, + 21, + 251, + 133, + 161, + 30, + 199, + 226 + ], + "accounts": [ + { + "name": "recipient", + "writable": true + }, + { + "name": "social_fee_pda", + "writable": true + }, + { + "name": "fee_program_global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "name": "social_claim_authority", + "signer": true, + "relations": [ + "fee_program_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": "user_id", + "type": "string" + }, + { + "name": "platform", + "type": "u8" + } + ], + "returns": { + "option": { + "defined": { + "name": "SocialFeePdaClaimed" + } + } + } + }, { "name": "create_fee_sharing_config", "docs": [ @@ -371,6 +480,106 @@ ], "args": [] }, + { + "name": "create_social_fee_pda", + "discriminator": [ + 144, + 224, + 59, + 211, + 78, + 248, + 202, + 220 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "social_fee_pda", + "writable": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "fee_program_global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "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": "user_id", + "type": "string" + }, + { + "name": "platform", + "type": "u8" + } + ] + }, { "name": "get_fees", "docs": [ @@ -528,10 +737,169 @@ ], "args": [] }, + { + "name": "initialize_fee_program_global", + "discriminator": [ + 35, + 215, + 130, + 84, + 233, + 56, + 124, + 167 + ], + "accounts": [ + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "pump_global" + ] + }, + { + "name": "pump_global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ], + "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": "fee_program_global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "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": "social_claim_authority", + "type": "pubkey" + }, + { + "name": "disable_flags", + "type": "u8" + }, + { + "name": "claim_rate_limit", + "type": "u64" + } + ] + }, { "name": "reset_fee_sharing_config", "docs": [ - "Reset Fee Sharing Config, make sure to distribute all the fees before calling this" + "Reset Fee Sharing Config and distribute pending fees first" ], "discriminator": [ 10, @@ -544,6 +912,42 @@ 186 ], "accounts": [ + { + "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", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + }, { "name": "authority", "signer": true @@ -603,9 +1007,6 @@ } } }, - { - "name": "new_admin" - }, { "name": "mint", "relations": [ @@ -644,7 +1045,148 @@ } }, { - "name": "event_authority", + "name": "bonding_curve", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 111, + 110, + 100, + 105, + 110, + 103, + 45, + 99, + 117, + 114, + 118, + 101 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "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": "pump_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": "sharing_config" + } + ], + "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": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "pump_program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "pump_event_authority", "pda": { "seeds": [ { @@ -669,11 +1211,198 @@ 121 ] } - ] + ], + "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": "program" + "name": "pump_amm_program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "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": "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 + ] + } + } + }, + { + "name": "wsol_mint", + "address": "So11111111111111111111111111111111111111112" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "coin_creator_vault_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "sharing_config" + } + ], + "program": { + "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 + ] + } + } + }, + { + "name": "coin_creator_vault_ata", + "writable": true } ], "args": [] @@ -693,18 +1422,50 @@ 58, 104 ], + "accounts": [], + "args": [] + }, + { + "name": "set_authority", + "discriminator": [ + 133, + 250, + 37, + 21, + 110, + 163, + 26, + 121 + ], "accounts": [ { "name": "authority", - "signer": true + "writable": true, + "signer": true, + "relations": [ + "fee_program_global" + ] }, { - "name": "global", + "name": "fee_program_global", + "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, 103, 108, 111, @@ -713,80 +1474,6 @@ 108 ] } - ], - "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": "mint", - "relations": [ - "sharing_config" - ] - }, - { - "name": "sharing_config", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 104, - 97, - 114, - 105, - 110, - 103, - 45, - 99, - 111, - 110, - 102, - 105, - 103 - ] - }, - { - "kind": "account", - "path": "mint" - } ] } }, @@ -823,7 +1510,288 @@ "name": "program" } ], - "args": [] + "args": [ + { + "name": "new_authority", + "type": "pubkey" + } + ] + }, + { + "name": "set_claim_rate_limit", + "discriminator": [ + 185, + 211, + 159, + 174, + 212, + 49, + 88, + 4 + ], + "accounts": [ + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "fee_program_global" + ] + }, + { + "name": "fee_program_global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "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": "claim_rate_limit", + "type": "u64" + } + ] + }, + { + "name": "set_disable_flags", + "discriminator": [ + 194, + 217, + 112, + 35, + 114, + 222, + 51, + 190 + ], + "accounts": [ + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "fee_program_global" + ] + }, + { + "name": "fee_program_global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "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_flags", + "type": "u8" + } + ] + }, + { + "name": "set_social_claim_authority", + "discriminator": [ + 147, + 54, + 184, + 154, + 136, + 237, + 185, + 153 + ], + "accounts": [ + { + "name": "authority", + "writable": true, + "signer": true, + "relations": [ + "fee_program_global" + ] + }, + { + "name": "fee_program_global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 101, + 101, + 45, + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 45, + 103, + 108, + 111, + 98, + 97, + 108 + ] + } + ] + } + }, + { + "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": "social_claim_authority", + "type": "pubkey" + } + ] }, { "name": "transfer_fee_sharing_authority", @@ -840,139 +1808,7 @@ 210, 96 ], - "accounts": [ - { - "name": "authority", - "signer": true - }, - { - "name": "global", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 103, - 108, - 111, - 98, - 97, - 108 - ] - } - ], - "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": "mint", - "relations": [ - "sharing_config" - ] - }, - { - "name": "sharing_config", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 115, - 104, - 97, - 114, - 105, - 110, - 103, - 45, - 99, - 111, - 110, - 102, - 105, - 103 - ] - }, - { - "kind": "account", - "path": "mint" - } - ] - } - }, - { - "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" - } - ], + "accounts": [], "args": [] }, { @@ -1823,6 +2659,19 @@ 155 ] }, + { + "name": "FeeProgramGlobal", + "discriminator": [ + 162, + 165, + 245, + 49, + 29, + 37, + 55, + 242 + ] + }, { "name": "Global", "discriminator": [ @@ -1861,6 +2710,19 @@ 93, 75 ] + }, + { + "name": "SocialFeePda", + "discriminator": [ + 139, + 96, + 53, + 17, + 42, + 169, + 206, + 150 + ] } ], "events": [ @@ -1890,6 +2752,19 @@ 126 ] }, + { + "name": "InitializeFeeProgramGlobalEvent", + "discriminator": [ + 40, + 233, + 156, + 78, + 95, + 0, + 8, + 199 + ] + }, { "name": "ResetFeeSharingConfigEvent", "discriminator": [ @@ -1904,31 +2779,83 @@ ] }, { - "name": "RevokeFeeSharingAuthorityEvent", + "name": "SetAuthorityEvent", "discriminator": [ - 114, - 23, - 101, - 60, - 14, - 190, - 153, - 62 + 18, + 175, + 132, + 66, + 208, + 201, + 87, + 242 ] }, { - "name": "TransferFeeSharingAuthorityEvent", + "name": "SetClaimRateLimitEvent", "discriminator": [ - 124, + 13, 143, - 198, - 245, - 77, - 184, + 143, + 235, + 181, + 19, + 51, + 40 + ] + }, + { + "name": "SetDisableFlagsEvent", + "discriminator": [ + 5, 8, + 179, + 65, + 49, + 55, + 145, + 126 + ] + }, + { + "name": "SetSocialClaimAuthorityEvent", + "discriminator": [ + 60, + 118, + 127, + 132, + 239, + 52, + 254, + 14 + ] + }, + { + "name": "SocialFeePdaClaimed", + "discriminator": [ + 50, + 18, + 193, + 65, + 237, + 210, + 234, 236 ] }, + { + "name": "SocialFeePdaCreated", + "discriminator": [ + 183, + 183, + 218, + 147, + 24, + 124, + 137, + 169 + ] + }, { "name": "UpdateAdminEvent", "discriminator": [ @@ -2031,7 +2958,7 @@ { "code": 6009, "name": "SharingConfigAdminRevoked", - "msg": "Sharing config admin has been revoked" + "msg": "Sharing config authority has been revoked - sharing config can only be updated once" }, { "code": 6010, @@ -2087,6 +3014,26 @@ "code": 6020, "name": "ShareholderAccountMismatch", "msg": "Remaining account key doesn't match shareholder address" + }, + { + "code": 6021, + "name": "FeatureDeactivated", + "msg": "Feature is currently deactivated" + }, + { + "code": 6022, + "name": "UserIdTooLong", + "msg": "User ID exceeds maximum length" + }, + { + "code": 6023, + "name": "DeprecatedInstruction", + "msg": "Instruction is deprecated" + }, + { + "code": 6024, + "name": "FeeSharesAlreadyUpdated", + "msg": "Reward split can only be updated once" } ], "types": [ @@ -2242,6 +3189,43 @@ ] } }, + { + "name": "FeeProgramGlobal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "disable_flags", + "type": "u8" + }, + { + "name": "social_claim_authority", + "type": "pubkey" + }, + { + "name": "claim_rate_limit", + "type": "u64" + }, + { + "name": "_reserved", + "type": { + "array": [ + "u8", + 256 + ] + } + } + ] + } + }, { "name": "FeeTier", "type": { @@ -2400,6 +3384,34 @@ ] } }, + { + "name": "InitializeFeeProgramGlobalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "social_claim_authority", + "type": "pubkey" + }, + { + "name": "disable_flags", + "type": "u8" + }, + { + "name": "claim_rate_limit", + "type": "u64" + } + ] + } + }, { "name": "Pool", "type": { @@ -2496,12 +3508,20 @@ } } } + }, + { + "name": "old_version", + "type": "u8" + }, + { + "name": "new_version", + "type": "u8" } ] } }, { - "name": "RevokeFeeSharingAuthorityEvent", + "name": "SetAuthorityEvent", "type": { "kind": "struct", "fields": [ @@ -2510,15 +3530,59 @@ "type": "i64" }, { - "name": "mint", + "name": "old_authority", "type": "pubkey" }, { - "name": "sharing_config", + "name": "new_authority", "type": "pubkey" + } + ] + } + }, + { + "name": "SetClaimRateLimitEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" }, { - "name": "admin", + "name": "claim_rate_limit", + "type": "u64" + } + ] + } + }, + { + "name": "SetDisableFlagsEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "disable_flags", + "type": "u8" + } + ] + } + }, + { + "name": "SetSocialClaimAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "social_claim_authority", "type": "pubkey" } ] @@ -2587,7 +3651,55 @@ } }, { - "name": "TransferFeeSharingAuthorityEvent", + "name": "SocialFeePda", + "docs": [ + "Platform identifier: 0=pump, 1=twitter, etc." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "version", + "type": "u8" + }, + { + "name": "user_id", + "docs": [ + "Max 20 characters to fit u64::MAX (18,446,744,073,709,551,615) as a string.", + "Actual storage: 4 bytes (length prefix) + 20 bytes (content) = 24 bytes." + ], + "type": "string" + }, + { + "name": "platform", + "type": "u8" + }, + { + "name": "total_claimed", + "type": "u64" + }, + { + "name": "last_claimed", + "type": "u64" + }, + { + "name": "_reserved", + "type": { + "array": [ + "u8", + 128 + ] + } + } + ] + } + }, + { + "name": "SocialFeePdaClaimed", "type": { "kind": "struct", "fields": [ @@ -2596,19 +3708,71 @@ "type": "i64" }, { - "name": "mint", + "name": "user_id", + "type": "string" + }, + { + "name": "platform", + "type": "u8" + }, + { + "name": "social_fee_pda", "type": "pubkey" }, { - "name": "sharing_config", + "name": "recipient", "type": "pubkey" }, { - "name": "old_admin", + "name": "social_claim_authority", "type": "pubkey" }, { - "name": "new_admin", + "name": "amount_claimed", + "type": "u64" + }, + { + "name": "claimable_before", + "type": "u64" + }, + { + "name": "lifetime_claimed", + "type": "u64" + }, + { + "name": "recipient_balance_before", + "type": "u64" + }, + { + "name": "recipient_balance_after", + "type": "u64" + } + ] + } + }, + { + "name": "SocialFeePdaCreated", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "user_id", + "type": "string" + }, + { + "name": "platform", + "type": "u8" + }, + { + "name": "social_fee_pda", + "type": "pubkey" + }, + { + "name": "created_by", "type": "pubkey" } ] @@ -2702,6 +3866,10 @@ } } } + }, + { + "name": "version", + "type": "u8" } ] } @@ -2742,11 +3910,54 @@ } ], "constants": [ + { + "name": "AMM_CREATOR_VAULT_AUTHORITY_SEED", + "type": { + "array": [ + "u8", + 13 + ] + }, + "value": "[99, 114, 101, 97, 116, 111, 114, 95, 118, 97, 117, 108, 116]" + }, { "name": "FEE_CONFIG_SEED", "type": "bytes", "value": "[102, 101, 101, 95, 99, 111, 110, 102, 105, 103]" }, + { + "name": "FEE_PROGRAM_GLOBAL_SEED", + "type": { + "array": [ + "u8", + 18 + ] + }, + "value": "[102, 101, 101, 45, 112, 114, 111, 103, 114, 97, 109, 45, 103, 108, 111, 98, 97, 108]" + }, + { + "name": "PUMP_CREATOR_VAULT_SEED", + "type": { + "array": [ + "u8", + 13 + ] + }, + "value": "[99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116]" + }, + { + "name": "PUMP_GLOBAL_SEED", + "docs": [ + "Bonding Curve Program Global Seed" + ], + "type": { + "array": [ + "u8", + 6 + ] + }, + "value": "[103, 108, 111, 98, 97, 108]" + }, { "name": "SHARING_CONFIG_SEED", "type": { @@ -2756,6 +3967,16 @@ ] }, "value": "[115, 104, 97, 114, 105, 110, 103, 45, 99, 111, 110, 102, 105, 103]" + }, + { + "name": "SOCIAL_FEE_PDA_SEED", + "type": { + "array": [ + "u8", + 14 + ] + }, + "value": "[115, 111, 99, 105, 97, 108, 45, 102, 101, 101, 45, 112, 100, 97]" } ] } \ No newline at end of file diff --git a/src/client/mod.rs b/src/client/mod.rs index 28527d6..4d627e1 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -3,6 +3,7 @@ use crate::common::nonce_cache::DurableNonceInfo; use crate::common::sdk_log; use crate::common::GasFeeStrategy; +use crate::common::SolanaRpcClient; use crate::common::{InfrastructureConfig, TradeConfig}; #[cfg(feature = "perf-trace")] use crate::constants::trade::trade::DEFAULT_SLIPPAGE; @@ -25,7 +26,6 @@ use crate::trading::factory::DexType; use crate::trading::MiddlewareManager; use crate::trading::SwapParams; use crate::trading::TradeFactory; -use crate::common::SolanaRpcClient; use parking_lot::Mutex; use rustls::crypto::{ring::default_provider, CryptoProvider}; use solana_sdk::hash::Hash; @@ -112,7 +112,9 @@ impl TradingInfrastructure { // Initialize rent cache (with timeout so slow RPC doesn't block forever) const RENT_UPDATE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(15); - match tokio::time::timeout(RENT_UPDATE_TIMEOUT, crate::common::seed::update_rents(&rpc)).await { + match tokio::time::timeout(RENT_UPDATE_TIMEOUT, crate::common::seed::update_rents(&rpc)) + .await + { Ok(Ok(())) => {} Ok(Err(e)) => { if sdk_log::sdk_log_enabled() { @@ -218,15 +220,9 @@ impl TradingInfrastructure { } if !swqos_clients.is_empty() { - let labels: Vec<&str> = swqos_clients - .iter() - .map(|c| c.get_swqos_type().as_str()) - .collect(); - eprintln!( - "ℹ️ SWQOS 通道已就绪: {} 条 → [{}]", - swqos_clients.len(), - labels.join(", ") - ); + let labels: Vec<&str> = + swqos_clients.iter().map(|c| c.get_swqos_type().as_str()).collect(); + eprintln!("ℹ️ SWQOS 通道已就绪: {} 条 → [{}]", swqos_clients.len(), labels.join(", ")); } let swqos_count = swqos_clients.len(); @@ -735,7 +731,8 @@ impl TradingClient { Some(v) => { self.use_dedicated_sender_threads = true; let cap = v.len().min(self.max_sender_concurrency); - self.sender_thread_cores = Some(Arc::new(if cap < v.len() { v[..cap].to_vec() } else { v })); + self.sender_thread_cores = + Some(Arc::new(if cap < v.len() { v[..cap].to_vec() } else { v })); } } self @@ -798,7 +795,10 @@ impl TradingClient { pub async fn buy( &self, params: TradeBuyParams, - ) -> Result<(bool, Vec, Option, Vec<(crate::swqos::SwqosType, i64)>), anyhow::Error> { + ) -> Result< + (bool, Vec, Option, Vec<(crate::swqos::SwqosType, i64)>), + anyhow::Error, + > { if params.recent_blockhash.is_none() && params.durable_nonce.is_none() { return Err(anyhow::anyhow!( "Must provide either recent_blockhash or durable_nonce for buy (required for transaction validity)" @@ -872,8 +872,9 @@ impl TradingClient { }; let swap_result = executor.swap(buy_params).await; - let result = - swap_result.map(|(success, sigs, err, timings)| (success, sigs, err.map(TradeError::from), timings)); + let result = swap_result.map(|(success, sigs, err, timings)| { + (success, sigs, err.map(TradeError::from), timings) + }); result } @@ -906,7 +907,10 @@ impl TradingClient { pub async fn sell( &self, params: TradeSellParams, - ) -> Result<(bool, Vec, Option, Vec<(crate::swqos::SwqosType, i64)>), anyhow::Error> { + ) -> Result< + (bool, Vec, Option, Vec<(crate::swqos::SwqosType, i64)>), + anyhow::Error, + > { #[cfg(feature = "perf-trace")] if sdk_log::sdk_log_enabled() && params.slippage_basis_points.is_none() { debug!( @@ -980,8 +984,9 @@ impl TradingClient { }; let swap_result = executor.swap(sell_params).await; - let result = - swap_result.map(|(success, sigs, err, timings)| (success, sigs, err.map(TradeError::from), timings)); + let result = swap_result.map(|(success, sigs, err, timings)| { + (success, sigs, err.map(TradeError::from), timings) + }); result } @@ -1016,7 +1021,10 @@ impl TradingClient { mut params: TradeSellParams, amount_token: u64, percent: u64, - ) -> Result<(bool, Vec, Option, Vec<(crate::swqos::SwqosType, i64)>), anyhow::Error> { + ) -> Result< + (bool, Vec, Option, Vec<(crate::swqos::SwqosType, i64)>), + anyhow::Error, + > { if percent == 0 || percent > 100 { return Err(anyhow::anyhow!("Percentage must be between 1 and 100")); } diff --git a/src/common/address_lookup.rs b/src/common/address_lookup.rs index 3debde0..a04668f 100755 --- a/src/common/address_lookup.rs +++ b/src/common/address_lookup.rs @@ -8,16 +8,16 @@ pub async fn fetch_address_lookup_table_account( lookup_table_address: &Pubkey, ) -> Result { let account = rpc.get_account(lookup_table_address).await?; - + // Parse address lookup table manually // Layout: 4 bytes (type) + 4 bytes (deactivation_slot) + 4 bytes (last_extended_slot) + 1 byte (last_extended_slot_start_index) + 1 byte (authority) + padding // Then addresses start at offset 56, each address is 32 bytes // First 4 bytes indicate if initialized (should be 1 or 2) - + if account.data.len() < 56 { return Err(anyhow::anyhow!("Address lookup table account data too short")); } - + // Read number of addresses (stored at offset 20 as u32, but we need to scan the bitmap) // Actually simpler: addresses start at offset 56, count from bitmap at offset 8-20 let mut addresses = Vec::new(); @@ -30,10 +30,8 @@ pub async fn fetch_address_lookup_table_account( } offset += 32; } - - let address_lookup_table_account = AddressLookupTableAccount { - key: *lookup_table_address, - addresses, - }; + + let address_lookup_table_account = + AddressLookupTableAccount { key: *lookup_table_address, addresses }; Ok(address_lookup_table_account) } diff --git a/src/common/sdk_log.rs b/src/common/sdk_log.rs index 5dab5ae..8fc8d18 100644 --- a/src/common/sdk_log.rs +++ b/src/common/sdk_log.rs @@ -34,10 +34,7 @@ fn extract_swqos_error_message(s: &str) -> String { // Try parse as JSON only when input looks like JSON (avoid parsing long non-JSON strings) if s.starts_with('{') { if let Ok(v) = serde_json::from_str::(s) { - let obj = v - .get("error") - .and_then(|e| e.as_object()) - .or_else(|| v.as_object()); + let obj = v.get("error").and_then(|e| e.as_object()).or_else(|| v.as_object()); if let Some(o) = obj { if let Some(m) = o.get("message").and_then(|x| x.as_str()) { return m.to_string(); @@ -69,11 +66,7 @@ pub fn set_sdk_log_enabled(enabled: bool) { /// Aligned log: ` [Soyas ] Buy submitted: 13.936 µs`. Call only when sdk_log_enabled(). #[inline] -pub fn log_swqos_submitted( - provider: &str, - trade_type: impl fmt::Display, - elapsed: Duration, -) { +pub fn log_swqos_submitted(provider: &str, trade_type: impl fmt::Display, elapsed: Duration) { println!( " [{:width$}] {} submitted: {}", provider, diff --git a/src/common/seed.rs b/src/common/seed.rs index 5c88a9f..e80fd94 100644 --- a/src/common/seed.rs +++ b/src/common/seed.rs @@ -94,8 +94,15 @@ pub fn create_associated_token_account_use_seed( let len = 165; // 🔧 修复:create_account_with_seed 的第3个参数必须是 payer(与第92行生成地址时使用的 base 一致) // 否则创建的账户地址与 ata_like 不匹配,导致 initializeAccount3 失败 - let create_acc = - system_instruction::create_account_with_seed(payer, &ata_like, payer, seed, rent, len, token_program); + let create_acc = system_instruction::create_account_with_seed( + payer, + &ata_like, + payer, + seed, + rent, + len, + token_program, + ); let init_acc = if is_2022_token { crate::common::spl_token_2022::initialize_account3(&token_program, &ata_like, mint, owner)? diff --git a/src/common/spl_token.rs b/src/common/spl_token.rs index fd89491..0c81957 100644 --- a/src/common/spl_token.rs +++ b/src/common/spl_token.rs @@ -20,10 +20,7 @@ pub fn close_account( let mut accounts = Vec::with_capacity(3 + signer_pubkeys.len()); accounts.push(AccountMeta::new(*account_pubkey, false)); accounts.push(AccountMeta::new(*destination_pubkey, false)); - accounts.push(AccountMeta::new_readonly( - *owner_pubkey, - signer_pubkeys.is_empty(), - )); + accounts.push(AccountMeta::new_readonly(*owner_pubkey, signer_pubkeys.is_empty())); for signer_pubkey in signer_pubkeys.iter() { accounts.push(AccountMeta::new_readonly(**signer_pubkey, true)); } diff --git a/src/common/types.rs b/src/common/types.rs index b7b636a..6f12935 100755 --- a/src/common/types.rs +++ b/src/common/types.rs @@ -95,9 +95,8 @@ pub struct TradeConfig { /// (Astralane QUIC `:9000` or Plain/Binary HTTP `mev-protect=true`, BlockRazor sandwichMitigation) /// use their MEV-protected endpoints/modes. Default false (no MEV protection, lower latency). pub mev_protection: bool, - /// Use PumpFun V2 instructions (buy_v2 / sell_v2, 27-account metas, quote_mint support). - /// Default: `false` — uses V1 instructions (18-account metas, legacy SOL-paired, smaller transaction). - /// Set to `true` when PumpFun officially deploys V2 on mainnet. + /// Use PumpFun V2 instructions (buy_v2 / sell_v2, 27/26-account metas, quote_mint support). + /// Default: `false` keeps legacy SOL-paired instructions for smaller transactions; V2 is the official future-proof interface. pub use_pumpfun_v2: bool, } diff --git a/src/constants/swqos.rs b/src/constants/swqos.rs index f8d0e50..cb257a4 100755 --- a/src/constants/swqos.rs +++ b/src/constants/swqos.rs @@ -212,7 +212,7 @@ pub const SWQOS_ENDPOINTS_ZERO_SLOT: [&str; 10] = [ "http://de2.0slot.trade", // Use de2 for TSW, and de1 for OVH "http://ams.0slot.trade", "http://ams.0slot.trade", // Dublin: 无 IE 专用;在已公布 EU 点中选距爱尔兰最近的 ams(相对 de2 等) - "http://la.0slot.trade", // SLC: no UT PoP; nearest US-West published host + "http://la.0slot.trade", // SLC: no UT PoP; nearest US-West published host "http://jp.0slot.trade", "http://jp.0slot.trade", // SG: 无本地 PoP;已公布 APAC 仅 jp,为表中离新加坡最近的大圆距离 "http://ams.0slot.trade", // London: 无 UK 专用;已公布 EU 点中 ams 距伦敦最近之一 @@ -252,11 +252,11 @@ pub const SWQOS_ENDPOINTS_NODE1: [&str; 10] = [ "http://fra.node1.me", "http://ams.node1.me", "http://lon.node1.me", // Dublin: 已公布中英爱区域用 lon(地理上近爱尔兰) - "http://ny.node1.me", // SLC: 已公布美国仅 ny;美西无 PoP,受可用区限制复用美东 + "http://ny.node1.me", // SLC: 已公布美国仅 ny;美西无 PoP,受可用区限制复用美东 "http://tk.node1.me", "http://tk.node1.me", // SG: 已公布 APAC 仅 tk;地理上为表中离 SG 最近 "http://lon.node1.me", - "http://ny.node1.me", // LosAngeles: 同上,美国仅 ny 入口 + "http://ny.node1.me", // LosAngeles: 同上,美国仅 ny 入口 "http://fra.node1.me", // Default: 非地理区域;与 QUIC 对齐为 EU 枢纽 ]; @@ -359,7 +359,7 @@ pub const SWQOS_ENDPOINTS_ASTRALANE_QUIC: [&str; 10] = [ "fr.gateway.astralane.io:7000", "ams.gateway.astralane.io:7000", "ams.gateway.astralane.io:7000", // Dublin: 同 HTTP - "la.gateway.astralane.io:7000", // SLC: 美西 la 为最近已公布美区入口 + "la.gateway.astralane.io:7000", // SLC: 美西 la 为最近已公布美区入口 "jp.gateway.astralane.io:7000", "sg.gateway.astralane.io:7000", "ams.gateway.astralane.io:7000", // London: 同 HTTP @@ -503,12 +503,10 @@ mod tests { #[test] fn node1_http_host_matches_quic_without_port() { for i in 0..10 { - let http_host = SWQOS_ENDPOINTS_NODE1[i] - .strip_prefix("http://") - .expect("NODE1 HTTP URL"); - let quic_host = SWQOS_ENDPOINTS_NODE1_QUIC[i] - .strip_suffix(":16666") - .expect("NODE1 QUIC endpoint"); + let http_host = + SWQOS_ENDPOINTS_NODE1[i].strip_prefix("http://").expect("NODE1 HTTP URL"); + let quic_host = + SWQOS_ENDPOINTS_NODE1_QUIC[i].strip_suffix(":16666").expect("NODE1 QUIC endpoint"); assert_eq!(http_host, quic_host, "Node1 HTTP vs QUIC host mismatch at index {}", i); } } diff --git a/src/instruction/mod.rs b/src/instruction/mod.rs index 9927971..ef15ba5 100755 --- a/src/instruction/mod.rs +++ b/src/instruction/mod.rs @@ -1,9 +1,9 @@ pub mod bonk; pub mod meteora_damm_v2; -pub(crate) mod pumpfun_ix_data; -pub(crate) mod pumpswap_ix_data; pub mod pumpfun; +pub(crate) mod pumpfun_ix_data; pub mod pumpswap; +pub(crate) mod pumpswap_ix_data; pub mod raydium_amm_v4; pub mod raydium_cpmm; pub mod utils; diff --git a/src/instruction/pumpfun.rs b/src/instruction/pumpfun.rs index 94f52b0..237fa5d 100644 --- a/src/instruction/pumpfun.rs +++ b/src/instruction/pumpfun.rs @@ -1,9 +1,8 @@ //! Pump.fun bonding-curve swap ix assembly ([`SwapParams`](crate::trading::core::params::SwapParams)). //! //! Runtime flag: set `SwapParams.use_pumpfun_v2 = true` to use `buy_v2` / `sell_v2` / -//! `buy_exact_quote_in_v2` (27-account metas, quote_mint support). -//! Default (`false`) uses V1 instructions (18-account metas, legacy SOL-paired). -//! PumpFun V2 is NOT live on mainnet yet — keep `false` until officially deployed. +//! `buy_exact_quote_in_v2` (27/26-account unified metas, quote_mint support). +//! Default (`false`) keeps the smaller legacy SOL-paired instruction layout for latency. use crate::{ common::spl_token::close_account, @@ -15,11 +14,9 @@ use crate::{ }; use crate::{ instruction::utils::pumpfun::{ - accounts, get_bonding_curve_pda, - get_user_volume_accumulator_pda, - pump_fun_fee_recipient_meta, - resolve_creator_vault_for_ix_with_fee_sharing, + accounts, get_bonding_curve_pda, get_user_volume_accumulator_pda, global_constants::{self}, + pump_fun_fee_recipient_meta, resolve_creator_vault_for_ix_with_fee_sharing, }, utils::calc::{ common::{calculate_with_slippage_buy, calculate_with_slippage_sell}, @@ -31,7 +28,10 @@ use solana_sdk::instruction::AccountMeta; use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signer::Signer}; #[inline] -fn effective_pump_mint_token_program(protocol_params: &PumpFunParams) -> Pubkey { +fn effective_pump_mint_token_program(mint: &Pubkey, protocol_params: &PumpFunParams) -> Pubkey { + if mint.to_string().ends_with("pump") { + return TOKEN_PROGRAM_2022; + } let tp = protocol_params.token_program; if tp == Pubkey::default() { TOKEN_PROGRAM_2022 @@ -106,12 +106,7 @@ fn build_buy_v1(params: &SwapParams) -> Result> { ¶ms.output_mint, protocol_params.fee_sharing_creator_vault_if_active, ) - .ok_or_else(|| { - anyhow!( - "creator_vault PDA derivation failed (creator={})", - creator - ) - })?; + .ok_or_else(|| anyhow!("creator_vault PDA derivation failed (creator={})", creator))?; let buy_token_amount = match params.fixed_output_amount { Some(amount) => amount, @@ -131,7 +126,7 @@ fn build_buy_v1(params: &SwapParams) -> Result> { })?; let is_mayhem_mode = bonding_curve.is_mayhem_mode; - let token_program = effective_pump_mint_token_program(protocol_params); + let token_program = effective_pump_mint_token_program(¶ms.output_mint, protocol_params); let token_program_meta = if token_program == TOKEN_PROGRAM_2022 { crate::constants::TOKEN_PROGRAM_2022_META } else { @@ -174,11 +169,7 @@ fn build_buy_v1(params: &SwapParams) -> Result> { let track_volume_val = if bonding_curve.is_cashback_coin { 1u8 } else { 0u8 }; let buy_data = if params.use_exact_sol_amount.unwrap_or(true) { let min_tokens_out = calculate_with_slippage_sell(buy_token_amount, slippage_bp); - encode_pumpfun_buy_exact_sol_in_ix_data( - lamports_in, - min_tokens_out, - track_volume_val, - ) + encode_pumpfun_buy_exact_sol_in_ix_data(lamports_in, min_tokens_out, track_volume_val) } else { encode_pumpfun_buy_ix_data(buy_token_amount, max_sol_cost, track_volume_val) }; @@ -208,16 +199,9 @@ fn build_buy_v1(params: &SwapParams) -> Result> { accounts::FEE_PROGRAM_META, ]; metas.push(AccountMeta::new_readonly(bonding_curve_v2, false)); - metas.push(AccountMeta::new( - get_protocol_extra_fee_recipient_random(), - false, - )); + metas.push(AccountMeta::new(get_protocol_extra_fee_recipient_random(), false)); - instructions.push(Instruction::new_with_bytes( - accounts::PUMPFUN, - &buy_data, - metas, - )); + instructions.push(Instruction::new_with_bytes(accounts::PUMPFUN, &buy_data, metas)); Ok(instructions) } @@ -262,10 +246,7 @@ fn build_sell_v1(params: &SwapParams) -> Result> { protocol_params.fee_sharing_creator_vault_if_active, ) .ok_or_else(|| { - anyhow!( - "creator_vault PDA derivation failed (curve_creator={})", - bonding_curve.creator - ) + anyhow!("creator_vault PDA derivation failed (curve_creator={})", bonding_curve.creator) })? }; @@ -288,7 +269,7 @@ fn build_sell_v1(params: &SwapParams) -> Result> { })?; let is_mayhem_mode = bonding_curve.is_mayhem_mode; - let token_program = effective_pump_mint_token_program(protocol_params); + let token_program = effective_pump_mint_token_program(¶ms.input_mint, protocol_params); let token_program_meta = if token_program == TOKEN_PROGRAM_2022 { crate::constants::TOKEN_PROGRAM_2022_META } else { @@ -344,19 +325,11 @@ fn build_sell_v1(params: &SwapParams) -> Result> { } metas.push(AccountMeta::new_readonly(bonding_curve_v2, false)); - metas.push(AccountMeta::new( - get_protocol_extra_fee_recipient_random(), - false, - )); + metas.push(AccountMeta::new(get_protocol_extra_fee_recipient_random(), false)); - instructions.push(Instruction::new_with_bytes( - accounts::PUMPFUN, - &sell_data, - metas, - )); + instructions.push(Instruction::new_with_bytes(accounts::PUMPFUN, &sell_data, metas)); - if protocol_params.close_token_account_when_sell.unwrap_or(false) - || params.close_input_mint_ata + if protocol_params.close_token_account_when_sell.unwrap_or(false) || params.close_input_mint_ata { instructions.push(close_account( &token_program, @@ -403,12 +376,7 @@ fn build_buy_v2(params: &SwapParams) -> Result> { ¶ms.output_mint, protocol_params.fee_sharing_creator_vault_if_active, ) - .ok_or_else(|| { - anyhow!( - "creator_vault PDA derivation failed (creator={})", - creator - ) - })?; + .ok_or_else(|| anyhow!("creator_vault PDA derivation failed (creator={})", creator))?; let buy_token_amount = match params.fixed_output_amount { Some(amount) => amount, @@ -428,7 +396,8 @@ fn build_buy_v2(params: &SwapParams) -> Result> { })?; let is_mayhem_mode = bonding_curve.is_mayhem_mode; - let base_token_program = effective_pump_mint_token_program(protocol_params); + let base_token_program = + effective_pump_mint_token_program(¶ms.output_mint, protocol_params); let base_token_program_meta = if base_token_program == TOKEN_PROGRAM_2022 { crate::constants::TOKEN_PROGRAM_2022_META } else { @@ -490,10 +459,9 @@ fn build_buy_v2(params: &SwapParams) -> Result> { "e_token_program, ); - let sharing_config = - get_fee_sharing_config_pda(¶ms.output_mint).ok_or_else(|| { - anyhow!("sharing_config PDA derivation failed for mint {}", params.output_mint) - })?; + let sharing_config = get_fee_sharing_config_pda(¶ms.output_mint).ok_or_else(|| { + anyhow!("sharing_config PDA derivation failed for mint {}", params.output_mint) + })?; let user_volume_accumulator = get_user_volume_accumulator_pda(¶ms.payer.pubkey()) .ok_or_else(|| anyhow!("user_volume_accumulator PDA derivation failed"))?; @@ -567,11 +535,7 @@ fn build_buy_v2(params: &SwapParams) -> Result> { accounts::PUMPFUN_META, ]; - instructions.push(Instruction::new_with_bytes( - accounts::PUMPFUN, - &buy_data, - metas, - )); + instructions.push(Instruction::new_with_bytes(accounts::PUMPFUN, &buy_data, metas)); Ok(instructions) } @@ -616,10 +580,7 @@ fn build_sell_v2(params: &SwapParams) -> Result> { protocol_params.fee_sharing_creator_vault_if_active, ) .ok_or_else(|| { - anyhow!( - "creator_vault PDA derivation failed (curve_creator={})", - bonding_curve.creator - ) + anyhow!("creator_vault PDA derivation failed (curve_creator={})", bonding_curve.creator) })? }; @@ -642,7 +603,7 @@ fn build_sell_v2(params: &SwapParams) -> Result> { })?; let is_mayhem_mode = bonding_curve.is_mayhem_mode; - let base_token_program = effective_pump_mint_token_program(protocol_params); + let base_token_program = effective_pump_mint_token_program(¶ms.input_mint, protocol_params); let base_token_program_meta = if base_token_program == TOKEN_PROGRAM_2022 { crate::constants::TOKEN_PROGRAM_2022_META } else { @@ -762,14 +723,9 @@ fn build_sell_v2(params: &SwapParams) -> Result> { accounts::PUMPFUN_META, ]; - instructions.push(Instruction::new_with_bytes( - accounts::PUMPFUN, - &sell_data, - metas, - )); + instructions.push(Instruction::new_with_bytes(accounts::PUMPFUN, &sell_data, metas)); - if protocol_params.close_token_account_when_sell.unwrap_or(false) - || params.close_input_mint_ata + if protocol_params.close_token_account_when_sell.unwrap_or(false) || params.close_input_mint_ata { instructions.push(close_account( &base_token_program, @@ -796,18 +752,90 @@ pub fn claim_cashback_pumpfun_instruction(payer: &Pubkey) -> Option AccountMeta::new(user_volume_accumulator, false), crate::constants::SYSTEM_PROGRAM_META, ]; - let ix = Instruction::new_with_bytes( - accounts::PUMPFUN, - &CLAIM_CASHBACK_DISCRIMINATOR, - ix_accounts, - ); + let ix = + Instruction::new_with_bytes(accounts::PUMPFUN, &CLAIM_CASHBACK_DISCRIMINATOR, ix_accounts); Some(ix) } #[cfg(test)] mod tests { use super::*; - use crate::{instruction::pumpfun_ix_data, trading::core::params::PumpFunParams}; + use crate::{ + common::{bonding_curve::BondingCurveAccount, GasFeeStrategy}, + constants::TOKEN_PROGRAM, + trading::core::params::{DexParamEnum, PumpFunParams, SwapParams}, + }; + use solana_sdk::signature::Keypair; + use std::sync::Arc; + + fn pump_mint() -> Pubkey { + "E3JvmGcGFDzhu2Cnxyeq5BRvN7HH9JZUsfAUh2v8pump".parse().unwrap() + } + + fn swap_params_for_buy(mint: Pubkey, token_program: Pubkey) -> SwapParams { + let bonding_curve = + crate::instruction::utils::pumpfun::get_bonding_curve_pda(&mint).unwrap(); + let creator = Pubkey::new_unique(); + let creator_vault = + crate::instruction::utils::pumpfun::get_creator_vault_pda(&creator).unwrap(); + let bc = BondingCurveAccount { + account: bonding_curve, + virtual_token_reserves: global_constants::INITIAL_VIRTUAL_TOKEN_RESERVES, + virtual_sol_reserves: global_constants::INITIAL_VIRTUAL_SOL_RESERVES, + real_token_reserves: global_constants::INITIAL_REAL_TOKEN_RESERVES, + creator, + ..Default::default() + }; + let params = PumpFunParams { + bonding_curve: Arc::new(bc), + associated_bonding_curve: Pubkey::default(), + observed_trade_creator: Some(creator), + creator_vault, + fee_sharing_creator_vault_if_active: None, + token_program, + close_token_account_when_sell: None, + fee_recipient: global_constants::FEE_RECIPIENT, + quote_mint: Pubkey::default(), + use_v2_ix: false, + }; + + SwapParams { + rpc: None, + payer: Arc::new(Keypair::new()), + trade_type: crate::swqos::TradeType::Buy, + input_mint: crate::constants::SOL_TOKEN_ACCOUNT, + input_token_program: None, + output_mint: mint, + output_token_program: None, + input_amount: Some(10_000_000), + slippage_basis_points: Some(300), + address_lookup_table_account: None, + recent_blockhash: None, + wait_tx_confirmed: false, + protocol_params: DexParamEnum::PumpFun(params), + open_seed_optimize: true, + swqos_clients: Arc::new(Vec::new()), + middleware_manager: None, + durable_nonce: None, + with_tip: true, + create_input_mint_ata: false, + close_input_mint_ata: false, + create_output_mint_ata: true, + close_output_mint_ata: false, + fixed_output_amount: None, + gas_fee_strategy: GasFeeStrategy::new(), + simulate: false, + log_enabled: false, + use_dedicated_sender_threads: false, + sender_thread_cores: None, + max_sender_concurrency: 0, + effective_core_ids: Arc::new(Vec::new()), + check_min_tip: false, + grpc_recv_us: None, + use_exact_sol_amount: Some(true), + use_pumpfun_v2: false, + } + } #[test] fn test_claim_cashback_instruction() { @@ -816,4 +844,16 @@ mod tests { assert_eq!(ix.accounts.len(), 3); assert_eq!(ix.accounts[0].pubkey, payer); } + + #[test] + fn pump_suffix_buy_forces_token_2022_even_with_legacy_cached_program() { + crate::common::seed::set_default_rents(); + let params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM); + let instructions = build_buy_v1(¶ms).unwrap(); + + assert_eq!(instructions.len(), 3); + assert_eq!(instructions[1].program_id, TOKEN_PROGRAM_2022); + assert_eq!(instructions[2].accounts[8].pubkey, TOKEN_PROGRAM_2022); + assert_eq!(instructions[2].accounts.len(), 18); + } } diff --git a/src/instruction/utils/pumpfun.rs b/src/instruction/utils/pumpfun.rs index a917e85..6ced69f 100644 --- a/src/instruction/utils/pumpfun.rs +++ b/src/instruction/utils/pumpfun.rs @@ -12,173 +12,166 @@ use solana_sdk::{ }; use std::sync::Arc; - // --- seeds ------------------------------------------------------------- pub mod seeds { -/// Seed for bonding curve PDAs (`["bonding-curve", mint]`). -pub const BONDING_CURVE_SEED: &[u8] = b"bonding-curve"; -/// Seed for bonding curve v2 PDA (`["bonding-curve-v2", mint]`). -pub const BONDING_CURVE_V2_SEED: &[u8] = b"bonding-curve-v2"; -/// Creator vault PDA seeds prefix (`["creator-vault", authority]`). -pub const CREATOR_VAULT_SEED: &[u8] = b"creator-vault"; -/// Metadata PDA seeds prefix. -pub const METADATA_SEED: &[u8] = b"metadata"; -/// User volume accumulator for cashback / bonding-curve UX. -pub const USER_VOLUME_ACCUMULATOR_SEED: &[u8] = b"user_volume_accumulator"; -/// Global volume accumulator. -pub const GLOBAL_VOLUME_ACCUMULATOR_SEED: &[u8] = b"global_volume_accumulator"; -pub const FEE_CONFIG_SEED: &[u8] = b"fee_config"; -/// `feeSharingConfig` PDA under pump-fees (`feeSharingConfigPda`). -pub const SHARING_CONFIG_SEED: &[u8] = b"sharing-config"; + /// Seed for bonding curve PDAs (`["bonding-curve", mint]`). + pub const BONDING_CURVE_SEED: &[u8] = b"bonding-curve"; + /// Seed for bonding curve v2 PDA (`["bonding-curve-v2", mint]`). + pub const BONDING_CURVE_V2_SEED: &[u8] = b"bonding-curve-v2"; + /// Creator vault PDA seeds prefix (`["creator-vault", authority]`). + pub const CREATOR_VAULT_SEED: &[u8] = b"creator-vault"; + /// Metadata PDA seeds prefix. + pub const METADATA_SEED: &[u8] = b"metadata"; + /// User volume accumulator for cashback / bonding-curve UX. + pub const USER_VOLUME_ACCUMULATOR_SEED: &[u8] = b"user_volume_accumulator"; + /// Global volume accumulator. + pub const GLOBAL_VOLUME_ACCUMULATOR_SEED: &[u8] = b"global_volume_accumulator"; + pub const FEE_CONFIG_SEED: &[u8] = b"fee_config"; + /// `feeSharingConfig` PDA under pump-fees (`feeSharingConfigPda`). + pub const SHARING_CONFIG_SEED: &[u8] = b"sharing-config"; } - pub mod global_constants { + use solana_sdk::{pubkey, pubkey::Pubkey}; -use solana_sdk::{pubkey, pubkey::Pubkey}; + pub const INITIAL_VIRTUAL_TOKEN_RESERVES: u64 = 1_073_000_000_000_000; + pub const INITIAL_VIRTUAL_SOL_RESERVES: u64 = 30_000_000_000; + pub const INITIAL_REAL_TOKEN_RESERVES: u64 = 793_100_000_000_000; + pub const TOKEN_TOTAL_SUPPLY: u64 = 1_000_000_000_000_000; + pub const FEE_BASIS_POINTS: u64 = 95; + pub const ENABLE_MIGRATE: bool = false; + pub const POOL_MIGRATION_FEE: u64 = 15_000_001; + pub const CREATOR_FEE: u64 = 30; + pub const SCALE: u64 = 1_000_000; + pub const LAMPORTS_PER_SOL: u64 = 1_000_000_000; + pub const COMPLETION_LAMPORTS: u64 = 85 * LAMPORTS_PER_SOL; -pub const INITIAL_VIRTUAL_TOKEN_RESERVES: u64 = 1_073_000_000_000_000; -pub const INITIAL_VIRTUAL_SOL_RESERVES: u64 = 30_000_000_000; -pub const INITIAL_REAL_TOKEN_RESERVES: u64 = 793_100_000_000_000; -pub const TOKEN_TOTAL_SUPPLY: u64 = 1_000_000_000_000_000; -pub const FEE_BASIS_POINTS: u64 = 95; -pub const ENABLE_MIGRATE: bool = false; -pub const POOL_MIGRATION_FEE: u64 = 15_000_001; -pub const CREATOR_FEE: u64 = 30; -pub const SCALE: u64 = 1_000_000; -pub const LAMPORTS_PER_SOL: u64 = 1_000_000_000; -pub const COMPLETION_LAMPORTS: u64 = 85 * LAMPORTS_PER_SOL; + pub const FEE_RECIPIENT: Pubkey = pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV"); + pub const FEE_RECIPIENT_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: FEE_RECIPIENT, + is_signer: false, + is_writable: true, + }; -pub const FEE_RECIPIENT: Pubkey = pubkey!("62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV"); -pub const FEE_RECIPIENT_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: FEE_RECIPIENT, - is_signer: false, - is_writable: true, - }; + pub const MAYHEM_FEE_RECIPIENTS: [Pubkey; 8] = [ + pubkey!("GesfTA3X2arioaHp8bbKdjG9vJtskViWACZoYvxp4twS"), + pubkey!("4budycTjhs9fD6xw62VBducVTNgMgJJ5BgtKq7mAZwn6"), + pubkey!("8SBKzEQU4nLSzcwF4a74F2iaUDQyTfjGndn6qUWBnrpR"), + pubkey!("4UQeTP1T39KZ9Sfxzo3WR5skgsaP6NZa87BAkuazLEKH"), + pubkey!("8sNeir4QsLsJdYpc9RZacohhK1Y5FLU3nC5LXgYB4aa6"), + pubkey!("Fh9HmeLNUMVCvejxCtCL2DbYaRyBFVJ5xrWkLnMH6fdk"), + pubkey!("463MEnMeGyJekNZFQSTUABBEbLnvMTALbT6ZmsxAbAdq"), + pubkey!("6AUH3WEHucYZyC61hqpqYUWVto5qA5hjHuNQ32GNnNxA"), + ]; + pub const MAYHEM_FEE_RECIPIENT: Pubkey = MAYHEM_FEE_RECIPIENTS[0]; + pub const MAYHEM_FEE_RECIPIENT_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: MAYHEM_FEE_RECIPIENT, + is_signer: false, + is_writable: true, + }; -pub const MAYHEM_FEE_RECIPIENTS: [Pubkey; 8] = [ - pubkey!("GesfTA3X2arioaHp8bbKdjG9vJtskViWACZoYvxp4twS"), - pubkey!("4budycTjhs9fD6xw62VBducVTNgMgJJ5BgtKq7mAZwn6"), - pubkey!("8SBKzEQU4nLSzcwF4a74F2iaUDQyTfjGndn6qUWBnrpR"), - pubkey!("4UQeTP1T39KZ9Sfxzo3WR5skgsaP6NZa87BAkuazLEKH"), - pubkey!("8sNeir4QsLsJdYpc9RZacohhK1Y5FLU3nC5LXgYB4aa6"), - pubkey!("Fh9HmeLNUMVCvejxCtCL2DbYaRyBFVJ5xrWkLnMH6fdk"), - pubkey!("463MEnMeGyJekNZFQSTUABBEbLnvMTALbT6ZmsxAbAdq"), - pubkey!("6AUH3WEHucYZyC61hqpqYUWVto5qA5hjHuNQ32GNnNxA"), -]; -pub const MAYHEM_FEE_RECIPIENT: Pubkey = MAYHEM_FEE_RECIPIENTS[0]; -pub const MAYHEM_FEE_RECIPIENT_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: MAYHEM_FEE_RECIPIENT, - is_signer: false, - is_writable: true, - }; + pub const GLOBAL_ACCOUNT: Pubkey = pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"); + pub const GLOBAL_ACCOUNT_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: GLOBAL_ACCOUNT, + is_signer: false, + is_writable: false, + }; -pub const GLOBAL_ACCOUNT: Pubkey = pubkey!("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"); -pub const GLOBAL_ACCOUNT_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: GLOBAL_ACCOUNT, - is_signer: false, - is_writable: false, - }; + pub const AUTHORITY: Pubkey = pubkey!("FFWtrEQ4B4PKQoVuHYzZq8FabGkVatYzDpEVHsK5rrhF"); + pub const WITHDRAW_AUTHORITY: Pubkey = pubkey!("39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg"); -pub const AUTHORITY: Pubkey = pubkey!("FFWtrEQ4B4PKQoVuHYzZq8FabGkVatYzDpEVHsK5rrhF"); -pub const WITHDRAW_AUTHORITY: Pubkey = pubkey!("39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg"); + pub const PUMPFUN_AMM_FEE_1: Pubkey = pubkey!("7VtfL8fvgNfhz17qKRMjzQEXgbdpnHHHQRh54R9jP2RJ"); + pub const PUMPFUN_AMM_FEE_2: Pubkey = pubkey!("7hTckgnGnLQR6sdH7YkqFTAA7VwTfYFaZ6EhEsU3saCX"); + pub const PUMPFUN_AMM_FEE_3: Pubkey = pubkey!("9rPYyANsfQZw3DnDmKE3YCQF5E8oD89UXoHn9JFEhJUz"); + pub const PUMPFUN_AMM_FEE_4: Pubkey = pubkey!("AVmoTthdrX6tKt4nDjco2D775W2YK3sDhxPcMmzUAmTY"); + pub const PUMPFUN_AMM_FEE_5: Pubkey = pubkey!("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"); + pub const PUMPFUN_AMM_FEE_6: Pubkey = pubkey!("FWsW1xNtWscwNmKv6wVsU1iTzRN6wmmk3MjxRP5tT7hz"); + pub const PUMPFUN_AMM_FEE_7: Pubkey = pubkey!("G5UZAVbAf46s7cKWoyKu8kYTip9DGTpbLZ2qa9Aq69dP"); -pub const PUMPFUN_AMM_FEE_1: Pubkey = pubkey!("7VtfL8fvgNfhz17qKRMjzQEXgbdpnHHHQRh54R9jP2RJ"); -pub const PUMPFUN_AMM_FEE_2: Pubkey = pubkey!("7hTckgnGnLQR6sdH7YkqFTAA7VwTfYFaZ6EhEsU3saCX"); -pub const PUMPFUN_AMM_FEE_3: Pubkey = pubkey!("9rPYyANsfQZw3DnDmKE3YCQF5E8oD89UXoHn9JFEhJUz"); -pub const PUMPFUN_AMM_FEE_4: Pubkey = pubkey!("AVmoTthdrX6tKt4nDjco2D775W2YK3sDhxPcMmzUAmTY"); -pub const PUMPFUN_AMM_FEE_5: Pubkey = pubkey!("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"); -pub const PUMPFUN_AMM_FEE_6: Pubkey = pubkey!("FWsW1xNtWscwNmKv6wVsU1iTzRN6wmmk3MjxRP5tT7hz"); -pub const PUMPFUN_AMM_FEE_7: Pubkey = pubkey!("G5UZAVbAf46s7cKWoyKu8kYTip9DGTpbLZ2qa9Aq69dP"); + pub const PROTOCOL_EXTRA_FEE_RECIPIENTS: [Pubkey; 8] = [ + pubkey!("5YxQFdt3Tr9zJLvkFccqXVUwhdTWJQc1fFg2YPbxvxeD"), + pubkey!("9M4giFFMxmFGXtc3feFzRai56WbBqehoSeRE5GK7gf7"), + pubkey!("GXPFM2caqTtQYC2cJ5yJRi9VDkpsYZXzYdwYpGnLmtDL"), + pubkey!("3BpXnfJaUTiwXnJNe7Ej1rcbzqTTQUvLShZaWazebsVR"), + pubkey!("5cjcW9wExnJJiqgLjq7DEG75Pm6JBgE1hNv4B2vHXUW6"), + pubkey!("EHAAiTxcdDwQ3U4bU6YcMsQGaekdzLS3B5SmYo46kJtL"), + pubkey!("5eHhjP8JaYkz83CWwvGU2uMUXefd3AazWGx4gpcuEEYD"), + pubkey!("A7hAgCzFw14fejgCp387JUJRMNyz4j89JKnhtKU8piqW"), + ]; -pub const PROTOCOL_EXTRA_FEE_RECIPIENTS: [Pubkey; 8] = [ - pubkey!("5YxQFdt3Tr9zJLvkFccqXVUwhdTWJQc1fFg2YPbxvxeD"), - pubkey!("9M4giFFMxmFGXtc3feFzRai56WbBqehoSeRE5GK7gf7"), - pubkey!("GXPFM2caqTtQYC2cJ5yJRi9VDkpsYZXzYdwYpGnLmtDL"), - pubkey!("3BpXnfJaUTiwXnJNe7Ej1rcbzqTTQUvLShZaWazebsVR"), - pubkey!("5cjcW9wExnJJiqgLjq7DEG75Pm6JBgE1hNv4B2vHXUW6"), - pubkey!("EHAAiTxcdDwQ3U4bU6YcMsQGaekdzLS3B5SmYo46kJtL"), - pubkey!("5eHhjP8JaYkz83CWwvGU2uMUXefd3AazWGx4gpcuEEYD"), - pubkey!("A7hAgCzFw14fejgCp387JUJRMNyz4j89JKnhtKU8piqW"), -]; - -/// Buyback fee recipients (v2 account #9 in buy_v2/sell_v2). -/// 对应官方 FEE_RECIPIENTS.md "Buyback (Applies to All)" 池,与主 fee_recipient 池互斥。 -pub const BUYBACK_FEE_RECIPIENTS: [Pubkey; 8] = [ - pubkey!("5YxQFdt3Tr9zJLvkFccqXVUwhdTWJQc1fFg2YPbxvxeD"), - pubkey!("9M4giFFMxmFGXtc3feFzRai56WbBqehoSeRE5GK7gf7"), - pubkey!("GXPFM2caqTtQYC2cJ5yJRi9VDkpsYZXzYdwYpGnLmtDL"), - pubkey!("3BpXnfJaUTiwXnJNe7Ej1rcbzqTTQUvLShZaWazebsVR"), - pubkey!("5cjcW9wExnJJiqgLjq7DEG75Pm6JBgE1hNv4B2vHXUW6"), - pubkey!("EHAAiTxcdDwQ3U4bU6YcMsQGaekdzLS3B5SmYo46kJtL"), - pubkey!("5eHhjP8JaYkz83CWwvGU2uMUXefd3AazWGx4gpcuEEYD"), - pubkey!("A7hAgCzFw14fejgCp387JUJRMNyz4j89JKnhtKU8piqW"), -]; + /// Buyback fee recipients (v2 account #9 in buy_v2/sell_v2). + /// 对应官方 FEE_RECIPIENTS.md "Buyback (Applies to All)" 池,与主 fee_recipient 池互斥。 + pub const BUYBACK_FEE_RECIPIENTS: [Pubkey; 8] = [ + pubkey!("5YxQFdt3Tr9zJLvkFccqXVUwhdTWJQc1fFg2YPbxvxeD"), + pubkey!("9M4giFFMxmFGXtc3feFzRai56WbBqehoSeRE5GK7gf7"), + pubkey!("GXPFM2caqTtQYC2cJ5yJRi9VDkpsYZXzYdwYpGnLmtDL"), + pubkey!("3BpXnfJaUTiwXnJNe7Ej1rcbzqTTQUvLShZaWazebsVR"), + pubkey!("5cjcW9wExnJJiqgLjq7DEG75Pm6JBgE1hNv4B2vHXUW6"), + pubkey!("EHAAiTxcdDwQ3U4bU6YcMsQGaekdzLS3B5SmYo46kJtL"), + pubkey!("5eHhjP8JaYkz83CWwvGU2uMUXefd3AazWGx4gpcuEEYD"), + pubkey!("A7hAgCzFw14fejgCp387JUJRMNyz4j89JKnhtKU8piqW"), + ]; } - pub mod accounts { + use solana_sdk::{pubkey, pubkey::Pubkey}; -use solana_sdk::{pubkey, pubkey::Pubkey}; + pub const PUMPFUN: Pubkey = pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"); + pub const MPL_TOKEN_METADATA: Pubkey = pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"); + pub const EVENT_AUTHORITY: Pubkey = pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"); + pub const ASSOCIATED_TOKEN_PROGRAM: Pubkey = + pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"); + pub const AMM_PROGRAM: Pubkey = pubkey!("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"); + pub const FEE_PROGRAM: Pubkey = pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"); + pub const GLOBAL_VOLUME_ACCUMULATOR: Pubkey = + pubkey!("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y"); + pub const FEE_CONFIG: Pubkey = pubkey!("8Wf5TiAheLUqBrKXeYg2JtAFFMWtKdG2BSFgqUcPVwTt"); -pub const PUMPFUN: Pubkey = pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"); -pub const MPL_TOKEN_METADATA: Pubkey = pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"); -pub const EVENT_AUTHORITY: Pubkey = pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"); -pub const ASSOCIATED_TOKEN_PROGRAM: Pubkey = - pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"); -pub const AMM_PROGRAM: Pubkey = pubkey!("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"); -pub const FEE_PROGRAM: Pubkey = pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"); -pub const GLOBAL_VOLUME_ACCUMULATOR: Pubkey = - pubkey!("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y"); -pub const FEE_CONFIG: Pubkey = pubkey!("8Wf5TiAheLUqBrKXeYg2JtAFFMWtKdG2BSFgqUcPVwTt"); + pub const PUMPFUN_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: PUMPFUN, + is_signer: false, + is_writable: false, + }; -pub const PUMPFUN_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: PUMPFUN, - is_signer: false, - is_writable: false, - }; + pub const EVENT_AUTHORITY_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: EVENT_AUTHORITY, + is_signer: false, + is_writable: false, + }; -pub const EVENT_AUTHORITY_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: EVENT_AUTHORITY, - is_signer: false, - is_writable: false, - }; + pub const FEE_PROGRAM_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: FEE_PROGRAM, + is_signer: false, + is_writable: false, + }; -pub const FEE_PROGRAM_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: FEE_PROGRAM, - is_signer: false, - is_writable: false, - }; + pub const GLOBAL_VOLUME_ACCUMULATOR_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: GLOBAL_VOLUME_ACCUMULATOR, + is_signer: false, + is_writable: true, + }; -pub const GLOBAL_VOLUME_ACCUMULATOR_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: GLOBAL_VOLUME_ACCUMULATOR, - is_signer: false, - is_writable: true, - }; - -pub const FEE_CONFIG_META: solana_sdk::instruction::AccountMeta = - solana_sdk::instruction::AccountMeta { - pubkey: FEE_CONFIG, - is_signer: false, - is_writable: false, - }; + pub const FEE_CONFIG_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: FEE_CONFIG, + is_signer: false, + is_writable: false, + }; } - // --- Anchor / layout constants --------------------------------------- - /// Minimum bonding curve account data length (`sdk.ts` `BONDING_CURVE_NEW_SIZE`). pub const PUMP_BONDING_CURVE_MIN_DATA_LEN: usize = 151; @@ -199,7 +192,6 @@ pub const SHARING_CONFIG_ACCOUNT_DISCRIMINATOR: [u8; 8] = [216, 74, 9, 0, 56, 14 pub(crate) const SHARING_CONFIG_STATUS_ACTIVE: u8 = 1; - // --- Fee recipient pools ----------------------------------------------- #[inline] @@ -263,11 +255,7 @@ pub fn get_mayhem_fee_recipient_meta_random() -> AccountMeta { let recipient = *global_constants::MAYHEM_FEE_RECIPIENTS .choose(&mut rand::rng()) .unwrap_or(&global_constants::MAYHEM_FEE_RECIPIENTS[0]); - AccountMeta { - pubkey: recipient, - is_signer: false, - is_writable: true, - } + AccountMeta { pubkey: recipient, is_signer: false, is_writable: true } } #[inline] @@ -282,14 +270,8 @@ pub fn get_standard_fee_recipient_meta_random() -> AccountMeta { global_constants::PUMPFUN_AMM_FEE_6, global_constants::PUMPFUN_AMM_FEE_7, ]; - let recipient = *POOL - .choose(&mut rand::rng()) - .unwrap_or(&global_constants::FEE_RECIPIENT); - AccountMeta { - pubkey: recipient, - is_signer: false, - is_writable: true, - } + let recipient = *POOL.choose(&mut rand::rng()).unwrap_or(&global_constants::FEE_RECIPIENT); + AccountMeta { pubkey: recipient, is_signer: false, is_writable: true } } #[inline] @@ -308,15 +290,14 @@ pub fn get_buyback_fee_recipient_random() -> Pubkey { } #[inline] -pub fn pump_fun_fee_recipient_meta(observed_fee_recipient: Pubkey, is_mayhem_mode: bool) -> AccountMeta { +pub fn pump_fun_fee_recipient_meta( + observed_fee_recipient: Pubkey, + is_mayhem_mode: bool, +) -> AccountMeta { let trust_observation = observed_fee_recipient != Pubkey::default() && fee_recipient_ok_for_bonding_curve_mode(&observed_fee_recipient, is_mayhem_mode); if trust_observation { - AccountMeta { - pubkey: observed_fee_recipient, - is_signer: false, - is_writable: true, - } + AccountMeta { pubkey: observed_fee_recipient, is_signer: false, is_writable: true } } else if is_mayhem_mode { get_mayhem_fee_recipient_meta_random() } else { @@ -344,7 +325,6 @@ pub fn extend_bonding_curve_account_instruction( ) } - // --- Cached PDAs + creator_vault resolve ------------------------------ #[inline] @@ -496,7 +476,6 @@ pub fn get_buy_price( s_u64.min(real_token_reserves) } - // --- RPC ------------------------------------------------------------- #[inline] @@ -522,9 +501,7 @@ pub async fn fetch_fee_sharing_creator_vault_if_active( return Ok(None); } let mint_on_chain = Pubkey::new_from_array( - d[11..43] - .try_into() - .map_err(|_| anyhow!("SharingConfig mint slice"))?, + d[11..43].try_into().map_err(|_| anyhow!("SharingConfig mint slice"))?, ); if mint_on_chain != *mint { return Ok(None); @@ -556,13 +533,10 @@ pub async fn fetch_bonding_curve_account( Ok((Arc::new(bonding_curve), bonding_curve_pda)) } - - #[cfg(test)] mod tests { use super::{ - global_constants, - phantom_default_creator_vault, pump_fun_fee_recipient_meta, + global_constants, phantom_default_creator_vault, pump_fun_fee_recipient_meta, reconcile_mayhem_mode_for_trade, resolve_creator_vault_for_ix, resolve_creator_vault_for_ix_with_fee_sharing, *, }; @@ -650,12 +624,8 @@ mod tests { let sharing_pk = get_fee_sharing_config_pda(&mint).unwrap(); let vs = get_creator_vault_pda(&sharing_pk).unwrap(); assert_ne!(v_derived, vs); - let resolved = resolve_creator_vault_for_ix_with_fee_sharing( - &creator, - v_derived, - &mint, - Some(vs), - ); + let resolved = + resolve_creator_vault_for_ix_with_fee_sharing(&creator, v_derived, &mint, Some(vs)); assert_eq!( resolved, Some(v_derived), @@ -671,8 +641,7 @@ mod tests { let vs = get_creator_vault_pda(&sharing_pk).unwrap(); let creator_vault = get_creator_vault_pda(&creator).unwrap(); assert_ne!(vs, creator_vault); - let resolved = - resolve_creator_vault_for_ix_with_fee_sharing(&creator, vs, &mint, Some(vs)); + let resolved = resolve_creator_vault_for_ix_with_fee_sharing(&creator, vs, &mint, Some(vs)); assert_eq!( resolved, Some(vs), diff --git a/src/swqos/astralane.rs b/src/swqos/astralane.rs index ac080c2..8233c2e 100644 --- a/src/swqos/astralane.rs +++ b/src/swqos/astralane.rs @@ -202,11 +202,20 @@ impl AstralaneClient { let _ = response.bytes().await; if status.is_success() { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submitted("Astralane", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "Astralane", + trade_type, + start_time.elapsed(), + ); } } else { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("Astralane", trade_type, start_time.elapsed(), format!("status {}", status)); + crate::common::sdk_log::log_swqos_submission_failed( + "Astralane", + trade_type, + start_time.elapsed(), + format!("status {}", status), + ); } return Err(anyhow::anyhow!("Astralane sendTransaction failed: {}", status)); } @@ -214,12 +223,21 @@ impl AstralaneClient { AstralaneBackend::Quic(quic) => { if let Err(e) = quic.send_transaction(&body_bytes).await { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("Astralane", trade_type, start_time.elapsed(), &e); + crate::common::sdk_log::log_swqos_submission_failed( + "Astralane", + trade_type, + start_time.elapsed(), + &e, + ); } return Err(e); } if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submitted("Astralane", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "Astralane", + trade_type, + start_time.elapsed(), + ); } } } @@ -230,14 +248,26 @@ impl AstralaneClient { Err(e) => { if crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmation failed: {:?}", "Astralane", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmation failed: {:?}", + "Astralane", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } return Err(e); } } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "Astralane", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "Astralane", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) } diff --git a/src/swqos/astralane_quic.rs b/src/swqos/astralane_quic.rs index 2f7c956..aae2bb4 100644 --- a/src/swqos/astralane_quic.rs +++ b/src/swqos/astralane_quic.rs @@ -77,9 +77,7 @@ impl AstralaneQuicClient { "lit.gateway.astralane.io" => { vec![SocketAddr::new(IpAddr::V4(Ipv4Addr::new(84, 32, 97, 47)), port)] } - _ => { - Vec::new() - } + _ => Vec::new(), } } @@ -132,8 +130,8 @@ impl AstralaneQuicClient { /// Generates a self-signed TLS certificate with the API key as the Common Name (CN). pub async fn connect(server_addr: &str, api_key: &str) -> Result { let _ = rustls::crypto::ring::default_provider().install_default(); - let candidates = Self::resolve_server_candidates(server_addr) - .context("Invalid server address")?; + let candidates = + Self::resolve_server_candidates(server_addr).context("Invalid server address")?; let addr = candidates[0]; info!("[astralane-quic] Building TLS config (CN = api_key)"); @@ -167,7 +165,8 @@ impl AstralaneQuicClient { } } let connection = connection_opt.ok_or_else(|| { - last_err.unwrap_or_else(|| anyhow::anyhow!("Failed to connect to Astralane QUIC server")) + last_err + .unwrap_or_else(|| anyhow::anyhow!("Failed to connect to Astralane QUIC server")) })?; info!("[astralane-quic] Connected at {}", selected_addr); @@ -203,7 +202,8 @@ impl AstralaneQuicClient { } } } - Err(last_err.unwrap_or_else(|| anyhow::anyhow!("Failed to reconnect to Astralane QUIC server"))) + Err(last_err + .unwrap_or_else(|| anyhow::anyhow!("Failed to reconnect to Astralane QUIC server"))) } /// Send a single bincode-serialized `VersionedTransaction`. diff --git a/src/swqos/blockrazor.rs b/src/swqos/blockrazor.rs index a7e4c3b..9db1ad7 100644 --- a/src/swqos/blockrazor.rs +++ b/src/swqos/blockrazor.rs @@ -5,9 +5,9 @@ use rand::seq::IndexedRandom; use reqwest::Client; use std::{sync::Arc, time::Instant}; +use arc_swap::ArcSwap; use solana_transaction_status::UiTransactionEncoding; use std::time::Duration; -use arc_swap::ArcSwap; use crate::swqos::SwqosClientTrait; use crate::swqos::{SwqosType, TradeType}; @@ -18,8 +18,8 @@ use crate::{common::SolanaRpcClient, constants::swqos::BLOCKRAZOR_TIP_ACCOUNTS}; use std::sync::atomic::{AtomicBool, Ordering}; use tokio::task::JoinHandle; -use tonic::transport::Channel; use tonic::metadata::AsciiMetadataValue; +use tonic::transport::Channel; // Include pre-generated gRPC code pub mod serverpb { @@ -46,7 +46,9 @@ impl BlockRazorGrpcClient { let mut request = tonic::Request::new(serverpb::HealthRequest {}); request.metadata_mut().insert("apikey", apikey); - let response = client.get_health(request).await + let response = client + .get_health(request) + .await .map_err(|e| anyhow::anyhow!("gRPC health check failed: {}", e))?; Ok(response.into_inner().status) } @@ -75,7 +77,9 @@ impl BlockRazorGrpcClient { }); request.metadata_mut().insert("apikey", apikey); - let response = client.send_transaction(request).await + let response = client + .send_transaction(request) + .await .map_err(|e| anyhow::anyhow!("gRPC send transaction failed: {}", e))?; Ok(response.into_inner().signature) } @@ -151,7 +155,12 @@ impl BlockRazorClient { Ok(Self::new_http(rpc_url, endpoint, auth_token, false)) } - pub async fn new_grpc(rpc_url: String, endpoint: String, auth_token: String, mev_protection: bool) -> Result { + pub async fn new_grpc( + rpc_url: String, + endpoint: String, + auth_token: String, + mev_protection: bool, + ) -> Result { let rpc_client = SolanaRpcClient::new(rpc_url); // 配置 Channel,增加连接超时 @@ -162,10 +171,8 @@ impl BlockRazorClient { .await .map_err(|e| anyhow::anyhow!("Failed to connect to gRPC endpoint: {}", e))?; - let grpc_client = Arc::new(ArcSwap::from_pointee(BlockRazorGrpcClient::new( - channel, - auth_token.clone(), - ))); + let grpc_client = + Arc::new(ArcSwap::from_pointee(BlockRazorGrpcClient::new(channel, auth_token.clone()))); let ping_handle = Arc::new(tokio::sync::Mutex::new(None)); let stop_ping = Arc::new(AtomicBool::new(false)); @@ -189,7 +196,12 @@ impl BlockRazorClient { Ok(client) } - pub fn new_http(rpc_url: String, endpoint: String, auth_token: String, mev_protection: bool) -> Self { + pub fn new_http( + rpc_url: String, + endpoint: String, + auth_token: String, + mev_protection: bool, + ) -> Self { let rpc_client = SolanaRpcClient::new(rpc_url); let http_client = default_http_client_builder().user_agent("").build().unwrap(); let ping_handle = Arc::new(tokio::sync::Mutex::new(None)); @@ -279,7 +291,10 @@ impl BlockRazorClient { } Err(reconnect_err) => { if crate::common::sdk_log::sdk_log_enabled() { - eprintln!("BlockRazor gRPC reconnect failed: {}", reconnect_err); + eprintln!( + "BlockRazor gRPC reconnect failed: {}", + reconnect_err + ); } } } @@ -309,7 +324,8 @@ impl BlockRazorClient { let stop_ping = stop_ping.clone(); let handle = tokio::spawn(async move { - if let Err(e) = Self::send_http_ping(&http_client, &endpoint, &auth_token).await { + if let Err(e) = Self::send_http_ping(&http_client, &endpoint, &auth_token).await + { if crate::common::sdk_log::sdk_log_enabled() { eprintln!("BlockRazor HTTP ping request failed: {}", e); } @@ -320,7 +336,9 @@ impl BlockRazorClient { if stop_ping.load(Ordering::Relaxed) { break; } - if let Err(e) = Self::send_http_ping(&http_client, &endpoint, &auth_token).await { + if let Err(e) = + Self::send_http_ping(&http_client, &endpoint, &auth_token).await + { if crate::common::sdk_log::sdk_log_enabled() { eprintln!("BlockRazor HTTP ping request failed: {}", e); } @@ -337,11 +355,7 @@ impl BlockRazorClient { } } - async fn send_http_ping( - http_client: &Client, - endpoint: &str, - auth_token: &str, - ) -> Result<()> { + async fn send_http_ping(http_client: &Client, endpoint: &str, auth_token: &str) -> Result<()> { let ping_url = endpoint.replace("/v2/sendTransaction", "/v2/health"); let response = http_client .post(&ping_url) @@ -380,51 +394,68 @@ impl BlockRazorClient { let start_time = Instant::now(); match &self.backend { - BlockRazorBackend::Grpc { - grpc_client, - mev_protection, - .. - } => { + BlockRazorBackend::Grpc { grpc_client, mev_protection, .. } => { let (content, _signature) = serialize_transaction_and_encode(transaction, UiTransactionEncoding::Base64)?; // 使用 load() 无锁获取客户端引用 let client = grpc_client.load(); - let signature = client.send_transaction( - content, - // mev_protection=true: sandwichMitigation mode skips blacklisted Leader slots (MEV protection). - // revert_protection is unrelated to MEV; keep false. - if *mev_protection { "sandwichMitigation".to_string() } else { "fast".to_string() }, - None, - false, - ).await; + let signature = client + .send_transaction( + content, + // mev_protection=true: sandwichMitigation mode skips blacklisted Leader slots (MEV protection). + // revert_protection is unrelated to MEV; keep false. + if *mev_protection { + "sandwichMitigation".to_string() + } else { + "fast".to_string() + }, + None, + false, + ) + .await; match signature { Ok(sig) => { if !sig.is_empty() { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submitted("BlockRazor", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "BlockRazor", + trade_type, + start_time.elapsed(), + ); } } else { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("BlockRazor", trade_type, start_time.elapsed(), "empty signature".to_string()); + crate::common::sdk_log::log_swqos_submission_failed( + "BlockRazor", + trade_type, + start_time.elapsed(), + "empty signature".to_string(), + ); } - return Err(anyhow::anyhow!("BlockRazor gRPC returned empty signature")); + return Err(anyhow::anyhow!( + "BlockRazor gRPC returned empty signature" + )); } } Err(e) => { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("BlockRazor", trade_type, start_time.elapsed(), format!("gRPC error: {}", e)); + crate::common::sdk_log::log_swqos_submission_failed( + "BlockRazor", + trade_type, + start_time.elapsed(), + format!("gRPC error: {}", e), + ); } - return Err(anyhow::anyhow!("BlockRazor gRPC sendTransaction failed: {}", e)); + return Err(anyhow::anyhow!( + "BlockRazor gRPC sendTransaction failed: {}", + e + )); } } } BlockRazorBackend::Http { - endpoint, - auth_token, - http_client, - mev_protection, - .. + endpoint, auth_token, http_client, mev_protection, .. } => { let (content, _signature) = serialize_transaction_and_encode(transaction, UiTransactionEncoding::Base64)?; @@ -448,12 +479,21 @@ impl BlockRazorClient { if status.is_success() { let _ = response.bytes().await; if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submitted("blockrazor", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "blockrazor", + trade_type, + start_time.elapsed(), + ); } } else { let body = response.text().await.unwrap_or_default(); if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("blockrazor", trade_type, start_time.elapsed(), format!("status {} body: {}", status, body)); + crate::common::sdk_log::log_swqos_submission_failed( + "blockrazor", + trade_type, + start_time.elapsed(), + format!("status {} body: {}", status, body), + ); } return Err(anyhow::anyhow!( "BlockRazor HTTP sendTransaction failed: status {} body: {}", @@ -485,7 +525,13 @@ impl BlockRazorClient { } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "blockrazor", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "blockrazor", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) @@ -495,7 +541,8 @@ impl BlockRazorClient { impl Drop for BlockRazorClient { fn drop(&mut self) { match &self.backend { - BlockRazorBackend::Grpc { stop_ping, ping_handle, .. } | BlockRazorBackend::Http { stop_ping, ping_handle, .. } => { + BlockRazorBackend::Grpc { stop_ping, ping_handle, .. } + | BlockRazorBackend::Http { stop_ping, ping_handle, .. } => { stop_ping.store(true, Ordering::Relaxed); let ping_handle = ping_handle.clone(); diff --git a/src/swqos/bloxroute.rs b/src/swqos/bloxroute.rs index 44ffa38..721e5ba 100755 --- a/src/swqos/bloxroute.rs +++ b/src/swqos/bloxroute.rs @@ -100,13 +100,27 @@ impl BloxrouteClient { if let Ok(response_json) = serde_json::from_str::(&response_text) { if crate::common::sdk_log::sdk_log_enabled() { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("bloxroute", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "bloxroute", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - eprintln!(" [bloxroute] {} submission failed after {:?}: {:?}", trade_type, start_time.elapsed(), _error); + eprintln!( + " [bloxroute] {} submission failed after {:?}: {:?}", + trade_type, + start_time.elapsed(), + _error + ); } } } else if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("bloxroute", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "bloxroute", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -128,7 +142,13 @@ impl BloxrouteClient { } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "bloxroute", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "bloxroute", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) @@ -170,7 +190,12 @@ impl BloxrouteClient { if response_json.get("result").is_some() { println!(" bloxroute {} submitted: {:?}", trade_type, start_time.elapsed()); } else if let Some(_error) = response_json.get("error") { - eprintln!(" bloxroute {} submission failed after {:?}: {:?}", trade_type, start_time.elapsed(), _error); + eprintln!( + " bloxroute {} submission failed after {:?}: {:?}", + trade_type, + start_time.elapsed(), + _error + ); } } } diff --git a/src/swqos/flashblock.rs b/src/swqos/flashblock.rs index ecd287c..b78e235 100644 --- a/src/swqos/flashblock.rs +++ b/src/swqos/flashblock.rs @@ -97,12 +97,26 @@ impl FlashBlockClient { // Parse response if let Ok(response_json) = serde_json::from_str::(&response_text) { if response_json.get("success").is_some() || response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("FlashBlock", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "FlashBlock", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - eprintln!(" [FlashBlock] {} submission failed after {:?}: {:?}", trade_type, start_time.elapsed(), _error); + eprintln!( + " [FlashBlock] {} submission failed after {:?}: {:?}", + trade_type, + start_time.elapsed(), + _error + ); } } else { - crate::common::sdk_log::log_swqos_submission_failed("FlashBlock", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "FlashBlock", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -122,7 +136,13 @@ impl FlashBlockClient { } if wait_confirmation { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "FlashBlock", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "FlashBlock", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/swqos/helius.rs b/src/swqos/helius.rs index d996691..9d4cbb7 100644 --- a/src/swqos/helius.rs +++ b/src/swqos/helius.rs @@ -107,7 +107,10 @@ impl HeliusClient { if crate::common::sdk_log::sdk_log_enabled() { eprintln!( " [helius] {} submission failed after {:?} status={} body={}", - trade_type, start_time.elapsed(), status, response_text + trade_type, + start_time.elapsed(), + status, + response_text ); } return Err(anyhow::anyhow!( @@ -124,15 +127,29 @@ impl HeliusClient { .and_then(|v| v.as_str()) .unwrap_or("unknown"); if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("helius", trade_type, start_time.elapsed(), err_msg); + crate::common::sdk_log::log_swqos_submission_failed( + "helius", + trade_type, + start_time.elapsed(), + err_msg, + ); } return Err(anyhow::anyhow!("Helius Sender error: {}", err_msg)); } if response_json.get("result").is_some() && crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submitted("helius", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "helius", + trade_type, + start_time.elapsed(), + ); } } else if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("helius", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "helius", + trade_type, + start_time.elapsed(), + response_text, + ); } match poll_transaction_confirmation(&self.rpc_client, signature, wait_confirmation).await { @@ -152,7 +169,13 @@ impl HeliusClient { } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "helius", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "helius", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) } diff --git a/src/swqos/jito.rs b/src/swqos/jito.rs index 01102c3..db5a06d 100755 --- a/src/swqos/jito.rs +++ b/src/swqos/jito.rs @@ -105,12 +105,26 @@ impl JitoClient { if let Ok(response_json) = serde_json::from_str::(&response_text) { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("jito", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "jito", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - eprintln!(" [jito] {} submission failed after {:?}: {:?}", trade_type, start_time.elapsed(), _error); + eprintln!( + " [jito] {} submission failed after {:?}: {:?}", + trade_type, + start_time.elapsed(), + _error + ); } } else { - crate::common::sdk_log::log_swqos_submission_failed("jito", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "jito", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -118,13 +132,25 @@ impl JitoClient { Ok(_) => (), Err(e) => { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmation failed: {:?}", "jito", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmation failed: {:?}", + "jito", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); return Err(e); } } if wait_confirmation { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "jito", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "jito", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) @@ -171,7 +197,12 @@ impl JitoClient { if response_json.get("result").is_some() { println!(" jito {} submitted: {:?}", trade_type, start_time.elapsed()); } else if let Some(_error) = response_json.get("error") { - eprintln!(" jito {} submission failed after {:?}: {:?}", trade_type, start_time.elapsed(), _error); + eprintln!( + " jito {} submission failed after {:?}: {:?}", + trade_type, + start_time.elapsed(), + _error + ); } } diff --git a/src/swqos/lightspeed.rs b/src/swqos/lightspeed.rs index 44ca1fd..af66282 100644 --- a/src/swqos/lightspeed.rs +++ b/src/swqos/lightspeed.rs @@ -103,12 +103,26 @@ impl LightspeedClient { if let Ok(response_json) = serde_json::from_str::(&response_text) { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("lightspeed", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "lightspeed", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - crate::common::sdk_log::log_swqos_submission_failed("lightspeed", trade_type, start_time.elapsed(), _error); + crate::common::sdk_log::log_swqos_submission_failed( + "lightspeed", + trade_type, + start_time.elapsed(), + _error, + ); } } else { - crate::common::sdk_log::log_swqos_submission_failed("lightspeed", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "lightspeed", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -128,7 +142,13 @@ impl LightspeedClient { } if wait_confirmation { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "lightspeed", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "lightspeed", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/swqos/mod.rs b/src/swqos/mod.rs index 76664d2..db775e9 100755 --- a/src/swqos/mod.rs +++ b/src/swqos/mod.rs @@ -30,17 +30,16 @@ use crate::{ constants::swqos::{ SWQOS_ENDPOINTS_ASTRALANE_BINARY, SWQOS_ENDPOINTS_ASTRALANE_PLAIN, SWQOS_ENDPOINTS_ASTRALANE_QUIC, SWQOS_ENDPOINTS_ASTRALANE_QUIC_MEV, - SWQOS_ENDPOINTS_BLOCKRAZOR, - SWQOS_ENDPOINTS_BLOCKRAZOR_GRPC, SWQOS_ENDPOINTS_BLOX, SWQOS_ENDPOINTS_FLASHBLOCK, - SWQOS_ENDPOINTS_HELIUS, SWQOS_ENDPOINTS_JITO, SWQOS_ENDPOINTS_NEXTBLOCK, - SWQOS_ENDPOINTS_NODE1, SWQOS_ENDPOINTS_NODE1_QUIC, SWQOS_ENDPOINTS_SOYAS, - SWQOS_ENDPOINTS_SPEEDLANDING, SWQOS_ENDPOINTS_STELLIUM, SWQOS_ENDPOINTS_TEMPORAL, - SWQOS_ENDPOINTS_ZERO_SLOT, SWQOS_MIN_TIP_ASTRALANE, SWQOS_MIN_TIP_BLOCKRAZOR, - SWQOS_MIN_TIP_BLOXROUTE, SWQOS_MIN_TIP_DEFAULT, SWQOS_MIN_TIP_FLASHBLOCK, - SWQOS_MIN_TIP_HELIUS, SWQOS_MIN_TIP_JITO, SWQOS_MIN_TIP_LIGHTSPEED, - SWQOS_MIN_TIP_NEXTBLOCK, SWQOS_MIN_TIP_NODE1, SWQOS_MIN_TIP_SOYAS, - SWQOS_MIN_TIP_SPEEDLANDING, SWQOS_MIN_TIP_STELLIUM, SWQOS_MIN_TIP_TEMPORAL, - SWQOS_MIN_TIP_ZERO_SLOT, + SWQOS_ENDPOINTS_BLOCKRAZOR, SWQOS_ENDPOINTS_BLOCKRAZOR_GRPC, SWQOS_ENDPOINTS_BLOX, + SWQOS_ENDPOINTS_FLASHBLOCK, SWQOS_ENDPOINTS_HELIUS, SWQOS_ENDPOINTS_JITO, + SWQOS_ENDPOINTS_NEXTBLOCK, SWQOS_ENDPOINTS_NODE1, SWQOS_ENDPOINTS_NODE1_QUIC, + SWQOS_ENDPOINTS_SOYAS, SWQOS_ENDPOINTS_SPEEDLANDING, SWQOS_ENDPOINTS_STELLIUM, + SWQOS_ENDPOINTS_TEMPORAL, SWQOS_ENDPOINTS_ZERO_SLOT, SWQOS_MIN_TIP_ASTRALANE, + SWQOS_MIN_TIP_BLOCKRAZOR, SWQOS_MIN_TIP_BLOXROUTE, SWQOS_MIN_TIP_DEFAULT, + SWQOS_MIN_TIP_FLASHBLOCK, SWQOS_MIN_TIP_HELIUS, SWQOS_MIN_TIP_JITO, + SWQOS_MIN_TIP_LIGHTSPEED, SWQOS_MIN_TIP_NEXTBLOCK, SWQOS_MIN_TIP_NODE1, + SWQOS_MIN_TIP_SOYAS, SWQOS_MIN_TIP_SPEEDLANDING, SWQOS_MIN_TIP_STELLIUM, + SWQOS_MIN_TIP_TEMPORAL, SWQOS_MIN_TIP_ZERO_SLOT, }, swqos::{ astralane::AstralaneClient, blockrazor::BlockRazorClient, bloxroute::BloxrouteClient, @@ -411,15 +410,30 @@ impl SwqosConfig { SwqosConfig::BlockRazor(auth_token, region, url, transport) => { // BlockRazor: transport=None 或 transport=Grpc 时使用 gRPC,transport=Http 时使用 HTTP let use_http = transport.map_or(false, |t| t == SwqosTransport::Http); - let endpoint = SwqosConfig::get_endpoint_with_transport(SwqosType::BlockRazor, region, url, transport, mev_protection); + let endpoint = SwqosConfig::get_endpoint_with_transport( + SwqosType::BlockRazor, + region, + url, + transport, + mev_protection, + ); if use_http { - let blockrazor_client = - BlockRazorClient::new_http(rpc_url.clone(), endpoint.to_string(), auth_token, mev_protection); + let blockrazor_client = BlockRazorClient::new_http( + rpc_url.clone(), + endpoint.to_string(), + auth_token, + mev_protection, + ); Ok(Arc::new(blockrazor_client)) } else { // 使用 gRPC 模式(默认或用户明确指定了 gRPC) - let blockrazor_client = - BlockRazorClient::new_grpc(rpc_url.clone(), endpoint.to_string(), auth_token, mev_protection).await?; + let blockrazor_client = BlockRazorClient::new_grpc( + rpc_url.clone(), + endpoint.to_string(), + auth_token, + mev_protection, + ) + .await?; Ok(Arc::new(blockrazor_client)) } } diff --git a/src/swqos/nextblock.rs b/src/swqos/nextblock.rs index b99087a..74add02 100755 --- a/src/swqos/nextblock.rs +++ b/src/swqos/nextblock.rs @@ -99,12 +99,26 @@ impl NextBlockClient { if let Ok(response_json) = serde_json::from_str::(&response_text) { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("nextblock", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "nextblock", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - crate::common::sdk_log::log_swqos_submission_failed("nextblock", trade_type, start_time.elapsed(), _error); + crate::common::sdk_log::log_swqos_submission_failed( + "nextblock", + trade_type, + start_time.elapsed(), + _error, + ); } } else { - crate::common::sdk_log::log_swqos_submission_failed("nextblock", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "nextblock", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -124,7 +138,13 @@ impl NextBlockClient { } if wait_confirmation { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "nextblock", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "nextblock", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/swqos/node1.rs b/src/swqos/node1.rs index df2f9e7..f3b1391 100644 --- a/src/swqos/node1.rs +++ b/src/swqos/node1.rs @@ -184,13 +184,27 @@ impl Node1Client { if let Ok(response_json) = serde_json::from_str::(&response_text) { if crate::common::sdk_log::sdk_log_enabled() { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("node1", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "node1", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - eprintln!(" [node1] {} submission failed after {:?}: {:?}", trade_type, start_time.elapsed(), _error); + eprintln!( + " [node1] {} submission failed after {:?}: {:?}", + trade_type, + start_time.elapsed(), + _error + ); } } } else if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("node1", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "node1", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -212,7 +226,13 @@ impl Node1Client { } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "node1", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "node1", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/swqos/soyas.rs b/src/swqos/soyas.rs index c334ded..8bef02c 100644 --- a/src/swqos/soyas.rs +++ b/src/swqos/soyas.rs @@ -73,13 +73,14 @@ impl rustls::client::danger::ServerCertVerifier for SkipServerVerification { } /// TLS 客户端证书:ECDSA P-256 + CN=钱包公钥(与 Speedlanding / Astralane QUIC 策略一致)。 -fn generate_client_tls_credentials(keypair: &Keypair) -> Result<(CertificateDer<'static>, PrivateKeyDer<'static>)> { +fn generate_client_tls_credentials( + keypair: &Keypair, +) -> Result<(CertificateDer<'static>, PrivateKeyDer<'static>)> { let tls_key = RcgenKeyPair::generate_for(&rcgen::PKCS_ECDSA_P256_SHA256)?; let mut cert_params = CertificateParams::new(vec![])?; - cert_params.distinguished_name.push( - rcgen::DnType::CommonName, - rcgen::DnValue::Utf8String(keypair.pubkey().to_string()), - ); + cert_params + .distinguished_name + .push(rcgen::DnType::CommonName, rcgen::DnValue::Utf8String(keypair.pubkey().to_string())); let cert = cert_params.self_signed(&tls_key)?; let cert_der = CertificateDer::from(cert.der().to_vec()); let key_der = PrivateKeyDer::Pkcs8(PrivatePkcs8KeyDer::from(tls_key.serialize_der())); @@ -103,11 +104,12 @@ pub struct SoyasClient { impl SoyasClient { pub async fn new(rpc_url: String, endpoint_string: String, api_key: String) -> Result { let rpc_client = SolanaRpcClient::new(rpc_url); - let keypair_bytes = bs58::decode(api_key.trim()) - .into_vec() - .map_err(|e| anyhow::anyhow!("Soyas api_token base58 解码失败(QUIC mTLS 用): {}", e))?; - let keypair = Keypair::try_from(keypair_bytes.as_slice()) - .map_err(|e| anyhow::anyhow!("Soyas api_token 无法解析为 Solana keypair(QUIC mTLS 用): {}", e))?; + let keypair_bytes = bs58::decode(api_key.trim()).into_vec().map_err(|e| { + anyhow::anyhow!("Soyas api_token base58 解码失败(QUIC mTLS 用): {}", e) + })?; + let keypair = Keypair::try_from(keypair_bytes.as_slice()).map_err(|e| { + anyhow::anyhow!("Soyas api_token 无法解析为 Solana keypair(QUIC mTLS 用): {}", e) + })?; let (cert, key) = generate_client_tls_credentials(&keypair)?; let mut crypto = rustls::ClientConfig::builder() .dangerous() @@ -175,13 +177,23 @@ impl SwqosClientTrait for SoyasClient { let connection = self.connection.load_full(); if Self::try_send_bytes(&connection, &serialized_tx).await.is_err() { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("Soyas", trade_type, start_time.elapsed(), "reconnecting"); - } + crate::common::sdk_log::log_swqos_submission_failed( + "Soyas", + trade_type, + start_time.elapsed(), + "reconnecting", + ); + } self.reconnect().await?; let connection = self.connection.load_full(); if let Err(e) = Self::try_send_bytes(&connection, &serialized_tx).await { if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("Soyas", trade_type, start_time.elapsed(), &e); + crate::common::sdk_log::log_swqos_submission_failed( + "Soyas", + trade_type, + start_time.elapsed(), + &e, + ); } return Err(e.into()); } @@ -195,14 +207,26 @@ impl SwqosClientTrait for SoyasClient { Err(e) => { if crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmation failed: {:?}", "Soyas", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmation failed: {:?}", + "Soyas", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } return Err(e); } } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "Soyas", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "Soyas", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) } diff --git a/src/swqos/speedlanding.rs b/src/swqos/speedlanding.rs index 67a003e..cb03435 100644 --- a/src/swqos/speedlanding.rs +++ b/src/swqos/speedlanding.rs @@ -48,11 +48,12 @@ impl SpeedlandingClient { pub async fn new(rpc_url: String, endpoint_string: String, api_key: String) -> Result { let rpc_client = SolanaRpcClient::new(rpc_url); // Speedlanding QUIC:与官方一致使用 `solana_tls_utils::new_dummy_x509_certificate`(Ed25519 dummy cert)+ SNI `speed-landing`。 - let keypair_bytes = bs58::decode(api_key.trim()) - .into_vec() - .map_err(|e| anyhow::anyhow!("Speedlanding api_token base58 解码失败(mTLS 用): {}", e))?; - let keypair = Keypair::try_from(keypair_bytes.as_slice()) - .map_err(|e| anyhow::anyhow!("Speedlanding api_token 无法解析为 Solana keypair(mTLS 用): {}", e))?; + let keypair_bytes = bs58::decode(api_key.trim()).into_vec().map_err(|e| { + anyhow::anyhow!("Speedlanding api_token base58 解码失败(mTLS 用): {}", e) + })?; + let keypair = Keypair::try_from(keypair_bytes.as_slice()).map_err(|e| { + anyhow::anyhow!("Speedlanding api_token 无法解析为 Solana keypair(mTLS 用): {}", e) + })?; let (cert, key) = new_dummy_x509_certificate(&keypair); let mut crypto = rustls::ClientConfig::builder() .dangerous() @@ -111,11 +112,8 @@ impl SpeedlandingClient { let _guard = self.reconnect.lock().await; let current = self.connection.load_full(); if current.close_reason().is_some() { - let connecting = self.endpoint.connect_with( - self.client_config.clone(), - self.addr, - SPEED_SERVER, - )?; + let connecting = + self.endpoint.connect_with(self.client_config.clone(), self.addr, SPEED_SERVER)?; let connection = timeout(CONNECT_TIMEOUT, connecting) .await .context("Speedlanding QUIC reconnect timeout")? @@ -169,7 +167,11 @@ impl SwqosClientTrait for SpeedlandingClient { match send_result.context("Speedlanding QUIC send timeout") { Ok(Ok(())) => { // 提交结果与「详细耗时/SDK 开关」无关,便于确认当前通道确实在执行 - crate::common::sdk_log::log_swqos_submitted("Speedlanding", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "Speedlanding", + trade_type, + start_time.elapsed(), + ); } Ok(Err(e)) => { crate::common::sdk_log::log_swqos_submission_failed( diff --git a/src/swqos/stellium.rs b/src/swqos/stellium.rs index dca654a..410cfc1 100644 --- a/src/swqos/stellium.rs +++ b/src/swqos/stellium.rs @@ -168,13 +168,27 @@ impl StelliumClient { if let Ok(response_json) = serde_json::from_str::(&response_text) { if crate::common::sdk_log::sdk_log_enabled() { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("Stellium", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "Stellium", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - crate::common::sdk_log::log_swqos_submission_failed("Stellium", trade_type, start_time.elapsed(), _error); + crate::common::sdk_log::log_swqos_submission_failed( + "Stellium", + trade_type, + start_time.elapsed(), + _error, + ); } } } else if crate::common::sdk_log::sdk_log_enabled() { - crate::common::sdk_log::log_swqos_submission_failed("Stellium", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "Stellium", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -196,7 +210,13 @@ impl StelliumClient { } if wait_confirmation && crate::common::sdk_log::sdk_log_enabled() { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "Stellium", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "Stellium", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/swqos/temporal.rs b/src/swqos/temporal.rs index ad061bf..d8537f2 100755 --- a/src/swqos/temporal.rs +++ b/src/swqos/temporal.rs @@ -209,12 +209,26 @@ impl TemporalClient { if let Ok(response_json) = serde_json::from_str::(&response_text) { if response_json.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("nozomi", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "nozomi", + trade_type, + start_time.elapsed(), + ); } else if let Some(_error) = response_json.get("error") { - crate::common::sdk_log::log_swqos_submission_failed("nozomi", trade_type, start_time.elapsed(), _error); + crate::common::sdk_log::log_swqos_submission_failed( + "nozomi", + trade_type, + start_time.elapsed(), + _error, + ); } } else { - crate::common::sdk_log::log_swqos_submission_failed("nozomi", trade_type, start_time.elapsed(), response_text); + crate::common::sdk_log::log_swqos_submission_failed( + "nozomi", + trade_type, + start_time.elapsed(), + response_text, + ); } let start_time: Instant = Instant::now(); @@ -232,7 +246,13 @@ impl TemporalClient { } if wait_confirmation { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "nozomi", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "nozomi", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/swqos/zeroslot.rs b/src/swqos/zeroslot.rs index 6503803..4f3b5ba 100755 --- a/src/swqos/zeroslot.rs +++ b/src/swqos/zeroslot.rs @@ -1,12 +1,10 @@ -use crate::swqos::common::{ - default_http_client_builder, poll_transaction_confirmation, -}; +use crate::swqos::common::{default_http_client_builder, poll_transaction_confirmation}; +use bincode; use rand::seq::IndexedRandom; use reqwest::Client; -use std::{sync::Arc, time::Instant, time::Duration}; use std::sync::atomic::{AtomicBool, Ordering}; +use std::{sync::Arc, time::Duration, time::Instant}; use tokio::task::JoinHandle; -use bincode; use crate::swqos::SwqosClientTrait; use crate::swqos::{SwqosType, TradeType}; @@ -101,7 +99,8 @@ impl ZeroSlotClient { if stop_ping.load(Ordering::Relaxed) { break; } - if let Err(e) = Self::send_ping_request(&http_client, &endpoint, &auth_token).await { + if let Err(e) = Self::send_ping_request(&http_client, &endpoint, &auth_token).await + { if crate::common::sdk_log::sdk_log_enabled() { eprintln!("0slot ping request failed: {}", e); } @@ -176,41 +175,89 @@ impl ZeroSlotClient { 200 => { if let Ok(json_value) = serde_json::from_str::(&response_text) { if json_value.get("result").is_some() { - crate::common::sdk_log::log_swqos_submitted("0slot", trade_type, start_time.elapsed()); + crate::common::sdk_log::log_swqos_submitted( + "0slot", + trade_type, + start_time.elapsed(), + ); } else if let Some(error) = json_value.get("error") { - let code = error.get("code") + let code = error + .get("code") .and_then(|c| c.as_i64()) .map(|c| c.to_string()) .unwrap_or_else(|| "unknown".to_string()); - let message = error.get("message") + let message = error + .get("message") .and_then(|m| m.as_str()) .unwrap_or("unknown error"); - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), format!("code {}: {}", code, message)); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + format!("code {}: {}", code, message), + ); return Err(anyhow::anyhow!("0slot Binary-Tx error: {}", message)); } else { - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), format!("unexpected JSON: {}", response_text)); - return Err(anyhow::anyhow!("0slot Binary-Tx unexpected JSON: {}", response_text)); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + format!("unexpected JSON: {}", response_text), + ); + return Err(anyhow::anyhow!( + "0slot Binary-Tx unexpected JSON: {}", + response_text + )); } } else { - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), format!("invalid JSON: {}", response_text)); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + format!("invalid JSON: {}", response_text), + ); return Err(anyhow::anyhow!("0slot Binary-Tx invalid JSON: {}", response_text)); } } 403 => { - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), response_text.clone()); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + response_text.clone(), + ); return Err(anyhow::anyhow!("0slot API key error: {}", response_text)); } 419 => { - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), response_text.clone()); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + response_text.clone(), + ); return Err(anyhow::anyhow!("0slot rate limit exceeded")); } 500 => { - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), "submission failed".to_string()); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + "submission failed".to_string(), + ); return Err(anyhow::anyhow!("0slot transaction submission failed")); } _ => { - crate::common::sdk_log::log_swqos_submission_failed("0slot", trade_type, start_time.elapsed(), format!("status {} body: {}", status, response_text)); - return Err(anyhow::anyhow!("0slot Binary-Tx failed with status {}: {}", status, response_text)); + crate::common::sdk_log::log_swqos_submission_failed( + "0slot", + trade_type, + start_time.elapsed(), + format!("status {} body: {}", status, response_text), + ); + return Err(anyhow::anyhow!( + "0slot Binary-Tx failed with status {}: {}", + status, + response_text + )); } } @@ -222,13 +269,25 @@ impl ZeroSlotClient { Ok(_) => (), Err(e) => { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmation failed: {:?}", "0slot", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmation failed: {:?}", + "0slot", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); return Err(e); } } if wait_confirmation { println!(" signature: {:?}", signature); - println!(" [{:width$}] {} confirmed: {:?}", "0slot", trade_type, start_time.elapsed(), width = crate::common::sdk_log::SWQOS_LABEL_WIDTH); + println!( + " [{:width$}] {} confirmed: {:?}", + "0slot", + trade_type, + start_time.elapsed(), + width = crate::common::sdk_log::SWQOS_LABEL_WIDTH + ); } Ok(()) diff --git a/src/trading/common/transaction_builder.rs b/src/trading/common/transaction_builder.rs index 8ef1eb8..824a223 100755 --- a/src/trading/common/transaction_builder.rs +++ b/src/trading/common/transaction_builder.rs @@ -1,9 +1,9 @@ use solana_hash::Hash; -use solana_sdk::{ - instruction::Instruction, pubkey::Pubkey, - signature::Keypair, signer::Signer, transaction::VersionedTransaction, -}; use solana_message::AddressLookupTableAccount; +use solana_sdk::{ + instruction::Instruction, pubkey::Pubkey, signature::Keypair, signer::Signer, + transaction::VersionedTransaction, +}; use solana_system_interface::instruction as system_instruction; use std::sync::Arc; diff --git a/src/trading/common/utils.rs b/src/trading/common/utils.rs index 2999fbe..a03de8f 100644 --- a/src/trading/common/utils.rs +++ b/src/trading/common/utils.rs @@ -88,7 +88,8 @@ pub async fn transfer_sol( return Err(anyhow!("Insufficient balance")); } - let transfer_instruction = system_instruction::transfer(&payer.pubkey(), receive_wallet, amount); + let transfer_instruction = + system_instruction::transfer(&payer.pubkey(), receive_wallet, amount); let recent_blockhash = rpc.get_latest_blockhash().await?; diff --git a/src/trading/common/wsol_manager.rs b/src/trading/common/wsol_manager.rs index be8773a..d81f07d 100644 --- a/src/trading/common/wsol_manager.rs +++ b/src/trading/common/wsol_manager.rs @@ -7,7 +7,7 @@ use crate::common::{ spl_token::close_account, }; use smallvec::SmallVec; -use solana_sdk::{instruction::Instruction, instruction::AccountMeta, pubkey::Pubkey}; +use solana_sdk::{instruction::AccountMeta, instruction::Instruction, pubkey::Pubkey}; use solana_system_interface::instruction as system_instruction; #[inline] diff --git a/src/trading/core/async_executor.rs b/src/trading/core/async_executor.rs index ce369c5..fdbf95e 100644 --- a/src/trading/core/async_executor.rs +++ b/src/trading/core/async_executor.rs @@ -14,6 +14,7 @@ use anyhow::{anyhow, Result}; use crossbeam_queue::ArrayQueue; use once_cell::sync::OnceCell; +use parking_lot::Mutex; use solana_hash::Hash; use solana_message::AddressLookupTableAccount; use solana_sdk::{ @@ -21,7 +22,6 @@ use solana_sdk::{ }; use std::collections::HashMap; use std::hash::BuildHasherDefault; -use parking_lot::Mutex; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::{ str::FromStr, @@ -187,11 +187,7 @@ fn ensure_dedicated_pool( .map(|all_ids| { sender_thread_cores .map(|indices| { - indices - .iter() - .take(n) - .filter_map(|&i| all_ids.get(i).cloned()) - .collect() + indices.iter().take(n).filter_map(|&i| all_ids.get(i).cloned()).collect() }) .unwrap_or_else(|| all_ids.into_iter().take(n).collect()) }) @@ -416,8 +412,7 @@ impl ResultCollector { } // 「不等待链上确认」仍会等各 SWQOS 的 HTTP 回包;主循环在收齐或触达 `timeout_secs` 后结束。 // 若主窗口到时仍有未回包通道,晚到的 TaskResult 若立刻 drain 会丢签名——仅在该路径上拉长 grace。 - let all_submitted = - self.completed_count.load(Ordering::Acquire) >= self.total_tasks; + let all_submitted = self.completed_count.load(Ordering::Acquire) >= self.total_tasks; if all_submitted { // 全数已登记:仅留极短 settle,避免极端情况下最后一笔与计数可见性竞态。 tokio::time::sleep(Duration::from_millis(35)).await; @@ -472,11 +467,8 @@ pub async fn execute_parallel( let instructions = Arc::new(instructions); // One get_strategies call per batch (avoid N calls in loop). - let gas_fee_configs = gas_fee_strategy.get_strategies(if is_buy { - TradeType::Buy - } else { - TradeType::Sell - }); + let gas_fee_configs = + gas_fee_strategy.get_strategies(if is_buy { TradeType::Buy } else { TradeType::Sell }); let mut task_configs = Vec::with_capacity(swqos_clients.len() * 3); for (i, swqos_client) in swqos_clients.iter().enumerate() { if !with_tip && !matches!(swqos_client.get_swqos_type(), SwqosType::Default) { @@ -589,18 +581,12 @@ pub async fn execute_parallel( if !wait_transaction_confirmed { // submit_timeout_secs 为「等齐各 SWQOS HTTP 应答」的上限;收齐后会立刻进入短 settle,不会睡满整段秒数。 // `wait_for_all_submitted` 仅在未收齐时追加长 grace,避免过早 drain 丢晚到签名。 - let ret = collector - .wait_for_all_submitted(submit_timeout_secs) - .await - .unwrap_or(( - false, - vec![], - Some(anyhow!( - "No SWQOS result within grace window (primary {}s)", - submit_timeout_secs - )), - vec![], - )); + let ret = collector.wait_for_all_submitted(submit_timeout_secs).await.unwrap_or(( + false, + vec![], + Some(anyhow!("No SWQOS result within grace window (primary {}s)", submit_timeout_secs)), + vec![], + )); let (success, signatures, last_error, submit_timings) = ret; return Ok((success, signatures, last_error, submit_timings)); } diff --git a/src/trading/core/executor.rs b/src/trading/core/executor.rs index ec218ad..35fec81 100755 --- a/src/trading/core/executor.rs +++ b/src/trading/core/executor.rs @@ -1,10 +1,9 @@ use anyhow::Result; use solana_hash::Hash; -use solana_sdk::{ - instruction::Instruction, pubkey::Pubkey, - signature::Keypair, signature::Signature, -}; use solana_message::AddressLookupTableAccount; +use solana_sdk::{ + instruction::Instruction, pubkey::Pubkey, signature::Keypair, signature::Signature, +}; use std::{ sync::Arc, time::{Duration, Instant}, @@ -13,6 +12,7 @@ use std::{ use tracing::{info, trace, warn}; use super::{params::SwapParams, traits::InstructionBuilder}; +use crate::swqos::SwqosType; use crate::swqos::TradeType; use crate::{ common::{nonce_cache::DurableNonceInfo, GasFeeStrategy, SolanaRpcClient}, @@ -26,7 +26,6 @@ use crate::{ trading::MiddlewareManager, }; use once_cell::sync::Lazy; -use crate::swqos::{ SwqosType}; /// Global syscall bypass manager (reserved for future time/IO optimizations). /// 全局系统调用绕过管理器(预留,后续可接入时间/IO 等优化)。 @@ -234,10 +233,7 @@ impl TradeExecutor for GenericTradeExecutor { ); } - - Ok((ok, signatures, err, submit_timings)) - }; result @@ -368,8 +364,20 @@ mod tests { let before_submit_ms = 15.67; let w = 12usize; // same as crate::common::sdk_log::SWQOS_LABEL_WIDTH println!("\n--- 1. 构建指令耗时 / 提交前耗时(各打印一次,统一 ms,保留 4 位小数)---\n"); - println!(" [SDK][{:width$}] {} build_instructions: {:.4} ms", "-", dir, build_ms, width = w); - println!(" [SDK][{:width$}] {} before_submit: {:.4} ms", "-", dir, before_submit_ms, width = w); + println!( + " [SDK][{:width$}] {} build_instructions: {:.4} ms", + "-", + dir, + build_ms, + width = w + ); + println!( + " [SDK][{:width$}] {} before_submit: {:.4} ms", + "-", + dir, + before_submit_ms, + width = w + ); println!("\n--- 2. 每个 SWQOS 独立耗时:submit_done=起点→该通道提交完成, confirmed=该通道提交→链上确认, total=起点→链上确认 ---\n"); for (swqos_type, submit_ms, confirmed_ms, total_ms) in [ @@ -388,7 +396,9 @@ mod tests { ); } - println!("\n--- 3. 不等待链上确认时:每行 total = 该通道 submit_done(提交完成总耗时)---\n"); + println!( + "\n--- 3. 不等待链上确认时:每行 total = 该通道 submit_done(提交完成总耗时)---\n" + ); for (swqos_type, submit_ms, total_ms) in [(SwqosType::Jito, 44.20, 44.20), (SwqosType::Helius, 51.80, 51.80)] { @@ -403,8 +413,20 @@ mod tests { } println!("\n--- 4. Simulate 模式(build/before_submit 仍从 grpc_recv_us 起算)---\n"); - println!(" [SDK][{:width$}] {} build_instructions: {:.4} ms", "-", dir, build_ms, width = w); - println!(" [SDK][{:width$}] {} before_submit: {:.4} ms", "-", dir, before_submit_ms, width = w); + println!( + " [SDK][{:width$}] {} build_instructions: {:.4} ms", + "-", + dir, + build_ms, + width = w + ); + println!( + " [SDK][{:width$}] {} before_submit: {:.4} ms", + "-", + dir, + before_submit_ms, + width = w + ); println!(" [SDK][{:width$}] {} simulate (dry-run): {:.4} ms", "-", dir, 8.50, width = w); println!(" [SDK][{:width$}] {} total: {:.4} ms", "-", dir, 36.51, width = w); println!(); diff --git a/src/trading/core/params/dex_swap.rs b/src/trading/core/params/dex_swap.rs index a57d4fd..7cfd344 100644 --- a/src/trading/core/params/dex_swap.rs +++ b/src/trading/core/params/dex_swap.rs @@ -97,9 +97,8 @@ pub struct SwapParams { /// When Some(false), uses regular buy instruction where slippage is applied to SOL/quote input. /// This option only applies to PumpFun and PumpSwap DEXes; it is ignored for other DEXes. pub use_exact_sol_amount: Option, - /// Use PumpFun V2 instructions (buy_v2 / sell_v2 / buy_exact_quote_in_v2, 27-account metas, quote_mint support). - /// Default: `false` — uses V1 instructions (18-account metas, legacy SOL-paired). - /// Set to `true` when PumpFun officially deploys V2 on mainnet. Until then, keep `false` for smaller transaction size. + /// Use PumpFun V2 instructions (buy_v2 / sell_v2 / buy_exact_quote_in_v2, 27/26-account metas, quote_mint support). + /// Default: `false` keeps legacy SOL-paired instructions for smaller transactions; V2 is the official future-proof interface. pub use_pumpfun_v2: bool, } diff --git a/src/trading/core/params/meteora_damm_v2.rs b/src/trading/core/params/meteora_damm_v2.rs index 9f4e227..e42d1b6 100644 --- a/src/trading/core/params/meteora_damm_v2.rs +++ b/src/trading/core/params/meteora_damm_v2.rs @@ -41,9 +41,8 @@ impl MeteoraDammV2Params { ) -> Result { let pool_data = crate::instruction::utils::meteora_damm_v2::fetch_pool(rpc, pool_address).await?; - let mint_accounts = rpc - .get_multiple_accounts(&[pool_data.token_a_mint, pool_data.token_b_mint]) - .await?; + let mint_accounts = + rpc.get_multiple_accounts(&[pool_data.token_a_mint, pool_data.token_b_mint]).await?; let token_a_program = mint_accounts .get(0) .and_then(|a| a.as_ref()) diff --git a/src/trading/core/params/pumpfun.rs b/src/trading/core/params/pumpfun.rs index 2d2b7bd..5e58270 100644 --- a/src/trading/core/params/pumpfun.rs +++ b/src/trading/core/params/pumpfun.rs @@ -5,7 +5,6 @@ use crate::instruction::utils::pumpfun::reconcile_mayhem_mode_for_trade; use solana_sdk::pubkey::Pubkey; use std::sync::Arc; - /// PumpFun protocol specific parameters /// Configuration parameters specific to PumpFun trading protocol. /// @@ -96,16 +95,19 @@ impl PumpFunParams { is_mayhem_mode, is_cashback_coin, ); - let creator_vault_resolved = crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( - &bonding_curve_account.creator, - creator_vault, - &mint, - None, - ) - .or_else(|| { - crate::instruction::utils::pumpfun::get_creator_vault_pda(&bonding_curve_account.creator) - }) - .unwrap_or_default(); + let creator_vault_resolved = + crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( + &bonding_curve_account.creator, + creator_vault, + &mint, + None, + ) + .or_else(|| { + crate::instruction::utils::pumpfun::get_creator_vault_pda( + &bonding_curve_account.creator, + ) + }) + .unwrap_or_default(); Self { bonding_curve: Arc::new(bonding_curve_account), associated_bonding_curve: associated_bonding_curve, @@ -154,16 +156,17 @@ impl PumpFunParams { is_mayhem_mode, is_cashback_coin, ); - let creator_vault_resolved = crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( - &bonding_curve.creator, - creator_vault, - &mint, - None, - ) - .or_else(|| { - crate::instruction::utils::pumpfun::get_creator_vault_pda(&bonding_curve.creator) - }) - .unwrap_or_default(); + let creator_vault_resolved = + crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( + &bonding_curve.creator, + creator_vault, + &mint, + None, + ) + .or_else(|| { + crate::instruction::utils::pumpfun::get_creator_vault_pda(&bonding_curve.creator) + }) + .unwrap_or_default(); Self { bonding_curve: Arc::new(bonding_curve), associated_bonding_curve: associated_bonding_curve, @@ -205,16 +208,21 @@ impl PumpFunParams { &mint_account.owner, ); let fee_sharing_creator_vault_if_active = - crate::instruction::utils::pumpfun::fetch_fee_sharing_creator_vault_if_active(rpc, mint) - .await?; - let creator_vault = crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( - &bonding_curve.creator, - Pubkey::default(), - mint, - fee_sharing_creator_vault_if_active, - ) - .or_else(|| crate::instruction::utils::pumpfun::get_creator_vault_pda(&bonding_curve.creator)) - .unwrap_or_default(); + crate::instruction::utils::pumpfun::fetch_fee_sharing_creator_vault_if_active( + rpc, mint, + ) + .await?; + let creator_vault = + crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( + &bonding_curve.creator, + Pubkey::default(), + mint, + fee_sharing_creator_vault_if_active, + ) + .or_else(|| { + crate::instruction::utils::pumpfun::get_creator_vault_pda(&bonding_curve.creator) + }) + .unwrap_or_default(); Ok(Self { bonding_curve: Arc::new(bonding_curve), associated_bonding_curve: associated_bonding_curve, @@ -246,8 +254,10 @@ impl PumpFunParams { mint: &Pubkey, ) -> Result { self.fee_sharing_creator_vault_if_active = - crate::instruction::utils::pumpfun::fetch_fee_sharing_creator_vault_if_active(rpc, mint) - .await?; + crate::instruction::utils::pumpfun::fetch_fee_sharing_creator_vault_if_active( + rpc, mint, + ) + .await?; let c = self.effective_creator_for_trade(); if let Some(v) = crate::instruction::utils::pumpfun::resolve_creator_vault_for_ix_with_fee_sharing( diff --git a/src/trading/core/traits.rs b/src/trading/core/traits.rs index df68e4d..7764d8b 100755 --- a/src/trading/core/traits.rs +++ b/src/trading/core/traits.rs @@ -1,7 +1,7 @@ +use crate::swqos::SwqosType; use crate::trading::SwapParams; use anyhow::Result; use solana_sdk::{instruction::Instruction, signature::Signature}; -use crate::swqos::{SwqosType}; /// 交易执行器trait - 定义了所有交易协议都需要实现的核心方法 #[async_trait::async_trait] pub trait TradeExecutor: Send + Sync { @@ -9,7 +9,10 @@ pub trait TradeExecutor: Send + Sync { /// - bool: 是否至少有一个交易成功 /// - Vec: 所有提交的交易签名(按SWQOS顺序) /// - Option: 最后一个错误(如果全部失败) - async fn swap(&self, params: SwapParams) -> Result<(bool, Vec, Option, Vec<(SwqosType, i64)>)>; + async fn swap( + &self, + params: SwapParams, + ) -> Result<(bool, Vec, Option, Vec<(SwqosType, i64)>)>; /// 获取协议名称 fn protocol_name(&self) -> &'static str; } diff --git a/src/trading/core/transaction_pool.rs b/src/trading/core/transaction_pool.rs index 0570694..527dad9 100644 --- a/src/trading/core/transaction_pool.rs +++ b/src/trading/core/transaction_pool.rs @@ -19,13 +19,13 @@ const TX_BUILDER_POOL_PREFILL: usize = 64; use crossbeam_queue::ArrayQueue; use once_cell::sync::Lazy; +use solana_message::AddressLookupTableAccount; use solana_sdk::{ hash::Hash, instruction::Instruction, message::{v0, Message, VersionedMessage}, pubkey::Pubkey, }; -use solana_message::AddressLookupTableAccount; use std::sync::Arc; /// 预分配的交易构建器 pub struct PreallocatedTxBuilder { diff --git a/src/utils/calc/pumpswap.rs b/src/utils/calc/pumpswap.rs index f0c99a5..c3fef79 100644 --- a/src/utils/calc/pumpswap.rs +++ b/src/utils/calc/pumpswap.rs @@ -13,11 +13,8 @@ pub(crate) fn creator_side_fee_basis_points( coin_creator: &Pubkey, cashback_fee_basis_points: u64, ) -> u64 { - let creator_bps = if *coin_creator == Pubkey::default() { - 0 - } else { - COIN_CREATOR_FEE_BASIS_POINTS - }; + let creator_bps = + if *coin_creator == Pubkey::default() { 0 } else { COIN_CREATOR_FEE_BASIS_POINTS }; creator_bps.saturating_add(cashback_fee_basis_points) }