anza-xyz / solana-pay

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

[feature] add ts package for express middleware around transaction handling #210

Open ngundotra opened 1 year ago

ngundotra commented 1 year ago

It would be awesome if I could do

import { solanaPayMiddleware } from @solana-pay/middleware

async function createBuyTx(...): Transaction {
}

// under the hood this should do 
// on GET: return the Record on the right
// on POST: tx.serialize({ requireAllSignatures: false }).toString("base64")
export default solanaPayMiddleware(createBuyNFT, {
  label: "my label",
  icon: "https://solanapay.com/src/img/branding/Solanapay.com/downloads/gradient.svg",
});

cc @govarun

DracocardZ commented 6 months ago

import { solanaPayMiddleware } from @solana-pay/middleware

async function createBuyTx(...): Transaction { }

// under the hood this should do // on GET: return the Record on the right // on POST: tx.serialize({ requireAllSignatures: false }).toString("base64") export default solanaPayMiddleware(createBuyNFT, { label: "my label", icon: "https://solanapay.com/src/img/branding/Solanapay.com/downloads/gradient.svg", });print("draco")