Parcourir la source

remove hardcoded addresses in Buy Button

master
Dom SP il y a 3 ans
Parent
révision
886089f149
2 fichiers modifiés avec 10 ajouts et 4 suppressions
  1. +1
    -0
      src/App.tsx
  2. +9
    -4
      src/components/BuyButton.tsx

+ 1
- 0
src/App.tsx Voir le fichier

@@ -125,6 +125,7 @@ const App = () => {
</div>
<BuyButton
Tezos={Tezos}
sender={userAddress}
FA2address="KT1BB1uMwVvJ1M3vVHXWALs1RWdgTp1rnXTR"
receiver="tz1hJncvXvL2VyctPE685GJPXDaRJ7dtiwjm"
amount={100}

+ 9
- 4
src/components/BuyButton.tsx Voir le fichier

@@ -6,11 +6,13 @@ import { BeaconWallet } from "@taquito/beacon-wallet";
const BuyButton = ({
Tezos,
FA2address,
sender,
receiver,
amount
}: {
Tezos: TezosToolkit,
FA2address: string,
sender: string,
receiver: string,
amount: number
}): JSX.Element => {
@@ -20,9 +22,9 @@ const BuyButton = ({
const transfer_params = [
{
from_: "tz1LigkX55duWS2pZt4u5qTAWUu6Sb9bMxbg",
from_: sender,
txs: [{
to_: "tz1hJncvXvL2VyctPE685GJPXDaRJ7dtiwjm",
to_: receiver,
token_id:0,
amount: amount
}]
@@ -38,8 +40,11 @@ const BuyButton = ({
<button
className="myButton"
onClick={makePayment}
>
{FA2address}
>Transfer {amount}&nbsp;
µ-tokens from: &nbsp;
{sender}
&nbsp;to:&nbsp;
{receiver}
</button>
</div>
);

Chargement…
Annuler
Enregistrer