diff --git a/docs/sum_credits_used_by_user.sql b/docs/sum_credits_used_by_user.sql new file mode 100644 index 00000000..ab2e69b0 --- /dev/null +++ b/docs/sum_credits_used_by_user.sql @@ -0,0 +1,7 @@ +SELECT SUM(`sum_credits_used`) as sum, rpc_accounting_v2.rpc_key_id, rpc_key.user_id, user.email +FROM `rpc_accounting_v2` +JOIN rpc_key ON rpc_accounting_v2.rpc_key_id=rpc_key.id +JOIN user on rpc_key.user_id=user.id +GROUP BY `rpc_key_id` +ORDER BY sum DESC +LIMIT 100 diff --git a/web3_proxy_cli/src/sub_commands/grant_credits_to_address.rs b/web3_proxy_cli/src/sub_commands/grant_credits_to_address.rs index bdc0f271..910ef79a 100644 --- a/web3_proxy_cli/src/sub_commands/grant_credits_to_address.rs +++ b/web3_proxy_cli/src/sub_commands/grant_credits_to_address.rs @@ -26,6 +26,10 @@ pub struct GrantCreditsToAddress { #[argh(positional)] /// how many credits to give. "0" to just see their balance credits: Decimal, + + #[argh(option)] + /// description of the transaction. + note: Option, } impl GrantCreditsToAddress { @@ -52,7 +56,10 @@ impl GrantCreditsToAddress { // TODO: allow customizing the admin id admin_id: sea_orm::Set(1), deposit_to_user_id: sea_orm::Set(user_id), - note: sea_orm::Set("grant credits to address".into()), + note: sea_orm::Set( + self.note + .unwrap_or_else(|| "grant credits to address".to_string()), + ), ..Default::default() }; increase_balance_receipt.save(&txn).await?;