Giveth / giveth-dapps-v2

This project is the aggregation of GIVeconomy and Giveth.io DApps in a single repo
https://staging.giveth.io
GNU General Public License v3.0
64 stars 34 forks source link

Stellar| in UI it seems my user isn't signed in, but the authorization is set in header #4591

Closed maryjaf closed 1 month ago

maryjaf commented 3 months ago

When I try to donate to test base01 project, the success donation page is shown

In the response of query in network log, donationId : id: "267672" is shown that was created on 19 Aug(yesterday)

and in UI it seems my user isn't signed in, but the authorization is set in header


image


image


https://github.com/user-attachments/assets/a84c6e99-9d8d-4b3c-8cc9-974eba93765c

maryjaf commented 3 months ago

curl:

curl 'https://impact-graph.serve.giveth.io/graphql' \ -H 'sec-ch-ua: "Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"' \ -H 'authversion: 2' \ -H 'accept-language: en' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNBZGRyZXNzIjoiMHhBMTE3OWY2NDYzOGFkYjYxM0REQUFjMzJEOTE4RUI2QkVCODI0MTA0IiwiZXhwaXJhdGlvbkRhdGUiOiIyMDI0LTA5LTE5VDEyOjIwOjE1LjY1N1oiLCJqdGkiOiIxNzI0MTU2NDE1NjU3LWFkNzYxNzMwOGQiLCJpYXQiOjE3MjQxNTY0MTUsImV4cCI6MTcyNjc0ODQxNX0.etoto_9s167GuYXxYh5Qomkr-Y0W_kRd6rICmpR-iKA' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36' \ -H 'content-type: application/json' \ -H 'accept: /' \ -H 'Referer: https://staging.giveth.io/' \ -H 'wallet-address: 0xa1179f64638adb613ddaac32d918eb6beb824104' \ -H 'sec-ch-ua-platform: "macOS"' \ --data-raw $'{"operationName":"GetDonationById","variables":{"id":267672},"query":"fragment DonationCoreFields on Donation {\n __typename\n id\n anonymous\n amount\n valueUsd\n currency\n transactionId\n transactionNetworkId\n chainType\n createdAt\n donationType\n status\n onramperId\n}\n\nquery GetDonationById($id: Int\u0021) {\n getDonationById(id: $id) {\n ...DonationCoreFields\n isTokenEligibleForGivback\n fromWalletAddress\n }\n}"}'

Response:

{"data":{"getDonationById":{"__typename":"Donation","id":"267672","anonymous":false,"amount":0.01,"valueUsd":0.00093387,"currency":"XLM","transactionId":"3aa70c5186376fec01319b3c360d6fd6f71a2101b4472e63d5818007b6400ab3","transactionNetworkId":1500,"chainType":"STELLAR","createdAt":"2024-08-19T13:42:01.252Z","donationType":null,"status":"verified","onramperId":null,"isTokenEligibleForGivback":true,"fromWalletAddress":"GCD5OLWDMUJQ6SGABRR34VCC3PZHU4FSSCZISOUR5JKQLET3WULSPWPY"}}}

maryjaf commented 3 months ago

and in UI it seems my user isn't signed in, but the authorization is set in header

It is related to the conversation we had this morning about not signed user and showing user id in donation table @Meriem-BM

maryjaf commented 3 months ago

Another example:

https://github.com/Giveth/giveth-dapps-v2/issues/4566#issuecomment-2316930721

Meriem-BM commented 3 months ago

This issue happens when someone donating at the same time with the same amount, so transactions mismatch. @maryjaf, @MoeNick

MoeNick commented 3 months ago

One solution to minimizing this error for logged-in users is checking the eth or sol address of the donor. 1- The donor creates a QR code so he will probably pay while logged on. 2- When we detect the transaction we can check on FE that if the payer is holding that jwt token with that address or not.

At least we can give priority to the donor and show an error to the second person to raise a ticket.

WDYT @Meriem-BM ?

MoeNick commented 3 months ago

We can release without this improvement IMO. And keep this discussion going later.

maryjaf commented 2 months ago

and in UI it seems my user isn't signed in, but the authorization is set in header

