js-stellar-sdk icon indicating copy to clipboard operation
js-stellar-sdk copied to clipboard

Cannot destructure property 'length' of 'e' as it is undefined.

Open jeesunikim opened this issue 11 months ago • 2 comments

Describe the bug I tested contract.Client.from with three contracts on TESTNET. It worked fine until I tested XLM contract on TESTNET CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC. It failed with Cannot destructure property 'length' of 'e' as it is undefined. error. Perhaps, this isn't supposed to work with XLM contract; however, if that's the case we need to update the documentation with a different contract.

const client = contract.Client.from({
      contractId,
      networkPassphrase,
      rpcUrl,
    });

What version are you on? "@stellar/stellar-sdk": "^13.1.0"

To Reproduce Steps to reproduce the behavior: call XLM contract CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC with contract.Client.from function, open a console, and you'll see an error.

Expected behavior I expected it to return response that includes entries

Additional context Image

jeesunikim avatar Jan 22 '25 22:01 jeesunikim

It's because that is a host function not a contract... you can build a spec for the SAC manually if you want

silence48 avatar Jan 28 '25 03:01 silence48

oh also that's an async method i think try to await it.

silence48 avatar Feb 06 '25 14:02 silence48

Closing in favor of https://github.com/stellar/js-stellar-sdk/issues/1166 which is a dupe

Shaptic avatar Oct 01 '25 17:10 Shaptic