2

Trying to retrieve contract entry points using the TezosContractIntrospector

The following code:

async function entry_points(){
  const server={
    url:'https://conseil-dev.cryptonomic-infra.tech:443',
    apiKey:'foo',
    network:'babylonnet
  };
  const contractAddress='KT1WRUe3csC1jiThN9KUtaji2bd412upfn1E';
  const result=await conseiljs.TezosContractIntrospector.generateEntryPointsFromAddress(
    server,
    server['network'],
    contractAddress
  );
}

attempts to interact with the deployed contract from a medium post but results in the error:

conseiljs.min.js:2 Uncaught (in promise) TypeError: Cannot read property '0' of undefined
  at Object.<anonymous> (conseiljs.min.js:2)
  at Generator.next (<anonymous>)
  at o (conseiljs.min.js:2)

If typeof is used:

console.log(typeof(
  conseiljs.TezosContractIntrospector.generateEntryPointsFromAddress(
    server,
    server['network'],
    contractAddress
  )
);

it is of type object but I am unsure how to handle it.

I wish to find the entry points of a contract to use it to sendContractInvocationOperation

Any help is much appreciated

6
  • Fyi not sure abt conseiljs but entry points are available here smartpy.io/test2/…
    – Ezy
    Jan 13, 2020 at 3:55
  • Thanks for this @Ezy. Could you provide any more information about doing this? I followed your link but I'm not sure what I am looking at. I was hoping to return Michelson for use in the function sendContractInvocationOperation which requires both an entry point and parameters. Where would I find this information via your linked page? Thanks Jan 13, 2020 at 11:25
  • If you open smartpy.io/dev/… (same as test2 but will be supported longer as it is SmartPy's official dev release and test2 was only used for this release) you can look at the bottom of the page. You'll see three tabs including Parameter Type. Bad news: this contract has two annoying features: - it has no annotation so you have to determine on your own what does what - it has a little 'do' extra entry point which was used as an automatic conversion in Babylon for removed operations. I think ConseilJS fails on those.
    – FFF
    Jan 13, 2020 at 21:23
  • Hi @FFF, I don't suppose you could provide any insight into how that can be used for the ConseilJS function? I made a pastebin that includes the content from the parameter tab you linked. Thanks Jan 13, 2020 at 23:10
  • @macourtney7, I must admit that I simply don't know if you can use the introspector of ConseilJS on these contracts.
    – FFF
    Jan 14, 2020 at 1:39

1 Answer 1

0

The function preprocesses input and eventually passes to generateEntryPointsFromParams

Due to the issues encountered with generateEntryPointsFromAddress I used the following workaround:

async function foo(contract_params){
  const entry_points=await 
    conseiljs.TezosContractIntrospector.generateEntryPointsFromParams(contract_params);
  console.table(entry_points);
}

This will display the entry points. Which is the desired results.

Parameters can usually be easily retrieved (for example, from an online explorer).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.