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

Offchain implementation of SmartToken contracts #13

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

amirmrad
Copy link
Collaborator

No description provided.

@j-mueller
Copy link
Collaborator

We can use the following pattern when implementing the REST endpoints

  • Always take the user's payment credential as a parameter
  • Construct the BuildTxEnv era by looking up the user's UTxOs
  • Run the ReaderT (BuildTxEnv era) m stack using blockfrost as the backend for MonadBlockchain and MonadUtxoQuery
  • Return the transaction to the caller. The transaction is fully balanced but has no signatures.

This is pretty similar to how we do it for user-facing transactions in Djed, and that way we don't actually submit any transactions from the backend, we can leave all this to the frontend (adding sigs and sending to network).

@j-mueller
Copy link
Collaborator

@amirmrad I reworked the "Env" file a little, mainly to make it easier to add environments to the overall Reader type. I also implemented two server routes, a query and a "build tx" one.

I'm trying to keep the server endpoints as small as possible. They should just set up the OperatorEnv if needed and then call the corresponding function in Wst.Offchain.Endpoints. See for example the definition of issueProgrammableTokenEndpoint

@j-mueller j-mueller linked an issue Dec 23, 2024 that may be closed by this pull request
3 tasks
@j-mueller j-mueller marked this pull request as ready for review December 23, 2024 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProtocolParams endpoint
2 participants