@@ -196,7 +196,7 @@ export class AccountManager {
196
196
}
197
197
} catch {
198
198
this . logger . debug ( 'node client ping failed, refreshing node client' ) ;
199
- await this . refreshNodeClient ( namespace , undefined , clusterRefs , deployment , context ) ;
199
+ await this . refreshNodeClient ( namespace , undefined , clusterRefs , deployment , context , forcePortForward ) ;
200
200
}
201
201
}
202
202
@@ -967,14 +967,25 @@ export class AccountManager {
967
967
/**
968
968
* Fetch and prepare address book as a base64 string
969
969
*/
970
- async prepareAddressBookBase64 ( ) {
970
+ async prepareAddressBookBase64 (
971
+ namespace : NamespaceName ,
972
+ clusterRefs ?: ClusterRefs ,
973
+ deployment ?: DeploymentName ,
974
+ operatorId ?: string ,
975
+ operatorKey ?: string ,
976
+ forcePortForward ?: boolean ,
977
+ context ?: string ,
978
+ ) {
971
979
// fetch AddressBook
972
- const fileQuery = new FileContentsQuery ( ) . setFileId ( FileId . ADDRESS_BOOK ) ;
973
- const addressBookBytes = await fileQuery . execute ( this . _nodeClient ) ;
980
+ await this . loadNodeClient ( namespace , clusterRefs , deployment , forcePortForward , context ) ;
981
+ const client = this . _nodeClient ;
974
982
975
- // convert addressBook into base64
976
- // @ts -ignore
977
- return Base64 . encode ( addressBookBytes ) ;
983
+ if ( operatorId && operatorKey ) {
984
+ client . setOperator ( operatorId , operatorKey ) ;
985
+ }
986
+
987
+ const query = new FileContentsQuery ( ) . setFileId ( FileId . ADDRESS_BOOK ) ;
988
+ return Buffer . from ( await query . execute ( client ) ) . toString ( 'base64' ) ;
978
989
}
979
990
980
991
async getFileContents (
@@ -983,8 +994,9 @@ export class AccountManager {
983
994
clusterRefs ?: ClusterRefs ,
984
995
deployment ?: DeploymentName ,
985
996
forcePortForward ?: boolean ,
997
+ context ?: string ,
986
998
) {
987
- await this . loadNodeClient ( namespace , clusterRefs , deployment , forcePortForward ) ;
999
+ await this . loadNodeClient ( namespace , clusterRefs , deployment , forcePortForward , context ) ;
988
1000
const client = this . _nodeClient ;
989
1001
const fileId = FileId . fromString ( `0.0.${ fileNum } ` ) ;
990
1002
const queryFees = new FileContentsQuery ( ) . setFileId ( fileId ) ;
0 commit comments