<p>It appears you are trying to assign a type of <code>Promise</code> to a type of <code>Contract</code></p>
<pre><code>contract :: AsContractError e =&gt; Contract () Schema e ()
contract = storeFront
</code></pre>
<p>Why not try this, instead:</p>
<pre><code>contract :: AsContractError e =&gt; Contract () Schema e ()
contract = awaitPromise storeFront
</code></pre>

CC BY-SA 4.0
2022-01-11T11:48:29.840Z
2022-01-11T11:48:29.840Z
Aoaddeola
<p>I cant seem to figure out whats going on? Ive been trying to create a transaction which sends ADA to a specified wallet address and can't seem to get it to work.</p>
<pre><code>type Schema =
        Endpoint &quot;storeFront&quot; PaymentPubKeyHash

payPubHash :: PaymentPubKeyHash
payPubHash = &quot;3f7846896a48c59359746ff096d63606ceb82e65900d20a9fd2b8a93&quot;

storeFront :: AsContractError e =&gt; Promise () Schema e ()
storeFront = endpoint @&quot;storeFront&quot; $ \(payPubHash) -&gt; do
    unspentOutputs &lt;-  utxosAt contractAddress
    
    let 
        tx       = Constraints.mustPayToPubKey payPubHash (singleton adaSymbol adaToken 30000000) 
    void $ submitTxConstraintsSpending storeContract unspentOutputs tx
        
contract :: AsContractError e =&gt; Contract () Schema e ()
contract = storeFront

endpoints :: AsContractError e =&gt; Contract () Schema e ()
endpoints = contract

mkSchemaDefinitions ''Schema

$(mkKnownCurrencies [])
</code></pre>
<p>here's the error</p>
<pre><code>Compilation Error, Line 93, Column 12 (jump)

 error:
    • Couldn't match expected type ‘Contract () Schema e ()’
                  with actual type ‘Promise () Schema e0 ()’
    • In the expression: storeFront
      In an equation for ‘contract’: contract = storeFront
    • Relevant bindings include
        contract :: Contract () Schema e ()
          (bound at /tmp/web-ghc-work-c17f548fe0e3f9c3/Main.hs:93:1)
   |
93 | contract = storeFront
   |            ^^^^^^^^^^
</code></pre>

<plutus><smart-contract><plutus-pioneer-program><error>
Need Help finding error in my endpoint code
# Need Help finding error in my endpoint code

(Asked by: username_0 on 2022-01-10)

I cant seem to figure out whats going on? Ive been trying to create a transaction which sends ADA to a specified wallet address and can't seem to get it to work.
type Schema =
        Endpoint "storeFront" PaymentPubKeyHash

payPubHash :: PaymentPubKeyHash
payPubHash = "3f7846896a48c59359746ff096d63606ceb82e65900d20a9fd2b8a93"

storeFront :: AsContractError e => Promise () Schema e ()
storeFront = endpoint @"storeFront" $ \(payPubHash) -> do
    unspentOutputs <-  utxosAt contractAddress
    
    let 
        tx       = Constraints.mustPayToPubKey payPubHash (singleton adaSymbol adaToken 30000000) 
    void $ submitTxConstraintsSpending storeContract unspentOutputs tx
        
contract :: AsContractError e => Contract () Schema e ()
contract = storeFront

endpoints :: AsContractError e => Contract () Schema e ()
endpoints = contract

mkSchemaDefinitions ''Schema

$(mkKnownCurrencies [])

here's the error
Compilation Error, Line 93, Column 12 (jump)

 error:
    • Couldn't match expected type ‘Contract () Schema e ()’
                  with actual type ‘Promise () Schema e0 ()’
    • In the expression: storeFront
      In an equation for ‘contract’: contract = storeFront
    • Relevant bindings include
        contract :: Contract () Schema e ()
          (bound at /tmp/web-ghc-work-c17f548fe0e3f9c3/Main.hs:93:1)
   |
93 | contract = storeFront
   |            ^^^^^^^^^^

**Tags:** plutus, smart-contract, plutus-pioneer-program, error

---

## 1 answers

### Answer by username_1 on 2022-01-11. Score: 2

It appears you are trying to assign a type of Promise to a type of Contract
contract :: AsContractError e => Contract () Schema e ()
contract = storeFront

Why not try this, instead:
contract :: AsContractError e => Contract () Schema e ()
contract = awaitPromise storeFront


---

