Giter VIP home page Giter VIP logo

lorentz-contract-view's People

Contributors

michaeljklein avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

lorentz-contract-view's Issues

Warnings when building the package

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

[..]

Error when running `tz-view` with `babylonnet.sh client`

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)

Hard-coded FA12 address

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.