Is it possible to get the user's wallet addresses once he's connected to Phantom?
Yes! With the wallet-adapter you can retrieve the connected publicKey and get the connected token addresses.
Example:
const { connection } = useConnection();
const { publicKey } = useWallet();
const tokenAccounts = await connection.getParsedTokenAccountsByOwner(publicKey, { programId: TOKEN_PROGRAM_ID });
Is it possible to get the amount of tokens that the user has on its wallets?
If you console.log the above example:
const tokenAccounts = await connection.getParsedTokenAccountsByOwner(new PublicKey('Ccyrkw1FdRVsfnt7qptyUXqyffq3i59GSPN1EULqZN6i'), { programId: TOKEN_PROGRAM_ID });
tokenAccounts.value.forEach((accountInfo) => {
console.log(`pubkey: ${accountInfo.pubkey.toBase58()}`)
console.log(`mint: ${accountInfo.account.data["parsed"]["info"]["mint"]}`);
console.log(`owner: ${accountInfo.account.data["parsed"]["info"]["owner"]}`);
console.log(`decimals: ${accountInfo.account.data["parsed"]["info"]["tokenAmount"]["decimals"]}`);
console.log(`amount: ${accountInfo.account.data["parsed"]["info"]["tokenAmount"]["amount"]}`);
console.log("====================")
});
/*
pubkey: ArbSRRSPZ5SqXjyjcip3UUZ55Eqn5AkCP4dHZNRrKBhz
mint: 8HGyAAB1yoM1ttS7pXjHMa3dukTFGQggnFFH3hJZgzQh
owner: Ccyrkw1FdRVsfnt7qptyUXqyffq3i59GSPN1EULqZN6i
decimals: 6
amount: 875471
====================
pubkey: 6JbMNzmX7QrxUEL5RT9TczvTuCjXPFTDRWgCs88atmV8
mint: 4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R
owner: Ccyrkw1FdRVsfnt7qptyUXqyffq3i59GSPN1EULqZN6i
decimals: 6
amount: 330108
====================
pubkey: 9xqnnfeonbsEGSPgF5Wd7bf9RqXy4KP22bdaGmZbHGwp
mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
owner: Ccyrkw1FdRVsfnt7qptyUXqyffq3i59GSPN1EULqZN6i
decimals: 6
amount: 199497145
====================
*/
Assuming that my token isn't on an exchange, but I have 100 units of it and I want to transfer 50 units to another wallet, would it be possible to happen?
Yep, you can transfer tokens between wallets as well.
let tx = new Transaction().add(
createTransferCheckedInstruction(
tokenAccountXPubkey, // from (should be a token account)
mintPubkey, // mint
tokenAccountYPubkey, // to (should be a token account)
alice.publicKey, // from's owner
50e8, // amount, if your deciamls is 8, send 10^8 for 1 token
8 // decimals
)
);
await sendAndConfirmTransaction(connection, tx, [alice]);
I'd like to know which technologies, articles, websites and etc can help me build this and also learn about these topics?
There's a bunch of great material with examples over at the Solana Cookbook. Otherwise I would refer to the answers the other user has given.