<p>The only way to read a state of the smart contract is using a contract instance status endpoint (<code>api/contract/instance/$INSTANCE_ID/status</code>). Other endpoints can only trigger a change of the state but they cannot return it so it's always a two step process.</p>

CC BY-SA 4.0
2021-12-10T07:48:46.050Z
This does not really answer my question.
I do already know how to read the different states. My question was why it is designed like this.
It even contradicts completely the functional approach of Haskell Language.
Marco Jakob
CC BY-SA 4.0
2021-12-08T11:14:53.307Z
2021-12-08T11:14:53.307Z
sorki
<p>In Lecture 10 from the Plutus Pioneer Programm there is a replica of the Uniswap Smart Contract built on top of Plutus. It is actually part of the standard Plutus use cases <a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-use-cases/html/Plutus-Contracts-Uniswap.html" rel="nofollow noreferrer">Plutus Uniswap</a></p>
<p>To have a better user experience and to get to know it better i wanted to build a GUI around it. <em>If you are interested you can find it <a href="https://github.com/toky03/uniswap-plutus-demo" rel="nofollow noreferrer">in this github repo</a></em></p>
<p>Now to my question.
What is the reason behind the design decision for the Status endpoint of the Plutus PAB Rest API.
In order to read the funds we have <strong>first</strong> to call the funds Endpoint which returns nothing and <strong>secondly</strong> you have to call the status endpoint.</p>
<blockquote>
<p>This is the <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/second-iteration/code/week06/app/swap-client.hs#L55-L73" rel="nofollow noreferrer"><em>Frontend</em> Code from Lars</a> where he reads the funds</p>
</blockquote>
<p>This makes it very difficult if you want to have concurrent calls one for the funds and one for the pools</p>
<p>Why is there not a dedicated status endpoint for funds and pools?</p>

CC BY-SA 4.0
2022-01-07T12:22:06.570Z
This got me wondering too. I posted a question but never got any answer: https://cardano.stackexchange.com/questions/4908/user-interaction-with-smart-contracts  It seems, the Plutus team is not active on this forum.
Jey
CC BY-SA 4.0
2022-01-08T07:28:36.573Z
I just registered for the third cohort of the ppp. There i will ask this Question in the Q&A session. As soon as i know more i will post it here.
Marco Jakob
CC BY-SA 4.0
2022-01-08T11:05:48.017Z
Great, I'm looking forward. I am not participating in the cohort, but I would have a lot of questions.
Jey
CC BY-SA 4.0
2022-01-30T15:56:11.030Z
the link to frontend code is broken, can you please update?
LexTRX
CC BY-SA 4.0
2022-01-31T16:56:40.103Z
Thank you @LexTRX it is updated now
Marco Jakob
<plutus><smart-contract><plutus-pioneer-program>
Questioning Plutus API design decision
# Questioning Plutus API design decision

(Asked by: username_0 on 2021-11-18)

In Lecture 10 from the Plutus Pioneer Programm there is a replica of the Uniswap Smart Contract built on top of Plutus. It is actually part of the standard Plutus use cases [Plutus Uniswap](https://playground.plutus.iohkdev.io/doc/haddock/plutus-use-cases/html/Plutus-Contracts-Uniswap.html)

To have a better user experience and to get to know it better i wanted to build a GUI around it. *If you are interested you can find it [in this github repo](https://github.com/toky03/uniswap-plutus-demo)*

Now to my question.
What is the reason behind the design decision for the Status endpoint of the Plutus PAB Rest API.
In order to read the funds we have **first** to call the funds Endpoint which returns nothing and **secondly** you have to call the status endpoint.

> This is the [*Frontend* Code from Lars](https://github.com/input-output-hk/plutus-pioneer-program/blob/second-iteration/code/week06/app/swap-client.hs#L55-L73) where he reads the funds

This makes it very difficult if you want to have concurrent calls one for the funds and one for the pools

Why is there not a dedicated status endpoint for funds and pools?

**Tags:** plutus, smart-contract, plutus-pioneer-program
> **Comments:**
> **username_1**: This got me wondering too. I posted a question but never got any answer: https://cardano.stackexchange.com/questions/4908/user-interaction-with-smart-contracts  It seems, the Plutus team is not active on this forum.  
> **username_0**: I just registered for the third cohort of the ppp. There i will ask this Question in the Q&A session. As soon as i know more i will post it here.  
> **username_1**: Great, I'm looking forward. I am not participating in the cohort, but I would have a lot of questions.  
> **username_2**: the link to frontend code is broken, can you please update?  
> **username_0**: Thank you @LexTRX it is updated now  

---

## 1 answers

### Answer by username_3 on 2021-12-08. Score: -2

The only way to read a state of the smart contract is using a contract instance status endpoint (`api/contract/instance/$INSTANCE_ID/status`). Other endpoints can only trigger a change of the state but they cannot return it so it's always a two step process.

> **Comments:**
> **username_0**: This does not really answer my question. I do already know how to read the different states. My question was why it is designed like this. It even contradicts completely the functional approach of Haskell Language.  

---

