👋 I'm trying to get a contract spec using js-soroban-client but I'm not sure how.
First I tried following this guide: https://soroban.stellar.org/api/methods/getLedgerEntries#requesting-a-contracts-wasm-code
And I ended with this:
`server.getLedgerEntries(hash).then((response) => {
const entry = response.entries?.[0];
const wasmLedgerKey = getLedgerKeyWasmId(entry.xdr);
server.getLedgerEntries(wasmLedgerKey).then((response) => {
const entry = response.entries?.[0];
const entryData = xdr.LedgerEntryData.fromXDR(entry.xdr, "base64");
const contractCode = entryData.contractCode().code().toString();
console.log(contractCode);
});
});`
But I'm not sure if I'm in the correct path, or how to generate it from the contractCode. I see in the docs ContractSpec that I may need to use scValToNative but I'm not sure how would that work. I also know that I get the contractspecv0 but again I'm not sure how to read it properly.
I would like to have something similar to the CLI version of soroban contract inspect but without the need of having the wasm file. For example to get the list of available functions from the contract id.
Thanks for your help!