英文:
Get Array of structs from custom smart contract deployed on Hedera
问题
假设我在 Hedera 测试网上部署了一个名为 X 的 Solidity 合同。我想要调用合同 X 上的一个函数,这个函数返回一个结构体数组...我应该如何解码这个结构体数组?(我正在使用 Hedera JS SDK 库中的 ContractCallQuery
函数来调用这个获取函数)参考链接:链接
英文:
Suppose I have a solidity contract deployed at address X in Hedera testnet. I want to call a function from the contract deployed at contract X a get function that returns an array of structs...how do I decode that array of structs? (I am using ContractCallQuery
function from the Hedera JS SDK library to call the get function) Ref: Link
答案1
得分: 1
SDKs支持"简单"数据类型,对于更复杂的类型,建议使用现有的web3库,如ethers.js、web3.js或abiDecoder。您可以在此处找到一些示例,虽然没有使用structs,但可以与SDK一起使用上述库:https://github.com/hashgraph/hedera-smart-contracts-libs-lab
英文:
the SDKs have support for "simple" data types, for more complex types, I suggest you use existing web3 libraries such as ethers.js, web3.js or abiDecoder.
You can find some examples here, not with structs, but using the above libraries alongside the SDK: https://github.com/hashgraph/hedera-smart-contracts-libs-lab
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论