Browse Source

remove hardcoded addresses in Buy Button

master
Dom SP 3 years ago
parent
commit
886089f149
2 changed files with 10 additions and 4 deletions
  1. +1
    -0
      src/App.tsx
  2. +9
    -4
      src/components/BuyButton.tsx

+ 1
- 0
src/App.tsx View File

</div> </div>
<BuyButton <BuyButton
Tezos={Tezos} Tezos={Tezos}
sender={userAddress}
FA2address="KT1BB1uMwVvJ1M3vVHXWALs1RWdgTp1rnXTR" FA2address="KT1BB1uMwVvJ1M3vVHXWALs1RWdgTp1rnXTR"
receiver="tz1hJncvXvL2VyctPE685GJPXDaRJ7dtiwjm" receiver="tz1hJncvXvL2VyctPE685GJPXDaRJ7dtiwjm"
amount={100} amount={100}

+ 9
- 4
src/components/BuyButton.tsx View File

const BuyButton = ({ const BuyButton = ({
Tezos, Tezos,
FA2address, FA2address,
sender,
receiver, receiver,
amount amount
}: { }: {
Tezos: TezosToolkit, Tezos: TezosToolkit,
FA2address: string, FA2address: string,
sender: string,
receiver: string, receiver: string,
amount: number amount: number
}): JSX.Element => { }): JSX.Element => {
const transfer_params = [ const transfer_params = [
{ {
from_: "tz1LigkX55duWS2pZt4u5qTAWUu6Sb9bMxbg",
from_: sender,
txs: [{ txs: [{
to_: "tz1hJncvXvL2VyctPE685GJPXDaRJ7dtiwjm",
to_: receiver,
token_id:0, token_id:0,
amount: amount amount: amount
}] }]
<button <button
className="myButton" className="myButton"
onClick={makePayment} onClick={makePayment}
>
{FA2address}
>Transfer {amount}&nbsp;
µ-tokens from: &nbsp;
{sender}
&nbsp;to:&nbsp;
{receiver}
</button> </button>
</div> </div>
); );

Loading…
Cancel
Save