tqtezos / lorentz-contract-view Goto Github PK
View Code? Open in Web Editor NEWAccess Michelson Contract View parameters without paying gas
License: BSD 3-Clause "New" or "Revised" License
Access Michelson Contract View parameters without paying gas
License: BSD 3-Clause "New" or "Revised" License
There is a hot fix for a morley
but with sed
:
sed 's/(pair address unit) (pair address unit)/(pair address unit) (pair (list operation) unit)/'
But the bug should be fixed in https://gitlab.com/morley-framework/morley/merge_requests/184
The package build with Stack versions 1.9.3 (on Ubuntu) and 1.9.1 (on Debian), but there are some warnings:
$ stack build
Warning: [..]/lorentz-contract-view/package.yaml: Duplicate field $.copyright
Warning: [..]/lorentz-contract-view/package.yaml: Duplicate field $.maintainer
Warning: [..]/lorentz-contract-view/package.yaml: Duplicate field $.author
Warning: [..]/lorentz-contract-view/package.yaml: Duplicate field $.license
[..]
Thank you for lorentz-contract-view. It looks very useful, but I ran into some trouble when using the Ruby script. I am not sure if what I am doing (using babylonnet.sh client
instead of tezos-client
) is meant to be supported. Apologies if it is not!
I added these in my ~/.profile
:
export EXECLAMBDA_ADDRESS="KT1..."
export FA12_ADDRESS="KT1..."
export ALICE_ADDRESS="tz1..."
alias tz-view="/home/sajith/code/lorentz-contract-view.rb \
'/usr/local/bin/babylonnet.sh client' \
$EXECLAMBDA_ADDRESS $ALICE_ADDRESS"
And ran:
$ tz-view $FA12_ADDRESS 'getTotalSupply' 'Unit'
And it resulted in:
Running:
TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=yes /usr/local/bin/babylonnet.sh client get contract entrypoints for KT1..AQ
Entrypoints for contract KT1..AQ:
default: (or (or (or (pair %transfer address (pair address nat))
(or (pair %transferViaProxy address (pair address (pair address nat)))
" (or (pair %transferViaProxy address (pair address (pair address nat)))"
/home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:78:in `block in get_entrypoints': Expected all but the first line to match: /^\s*(?<entrypoint_name>\w+):\s+(?<entrypoint_type>.*)$/, but found: (or (pair %transferViaProxy address (pair address (pair address nat))) (RuntimeError)
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:115:in `each'
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:115:in `each'
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:115:in `to_h'
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:115:in `get_entrypoints'
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:121:in `get_view_entrypoints'
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:129:in `get_typed_lambda_params'
from /home/sajith/code/lorentz-contract-view/lorentz-contract-view.rb:173:in `<main>'
To me it looks like the script is not set up to handle output from babylonnet.sh client
: it contains a default
entrypoint with a multi-line value.
This is what I get when running babylonnet.sh client get contract entrypoints for $FA12_ADDRESS
:
$ TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=yes /usr/local/bin/babylonnet.sh client get contract entrypoints for $FA12_ADDRESS
Entrypoints for contract KT1..AQ:
default: (or (or (or (pair %transfer address (pair address nat))
(or (pair %transferViaProxy address (pair address (pair address nat)))
(pair %approve address nat)))
(or (pair %approveViaProxy address (pair address nat))
(or (pair %getAllowance (pair address address) (contract nat))
(pair %getBalance address (contract nat)))))
(or (or (pair %getTotalSupply unit (contract nat))
(or (bool %setPause) (address %setAdministrator)))
(or (or (pair %getAdministrator unit (contract address)) (pair %mint address nat))
(or (pair %burn address nat) (address %setProxy)))))
transferViaProxy: (pair address (pair address (pair address nat)))
transfer: (pair address (pair address nat))
setProxy: address
setPause: bool
setAdministrator: address
mint: (pair address nat)
getTotalSupply: (pair unit (contract nat))
getBalance: (pair address (contract nat))
getAllowance: (pair (pair address address) (contract nat))
getAdministrator: (pair unit (contract address))
burn: (pair address nat)
approveViaProxy: (pair address (pair address nat))
approve: (pair address nat)
Prior to reporting #2, I had to edit lorentz-contract-view.rb
to use my own contract address, because the address KT1RUhPAABRhZBctcsWFtymyjpuBQdLTqaAQ
is hard-coded in the function fa121_address()
.
Running the script with the original code results in:
$ echo $FA12_ADDRESS
KT19mhvS4xjZoVgwLkV87KchZGMnVBEztqPQ
$ tz-view $FA12_ADDRESS 'getTotalSupply' 'Unit'
Running:
TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=yes /usr/local/bin/babylonnet.sh client get contract entrypoints for KT1RUhPAABRhZBctcsWFtymyjpuBQdLTqaAQ
babylonnet: Pulling from tezos/tezos
[..]/lorentz-contract-view/lorentz-contract-view.rb:66:in `get_entrypoints': Expected the first line to match: /^\s*Entrypoints for contract KT1RUhPAABRhZBctcsWFtymyjpuBQdLTqaAQ:\s*$/, but found: (RuntimeError)
"babylonnet: Pulling from tezos/tezos"
from [..]/lorentz-contract-view/lorentz-contract-view.rb:115:in `get_entrypoints'
from [..]/lorentz-contract-view/lorentz-contract-view.rb:121:in `get_view_entrypoints'
from [..]/lorentz-contract-view/lorentz-contract-view.rb:129:in `get_typed_lambda_params'
from [..]/lorentz-contract-view/lorentz-contract-view.rb:173:in `<main>'
Here's how I set up tz-view
alias:
alias tz-view="[..]/lorentz-contract-view/lorentz-contract-view.rb \
'/usr/local/bin/babylonnet.sh client' \
$EXECLAMBDA_ADDRESS $ALICE_ADDRESS"
I believe I have correctly set up $EXECLAMBDA_ADDRESS
:
$ babylonnet.sh client get contract code for $EXECLAMBDA_ADDRESS
{ parameter (lambda unit (pair (list operation) unit)) ;
storage unit ;
code { CAR ; UNIT ; EXEC }
}
It would be nice if the contract address could be parameterized.
Add a reference to the Mainnet origination of the ExecLambda
contract: https://better-call.dev/mainnet/KT1CPuTzwC7h7uLXd5WQmpMFso1HxrLBUtpE/code
README asks to "See quick_start.md" right on top, but the file is missing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.