import { Client } from '@hashgraph/sdk' export async function testClientOperatorMatch(client: Client) { const { TransferTransaction, Hbar, Status, StatusError } = await import( '@hashgraph/sdk' ); const tx = new TransferTransaction() /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */ .addHbarTransfer(client.operatorAccountId!, Hbar.fromTinybars(0)) .setMaxTransactionFee(Hbar.fromTinybars(1)); try { await tx.execute(client); } catch (err) { console.log(`Error: ${err}`); if (err instanceof StatusError) { if ( err.status === Status.InsufficientTxFee || err.status === Status.InsufficientPayerBalance ) { // If the transaction fails with Insufficient Tx Fee, this means // that the account ID verification succeeded before this point // Same for Insufficient Payer Balance return true; } return false; } throw err; } // under *no* cirumstances should this transaction succeed throw new Error( 'unexpected success of intentionally-erroneous transaction to confirm account ID' ); }