@@ -1902,22 +1902,11 @@ async fn command_required_transfer_memos(
1902
1902
if config. sign_only {
1903
1903
panic ! ( "Config can not be sign only for enabling/disabling required transfer memos." ) ;
1904
1904
}
1905
- let account_fetch = config
1906
- . rpc_client
1907
- . get_account ( & token_account_address)
1908
- . await
1909
- . map_err ( |err| {
1910
- format ! (
1911
- "Token account {} does not exist: {}" ,
1912
- token_account_address, err
1913
- )
1914
- } ) ?;
1915
- let program_id = config. program_id ;
1916
- config. get_account_checked ( & token_account_address) . await ?;
1905
+ let account = config. get_account_checked ( & token_account_address) . await ?;
1917
1906
let mut instructions: Vec < Instruction > = Vec :: new ( ) ;
1918
1907
// Reallocation (if needed)
1919
- let current_account_len = account_fetch . data . len ( ) ;
1920
- let state_with_extension = StateWithExtensionsOwned :: < Account > :: unpack ( account_fetch . data ) ?;
1908
+ let current_account_len = account . data . len ( ) ;
1909
+ let state_with_extension = StateWithExtensionsOwned :: < Account > :: unpack ( account . data ) ?;
1921
1910
let mut existing_extensions: Vec < ExtensionType > = state_with_extension. get_extension_types ( ) ?;
1922
1911
if existing_extensions. contains ( & ExtensionType :: MemoTransfer ) {
1923
1912
let extension_data: bool = state_with_extension
@@ -1939,7 +1928,7 @@ async fn command_required_transfer_memos(
1939
1928
let needed_account_len = ExtensionType :: get_account_len :: < Account > ( & existing_extensions) ;
1940
1929
if needed_account_len > current_account_len {
1941
1930
instructions. push ( reallocate (
1942
- & program_id,
1931
+ & config . program_id ,
1943
1932
& token_account_address,
1944
1933
& config. fee_payer . pubkey ( ) ,
1945
1934
& owner,
@@ -1951,7 +1940,7 @@ async fn command_required_transfer_memos(
1951
1940
if enable_memos {
1952
1941
instructions. push (
1953
1942
spl_token_2022:: extension:: memo_transfer:: instruction:: enable_required_transfer_memos (
1954
- & program_id,
1943
+ & config . program_id ,
1955
1944
& token_account_address,
1956
1945
& owner,
1957
1946
& config. multisigner_pubkeys ,
@@ -1960,7 +1949,7 @@ async fn command_required_transfer_memos(
1960
1949
} else {
1961
1950
instructions. push (
1962
1951
spl_token_2022:: extension:: memo_transfer:: instruction:: disable_required_transfer_memos (
1963
- & program_id,
1952
+ & config . program_id ,
1964
1953
& token_account_address,
1965
1954
& owner,
1966
1955
& config. multisigner_pubkeys ,
0 commit comments