solana-go-sdk icon indicating copy to clipboard operation
solana-go-sdk copied to clipboard

Docs incorrectly uses system.transfer for token transfers

Open tosynthegeek opened this issue 8 months ago • 1 comments

The docs at https://yihau.gitbook.io/solana-go/tour/transfer-1 currently demonstrates token transfers using system.transfer, which is incorrect for token transfers. This method is appropriate for SOL transfers but not for other tokens.

Current Behavior

The docs shows:

sysprog.Transfer(sysprog.TransferParam{
    From:   alice.PublicKey,
    To:     common.PublicKeyFromString("2xNweLHLqrbx4zo1waDvgWJHgsUpPj8Y8icbAFeR4a8i"),
    Amount: 1e9,
})

Expected Behaviour

token.Transfer(token.TransferParam{
    From:    fromTokenAccount,
    To:      toTokenAccount,
    Auth:    alice.PublicKey,
    Signers: []common.PublicKey{},
    Amount:  amount,
})

tosynthegeek avatar Jun 18 '24 08:06 tosynthegeek