Based on this issue and sign out problem, I rename the title of issue

maryjaf commented 2 months ago

and this signed out problem makes this problem related to stellar donation:

Image

link of conversation in discord

@Meriem-BM @MoeNick cc: @divine-comedian @mohammadranjbarz since this is related to new limitation in donation flow

Meriem-BM commented 2 months ago

and this signed out problem makes this problem related to stellar donation:

  • I see my user isn't signed in on our Dapp, since the "sign in" button is shown
  • when I try to donate with stellar I got below an error and QR code isn't shown like as below pic
  • in the log this error is shown : Error: Donor can't create a draft to donate to his/her own project.\n but in UI it seems my user isn't signed in at all

Image

link of conversation in discord

@Meriem-BM @MoeNick cc: @divine-comedian @mohammadranjbarz since this is related to new limitation in donation flow

Can you test this @maryjaf

maryjaf commented 2 months ago
  • when I try to donate with stellar I got below an error and QR code isn't shown like as below pic
  • in the log this error is shown : Error: Donor can't create a draft to donate to his/her own project.\n but in UI it seems my user isn't signed in at all

It seems the problem related to showing QR code has been fixed

MoeNick commented 2 months ago

Yo hooo :)

Meriem-BM commented 2 months ago

One solution to minimizing this error for logged-in users is checking the eth or sol address of the donor. 1- The donor creates a QR code so he will probably pay while logged on. 2- When we detect the transaction we can check on FE that if the payer is holding that jwt token with that address or not.

At least we can give priority to the donor and show an error to the second person to raise a ticket.

WDYT @Meriem-BM ?

The problem is we need some attribute on the transaction response that we relieve from Stellar that tells this transaction belongs to this donation, like if we could add some meta data (draft donation id), but that's impossible it seems when I checked their docs.

Meriem-BM commented 2 months ago

Response example

