@@ -24,6 +24,7 @@ use quicknode_sdk::{CreditBalance, PaymentConfig};
2424use crate :: config:: { self , PaymentSection } ;
2525use crate :: context:: { Ctx , GlobalArgs } ;
2626use crate :: errors:: CliError ;
27+ use crate :: output:: { style, Style } ;
2728
2829use super :: payment:: {
2930 ensure_gateway_session, resolve_payment_params, resolve_session_params, PaymentParams ,
@@ -256,23 +257,32 @@ async fn run_buy_credits(args: PaymentArgs, global: GlobalArgs) -> Result<(), Cl
256257 "✓ Bought credits (balance: {})" ,
257258 fmt_credits( balance. credits)
258259 ) ) ;
259- ctx. out
260- . note ( & format ! ( " Next: {}" , drawdown_call_hint( & args, & network) ) ) ;
260+ ctx. out . note ( & format ! (
261+ "\n {}\n \n {}" ,
262+ style(
263+ "Spend the credits on calls (signs nothing per request):" ,
264+ Style :: Bold ,
265+ ctx. out. color,
266+ ) ,
267+ drawdown_call_hint( & args, & network)
268+ ) ) ;
261269 emit_balance ( & ctx, & balance)
262270}
263271
264- // A copy-pasteable `--x402-drawdown` call reflecting the flags the user just
265- // used, so the chained next step runs as-is.
272+ // A copy-pasteable, multi-line `--x402-drawdown` call reflecting the flags the
273+ // user just used, so the chained next step runs as-is.
266274fn drawdown_call_hint ( args : & PaymentArgs , network : & str ) -> String {
267275 let mut cmd = format ! (
268- "qn rpc call eth_blockNumber --network {network} --x402-drawdown --payment-wallet {}" ,
276+ " qn rpc call eth_blockNumber \\ \n \
277+ --network {network} --x402-drawdown \\ \n \
278+ --payment-wallet {}",
269279 args. payment_wallet. as_deref( ) . unwrap_or( "<NAME>" )
270280 ) ;
271281 // The drawdown call defaults its pay network to --network, so only append
272282 // --payment-network when the user set an explicit one that differs.
273283 if let Some ( pn) = & args. payment_network {
274284 if pn != network {
275- cmd. push_str ( & format ! ( " --payment-network {pn}" ) ) ;
285+ cmd. push_str ( & format ! ( " \\ \n --payment-network {pn}" ) ) ;
276286 }
277287 }
278288 cmd
@@ -296,17 +306,54 @@ async fn run_drip(args: SessionArgs, global: GlobalArgs) -> Result<(), CliError>
296306 "✓ Faucet funded {} (tx: {})" ,
297307 receipt. account_id, receipt. transaction_hash
298308 ) ) ;
299- // Point at buy-credits with the flags the user already supplied.
300- let net = args. network . as_deref ( ) . or ( args. payment_network . as_deref ( ) ) ;
301- // buy-credits signs, so the hint carries the asset + ceiling placeholders
302- // the user fills in for the purchase (drip itself collects neither).
303- ctx. out . note ( & format ! (
304- " Next: qn rpc x402 buy-credits --network {} --payment-wallet {} \
305- --payment-network {} --payment-asset <ASSET> --max-amount 1000000",
306- net. unwrap_or( "<SLUG>" ) ,
307- args. payment_wallet. as_deref( ) . unwrap_or( "<NAME>" ) ,
308- args. payment_network. as_deref( ) . unwrap_or( "<NET>" ) ,
309+ // Point at the two paid lanes with the flags the user already supplied;
310+ // USDC is the asset the faucet just funded.
311+ let query_net = args
312+ . network
313+ . as_deref ( )
314+ . or ( args. payment_network . as_deref ( ) )
315+ . unwrap_or ( "<SLUG>" ) ;
316+ let wallet = args. payment_wallet . as_deref ( ) . unwrap_or ( "<NAME>" ) ;
317+ let pay_net = args. payment_network . as_deref ( ) . unwrap_or ( "<NET>" ) ;
318+ let c = ctx. out . color ;
319+
320+ let mut block = String :: new ( ) ;
321+ block. push_str (
322+ "\n This wallet now has funds that can be used to pay for blockchain calls\n \
323+ using micropayments.\n \n ",
324+ ) ;
325+ block. push_str ( & style (
326+ "Pay per-request (sign a payment on each call):" ,
327+ Style :: Bold ,
328+ c,
329+ ) ) ;
330+ block. push_str ( & format ! (
331+ "\n \n \
332+ qn rpc call eth_blockNumber \\ \n \
333+ --network {query_net} --x402 \\ \n \
334+ --payment-wallet {wallet} \\ \n \
335+ --payment-network {pay_net} \\ \n \
336+ --payment-asset USDC \\ \n \
337+ --max-amount 1000\n \n "
338+ ) ) ;
339+ block. push_str ( & style (
340+ "Credit drawdown (buy prepaid credits once, then spend them):" ,
341+ Style :: Bold ,
342+ c,
343+ ) ) ;
344+ block. push_str ( & format ! (
345+ "\n \n \
346+ qn rpc x402 buy-credits \\ \n \
347+ --network {query_net} \\ \n \
348+ --payment-wallet {wallet} \\ \n \
349+ --payment-network {pay_net} \\ \n \
350+ --payment-asset USDC \\ \n \
351+ --max-amount 1000000\n \n \
352+ qn rpc call eth_blockNumber \\ \n \
353+ --network {query_net} --x402-drawdown \\ \n \
354+ --payment-wallet {wallet}"
309355 ) ) ;
356+ ctx. out . note ( & block) ;
310357 if matches ! ( ctx. global. format, Some ( f) if f. is_structured( ) ) {
311358 let v = serde_json:: json!( {
312359 "account_id" : receipt. account_id,
0 commit comments