@@ -47,6 +47,7 @@ use spl_token_2022::{
47
47
instruction:: * ,
48
48
state:: { Account , Mint , Multisig } ,
49
49
} ;
50
+ use spl_token_client:: client:: { ProgramClient , ProgramRpcClient , ProgramRpcClientSendTransaction } ;
50
51
use std:: {
51
52
collections:: HashMap , fmt:: Display , process:: exit, str:: FromStr , string:: ToString , sync:: Arc ,
52
53
} ;
@@ -319,7 +320,7 @@ async fn command_create_token(
319
320
320
321
let minimum_balance_for_rent_exemption = if !config. sign_only {
321
322
config
322
- . rpc_client
323
+ . program_client
323
324
. get_minimum_balance_for_rent_exemption ( Mint :: LEN )
324
325
. await ?
325
326
} else {
@@ -383,7 +384,7 @@ async fn command_create_account(
383
384
) -> CommandResult {
384
385
let minimum_balance_for_rent_exemption = if !config. sign_only {
385
386
config
386
- . rpc_client
387
+ . program_client
387
388
. get_minimum_balance_for_rent_exemption ( Account :: LEN )
388
389
. await ?
389
390
} else {
@@ -476,7 +477,7 @@ async fn command_create_multisig(
476
477
477
478
let minimum_balance_for_rent_exemption = if !config. sign_only {
478
479
config
479
- . rpc_client
480
+ . program_client
480
481
. get_minimum_balance_for_rent_exemption ( Multisig :: LEN )
481
482
. await ?
482
483
} else {
@@ -824,7 +825,7 @@ async fn command_transfer(
824
825
if fund_recipient {
825
826
if !config. sign_only {
826
827
minimum_balance_for_rent_exemption += config
827
- . rpc_client
828
+ . program_client
828
829
. get_minimum_balance_for_rent_exemption ( Account :: LEN )
829
830
. await ?;
830
831
println_display (
@@ -1600,7 +1601,7 @@ async fn command_gc(
1600
1601
1601
1602
let minimum_balance_for_rent_exemption = if !config. sign_only {
1602
1603
config
1603
- . rpc_client
1604
+ . program_client
1604
1605
. get_minimum_balance_for_rent_exemption ( Account :: LEN )
1605
1606
. await ?
1606
1607
} else {
@@ -2760,8 +2761,12 @@ async fn main() -> Result<(), Error> {
2760
2761
json_rpc_url,
2761
2762
CommitmentConfig :: confirmed ( ) ,
2762
2763
) ) ;
2764
+ let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
2765
+ ProgramRpcClient :: new ( rpc_client. clone ( ) , ProgramRpcClientSendTransaction ) ,
2766
+ ) ;
2763
2767
Config {
2764
2768
rpc_client,
2769
+ program_client,
2765
2770
websocket_url,
2766
2771
output_format,
2767
2772
fee_payer,
@@ -3329,8 +3334,12 @@ mod tests {
3329
3334
) -> Config < ' a > {
3330
3335
let websocket_url = test_validator. rpc_pubsub_url ( ) ;
3331
3336
let rpc_client = Arc :: new ( test_validator. get_async_rpc_client ( ) ) ;
3337
+ let program_client: Arc < dyn ProgramClient < ProgramRpcClientSendTransaction > > = Arc :: new (
3338
+ ProgramRpcClient :: new ( rpc_client. clone ( ) , ProgramRpcClientSendTransaction ) ,
3339
+ ) ;
3332
3340
Config {
3333
3341
rpc_client,
3342
+ program_client,
3334
3343
websocket_url,
3335
3344
output_format : OutputFormat :: JsonCompact ,
3336
3345
fee_payer : payer. pubkey ( ) ,
0 commit comments