Hey i want to fetch the token amount how do I do that? I have reached this point but want to hold just the value
used this till here console.log("Signature: ",hash.meta.postTokenBalances);
It's up to you what you need. Let's use SOL as an example, which as 9 decimal places, such that 1 SOL = 1_000_000_000 lamports
amount
is the total amount of lamports, so 90_000_000_000
in your exampleuiAmountString
is the formatted amount of SOL, so 90.000000000
in your exampleIf you need to do calculations, you should hold on to amount
to do the math, and decimals
to display it. If you only need to display, then uiAmountString
will be easiest.