从部署在 Hedera 上的自定义智能合同中获取结构数组

huangapple go评论53阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年2月18日 12:56:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75491282.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定