{
        "_links": {
          "self": {
            "href": "https://horizon.stellar.org/operations/229043776898117633"
          },
          "transaction": {
            "href": "https://horizon.stellar.org/transactions/c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831"
          },
          "effects": {
            "href": "https://horizon.stellar.org/operations/229043776898117633/effects"
          },
          "succeeds": {
            "href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=229043776898117633"
          },
          "precedes": {
            "href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=229043776898117633"
          }
        },
        "id": "229043776898117633",
        "paging_token": "229043776898117633",
        "transaction_successful": true,
        "source_account": "GAH4LLWSXSWXBNMH5KG6T3DU2W7H4RVMTH63P2GRQ2VNLNYUUM6SKSJ4",
        "type": "payment",
        "type_i": 1,
        "created_at": "2024-09-03T13:00:08Z",
        "transaction_hash": "c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831",
        "transaction": {
          "_links": {
            "self": {
              "href": "https://horizon.stellar.org/transactions/c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831"
            },
            "account": {
              "href": "https://horizon.stellar.org/accounts/GAH4LLWSXSWXBNMH5KG6T3DU2W7H4RVMTH63P2GRQ2VNLNYUUM6SKSJ4"
            },
            "ledger": {
              "href": "https://horizon.stellar.org/ledgers/53328410"
            },
            "operations": {
              "href": "https://horizon.stellar.org/transactions/c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831/operations{?cursor,limit,order}",
              "templated": true
            },
            "effects": {
              "href": "https://horizon.stellar.org/transactions/c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831/effects{?cursor,limit,order}",
              "templated": true
            },
            "precedes": {
              "href": "https://horizon.stellar.org/transactions?order=asc\u0026cursor=229043776898117632"
            },
            "succeeds": {
              "href": "https://horizon.stellar.org/transactions?order=desc\u0026cursor=229043776898117632"
            },
            "transaction": {
              "href": "https://horizon.stellar.org/transactions/c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831"
            }
          },
          "id": "c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831",
          "paging_token": "229043776898117632",
          "successful": true,
          "hash": "c62f8396f209be93f9761817f34998a37ded4be8ba34231f0cecc3f115f35831",
          "ledger": 53328410,
          "created_at": "2024-09-03T13:00:08Z",
          "source_account": "GAH4LLWSXSWXBNMH5KG6T3DU2W7H4RVMTH63P2GRQ2VNLNYUUM6SKSJ4",
          "source_account_sequence": "159251434511018762",
          "fee_account": "GAH4LLWSXSWXBNMH5KG6T3DU2W7H4RVMTH63P2GRQ2VNLNYUUM6SKSJ4",
          "fee_charged": "100",
          "max_fee": "10000",
          "operation_count": 1,
          "envelope_xdr": "AAAAAgAAAAAPxa7SvK1wtYfqjensdNW+fkasmf236NGGqtW3FKM9JQAAJxACNcZWAAArCgAAAAEAAAAAAAAAAAAAAABm1wqpAAAAAAAAAAEAAAABAAAAAA/FrtK8rXC1h+qN6ex01b5+RqyZ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AAAAAAAAAwMts2MAAAAAAAAAAAaBKxoubFz0xV5MHOZA5ZU5W58JnYtJSvQRAJkitUB5AAAGtAyun1ECNtjnAAAlfQAAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAy2i5wAAAABm1oM1AAAAAAAAAAEDLboaAAAAAAAAAAAGgSsaLmxc9MVeTBzmQOWVOVufCZ2LSUr0EQCZIrVAeQAABrRTA/3tAjbY5wAAJX0AAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAMtoucAAAAAZtaDNQAAAAAAAAAAAAAAAA==",
          "fee_meta_xdr": "AAAAAgAAAAMDLbmfAAAAAAAAAAAPxa7SvK1wtYfqjensdNW+fkasmf236NGGqtW3FKM9JQAAAABMSz+cAjXGVgAAKwkAAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAMts2MAAAAAZtbh5QAAAAAAAAABAy26GgAAAAAAAAAAD8Wu0rytcLWH6o3p7HTVvn5GrJn9t+jRhqrVtxSjPSUAAAAATEs/OAI1xlYAACsJAAAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAADLbNjAAAAAGbW4eUAAAAA",
          "memo_type": "none",
          "signatures": [
            "+6cxMXcqGzgGsj647Ouwy1SKFnM3tjSQTI7cY+UdOLK08CFfMIuQrGAtR3bgNwKaeVMnmf6BmW84jDxrZSWzDw=="
          ],
          "valid_after": "1970-01-01T00:00:00Z",
          "valid_before": "2024-09-03T13:10:01Z",
          "preconditions": {
            "timebounds": {
              "min_time": "0",
              "max_time": "1725369001"
            }
          }
        },
        "asset_type": "native",
        "from": "GAH4LLWSXSWXBNMH5KG6T3DU2W7H4RVMTH63P2GRQ2VNLNYUUM6SKSJ4",
        "to": "GADICKY2FZWFZ5GFLZGBZZSA4WKTSW47BGOYWSKK6QIQBGJCWVAHTIV2",
        "amount": "117.9999900"
      },
MoeNick commented 2 months ago

No I mean no need to pass it to chain.

Im eth1 QR code generator and in my draft donation you can save who generated this donation. When you get a green light with chain, before updating the UI you can check on FE the jwt token of the user and find their eth-address, if the donation generator is the same as the user, you can upade the UI and give it a priority, if not, we can wait or save it with a flag as secondary donation. Hope it helps. @Meriem-BM

maryjaf commented 2 months ago

Since this issue was related to a sign-out problem and has been moved to "Done," it would be better if the conversation be conducted on the related issue.

Meriem-BM commented 2 months ago

No I mean no need to pass it to chain.

Im eth1 QR code generator and in my draft donation you can save who generated this donation. When you get a green light with chain, before updating the UI you can check on FE the jwt token of the user and find their eth-address, if the donation generator is the same as the user, you can upade the UI and give it a priority, if not, we can wait or save it with a flag as secondary donation. Hope it helps. @Meriem-BM

Got you, I think that won't be possible as we handle all that logic on BE, but I have an idea of saving secondary donation, is while the cron job does all that flow we can check if there is another transaction from same source wallet address, to same project address with same amount and before expiration date then save it as well.