solana-go-sdk
solana-go-sdk copied to clipboard
Docs incorrectly uses system.transfer for token transfers
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,
})