diff --git a/README.md b/README.md index aebad3f..d155e61 100644 --- a/README.md +++ b/README.md @@ -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 [ { @@ -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) diff --git a/example/main.py b/example/main.py index a18dd3d..b727f61 100644 --- a/example/main.py +++ b/example/main.py @@ -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, @@ -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 diff --git a/example/txns/call_contract.json b/example/txns/call_contract.json index 0a4c6c6..2c55127 100644 --- a/example/txns/call_contract.json +++ b/example/txns/call_contract.json @@ -15,8 +15,7 @@ "params": { "from": "LEK4LPP5IRJDRDQIXFTWLBWPJXJGBHW23FB4KP2LBONW6JMWTLN4GMKCMM", "to": "IRSQTDADXKRE66ZIDODB4EENNOBOS2YW4NYZV6QZGUAAWIMN3JCAPTS5DY", - "amount": 1, - "lease": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE=" + "amount": 1 }, "flatFee": true, "lsig": {