0

Does anyone have a boilerplate / example of sending a SPL token with @solana/wallet-adapter-react? Thanks in advance!

1 Answer 1

1

You can follow the wallet adapter dapp example at https://github.com/solana-labs/wallet-adapter/blob/master/APP.md and change the transaction to use spl token instead.

This could look like:

import { createTransferInstruction } from '@solana/spl-token';

...

        const transaction = new Transaction().add(
            createTransferInstruction(
                sourceAccount, // the token account to send from
                destinationAccount, // the token account to send to
                owner, // the owner of sourceAccount
                transferAmount, // the number of tokens to transfer
            )
        );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.