Skip to content

Commit

Permalink
update example in README
Browse files Browse the repository at this point in the history
fix #9
  • Loading branch information
qftgtr committed Oct 23, 2020
1 parent 40e7daf commit c8edecc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ An Algorand transaction can consist of a list of individual parts, known as *ato

To be able to perform the signing process, you need to provide a `keys.json` file of the following format. Be careful that all private information here is saved in plain text so **DO NOT USE THEM ON MAINNET**.

#### Algorand smart contract

We provided an example project to demostrate how to use this extension to work on Algorand smart contract.

1. Open the `example` as the project root folder;
2. Open the file `main.py` and press `Cmd+Shift+B` to compile the PyTeal script to TEAL. A file of name `main.teal` will be generated;
3. Open the file `main.teal` and press `Cmd+Shift+B` to compile the TEAL script;
4. Open the *Algorand Panel* and start an Algorand node. Make sure the node has synced with the network;
5. Import the transaction by selecting the file `txns/call_contract.json`;
6. Click the *Push Transaction* button to push the transaction

``` js
[
{
Expand All @@ -79,6 +90,7 @@ When finished, click the *Push Transaction* button, confirm and send the transac
```
.
├── package.json // The extension manifest.
├── example // example project with transaction objects
├── client
│ ├── src
│ │ ├── view // The frontend for Algorand Panel (React)
Expand Down
12 changes: 6 additions & 6 deletions example/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from pyteal import *

#template variables
tmpl_amt = Int(1000000)
tmpl_rcv = Addr("IRSQTDADXKRE66ZIDODB4EENNOBOS2YW4NYZV6QZGUAAWIMN3JCAPTS5DY") # paste a receiver address
tmpl_amt = Int(1000000) # equals 1 ALGO
tmpl_rcv = Addr("IRSQTDADXKRE66ZIDODB4EENNOBOS2YW4NYZV6QZGUAAWIMN3JCAPTS5DY")
tmpl_cls = Addr("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ")
tmpl_fv = Int(8000000)
tmpl_lv = Int(8888888)
tmpl_lease = Bytes("base64", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=")
# tmpl_fv = Int(8000000)
# tmpl_lv = Int(8888888)
# tmpl_lease = Bytes("base64", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=")

def dynamic_fee(tmpl_amt=tmpl_amt,
tmpl_rcv=tmpl_rcv,
Expand All @@ -27,7 +27,7 @@ def dynamic_fee(tmpl_amt=tmpl_amt,
Txn.close_remainder_to() == tmpl_cls,
# Txn.first_valid() == tmpl_fv,
# Txn.last_valid() == tmpl_lv,
Txn.lease() == tmpl_lease
# Txn.lease() == tmpl_lease
)

return dynamic_fee_core
Expand Down
3 changes: 1 addition & 2 deletions example/txns/call_contract.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"params": {
"from": "LEK4LPP5IRJDRDQIXFTWLBWPJXJGBHW23FB4KP2LBONW6JMWTLN4GMKCMM",
"to": "IRSQTDADXKRE66ZIDODB4EENNOBOS2YW4NYZV6QZGUAAWIMN3JCAPTS5DY",
"amount": 1,
"lease": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE="
"amount": 1
},
"flatFee": true,
"lsig": {
Expand Down

0 comments on commit c8edecc

Please sign in to comment.