Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErgoPay support #35

Open
MrStahlfelge opened this issue Aug 15, 2022 · 1 comment
Open

ErgoPay support #35

MrStahlfelge opened this issue Aug 15, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@MrStahlfelge
Copy link

Add method to web dapp connector:

 Eip12Connection.invokeErgoPay(ergoPayUrl: string, completionHandler: function)
 // invokes an EIP-20 ErgoPay request

completionHandler is called when the user completes the ErgoPay request by submitting a transaction. If the user cancels, it is not called (therefore a Promise is not correct to use).

The request is successful without having an Eip12Connection established before (isConnected() may result to false) as it is not necessary. An ErgoPay request might be bound to a different connection or (if it does not result in a reduced transaction to sign) might not need a wallet connection at all.

When invokeErgoPay called, the following actions are performed:

  1. Static ErgoPay request (ergopay:<reducedTx>)
    User can select the wallet to sign. ReducedTx is shown (inputboxes and outputboxes) for the user to confirm. The inputboxes must be fetched from the blockchain in order to check if tokens might be burned.
    On confirmation, the tx is signed and submitted and in case of success the completionHandler is called.

  2. Dynamic ErgoPay request(ergopay://<url>)
    If url contains "#P2PK_ADDRESS#": show the user a choose dialog for a wallet and wallet address. When user made their choice, proceed.
    Fetch data from https://url (or http://url for local addresses) and process the response as outlined in EIP-20. If the response contains a reduced transaction, show it as outlined in 1)
    If the response data contains no address information and the user did not already choose the wallet to use, it is now needed to choose a wallet to sign with. If address information is provided or the user already made a choice, do not prompt again.
    When a signed transaction is submitted, completionHandler is called. It is not called when there was no reduced transaction in the response.

@lommaj
Copy link

lommaj commented Nov 6, 2022

Bump!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants