anza-xyz / solana-pay

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

Allow ATA owner to be off the curve #119

Closed bricestacey closed 2 years ago

bricestacey commented 2 years ago

I have been working on an integration that allows a program to accept payment using Solana Pay.

When getting the payer and recipient ATA, Solana Pay SDK uses the default value for allowOwnerOffCurve which happens to be false. This makes it a bit harder if one wanted to integrate Solana Pay with a program, e.g. when a PDA is the owner of the recipient account. Is there any reason not to change the default behavior to allow Token owners off the curve?

I believe an existing workaround is to have an owner on the curve and use the Approve instruction and delegate the full amount to the PDA. It's a bit clumsy though.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

solana-pay-docs – ./docs

🔍 Inspect: https://vercel.com/solana-labs/solana-pay-docs/Q3mehQJHPXQURHBtjiY1tQCPQKKb
✅ Preview: https://solana-pay-docs-git-fork-bricestacey-allow-o-27f812-solana-labs.vercel.app

solana-pay – ./point-of-sale

🔍 Inspect: https://vercel.com/solana-labs/solana-pay/BAPPuam8HyYT5zaeWoxWqC1XaPYW
✅ Preview: https://solana-pay-git-fork-bricestacey-allow-off-curve-solana-labs.vercel.app

jordaaash commented 2 years ago

Sending tokens to programs isn't a design goal of Solana Pay transfer requests. More importantly, changing the createTransaction function in the SDK isn't going to change how wallets that support Solana Pay actually create transactions from the URL, so I'm afraid this PR won't do anything.

However, you can accomplish this (and any other kind of custom transaction) with transaction requests. See #77 and #117 which are going to be merged within a few days, and are already supported in Phantom, Solflare, and Glow (in beta/TestFlight pending app store review).