Get and print the summary data of the subaccount using getSubaccountSummary. You should see that your balance is now 0.
Full example - deposit and withdraw
import {getVertexClient, prettyPrintJson} from'./common';asyncfunctionmain() {constvertexClient=awaitgetVertexClient();// If you have access to `signer`, you can call `getAddress()` directly instead of reaching into `vertexClient.context`constaddress=await (vertexClient.context.signerOrProvider asWallet ).getAddress();constsubaccountName='default';// 1 USDC (6 decimals)constdepositAmount=10**6;// TESTNET ONLY - Mint yourself some tokensconstmintTx=awaitvertexClient.spot._mintMockERC20({ amount: depositAmount, productId:0, });// Mint goes on-chain, so wait for confirmationconstmintTxReceipt=awaitmintTx.wait();prettyPrintJson('Mint Tx Hash',mintTxReceipt.transactionHash);// Deposits move ERC20, so require approval, this is on-chain as wellconstapproveTx=awaitvertexClient.spot.approveAllowance({ amount: depositAmount, productId:0, });constapproveTxReceipt=awaitapproveTx.wait();prettyPrintJson('Approve Tx Hash',approveTxReceipt.transactionHash);// Now execute the deposit, which goes on-chainconstdepositTx=awaitvertexClient.spot.deposit({// Your choice of name for the subaccount, this subaccount will be credited subaccountName, amount: depositAmount, productId:0, });constdepositTxReceipt=awaitdepositTx.wait();prettyPrintJson('Deposit Tx Hash',depositTxReceipt.transactionHash);// Inject a delay for our offchain engine to pick up the transaction and credit your accountawaitnewPromise((resolve) =>setTimeout(resolve,10000));// For on-chain state, you can use `getSubaccountSummary` - these should match upconstsubaccountData=awaitvertexClient.subaccount.getEngineSubaccountSummary({ subaccountOwner: address, subaccountName, });prettyPrintJson('Subaccount Data After Deposit', subaccountData);// Now withdraw your funds, this goes to the off-chain engine// We're withdrawing less than 10 as there are withdrawal fees of 0.1 USDCconstwithdrawTx=awaitvertexClient.spot.withdraw({ amount: depositAmount -10**5, productId:0, subaccountName, });prettyPrintJson('Withdraw Tx', withdrawTx);// Your new subaccount summary should have zero balancesconstsubaccountDataAfterWithdraw=awaitvertexClient.subaccount.getEngineSubaccountSummary({ subaccountOwner: address, subaccountName, });prettyPrintJson('Subaccount Data After Withdrawal', subaccountDataAfterWithdraw, );}main();