blocto / solana-go-sdk

Solana Golang SDK
https://blocto.github.io/solana-go-sdk/
MIT License
349 stars 86 forks source link

Docs incorrectly uses system.transfer for token transfers #171

Open tosynthegeek opened 4 weeks ago

tosynthegeek commented 4 weeks ago

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,
})
yihau commented 4 weeks ago

thank you for pointing this out. that one is outdated and deprecated! could you check the docs on https://blocto.github.io/solana-go-sdk