anza-xyz / solana-pay

A new standard for decentralized payments.
https://solanapay.com
Apache License 2.0
1.28k stars 447 forks source link

ValidateTransferError: invalid memo keys #230

Open Luchanso opened 5 months ago

Luchanso commented 5 months ago

Tryed call validateTransfer(...) and got some error for valid transaction:

ValidateTransferError: invalid memo keys
    at validateMemo (D:\dev\ssr\node_modules\@solana\pay\src\validateTransfer.ts:97:40)
    at D:\dev\ssr\node_modules\@solana\pay\src\validateTransfer.ts:88:9
    at Generator.next (<anonymous>)
    at fulfilled (D:\dev\ssr\node_modules\@solana\pay\lib\cjs\validateTransfer.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Simple playground: https://codesandbox.io/p/devbox/hardcore-mclaren-qtz7zg?file=%2Findex.js%3A28%2C7

function validateTransfer(...) not correct work when pass memo string, I think it's can be bug on: https://github.com/anza-xyz/solana-pay/blame/master/core/src/validateTransfer.ts#L97 because "instruction.keys" must contain single key about Signer image

moulin-louis commented 4 months ago

Hey 👋 I’m facing the same issue, did you manage to solve this ? Or the bug is still around ? Thanks a lot !

rinkaaan commented 2 months ago

I am also facing same issue... this is serious, I am trying to use memo to authenticate Solana Pay payments on server side. I was going to use reference field but apparently many Solana mobile wallets don't even include the reference in the transfer transaction!

Luchanso commented 2 months ago

Workaround: create this file with commented this line in your local project, and use this function from it:

https://gist.github.com/Luchanso/2b3e7c4f7d9ce8a6128ebe7ed004cec8#file-validate-ts-L98