[英]How can I query contract info with the latest polkadot-js and substrate contracts node?
I've been unable to query my existing contract recently due to Unable to create Enum via index 128, in Alive, Tombstone
when using api.query.contracts.contractInfoOf
.由于使用
api.query.contracts.contractInfoOf
时Unable to create Enum via index 128, in Alive, Tombstone
我最近无法查询我现有的合同。 I get this error both on the command line and in the polkadot-js apps explorer.我在命令行和 polkadot-js 应用程序资源管理器中都收到此错误。
These are the steps I took:这些是我采取的步骤:
salt
salt
部署合约deployedAddress
deployedAddress
contractInfoOf
contractInfoOf
const contractInfo = await api.query.contracts.contractInfoOf(deployedAddress);
I've tried downgrading ink!
我试过降级
ink!
to 3.0-rc5
, 3.0-rc4
, 3.0-rc3
and then compiling but it doesn't seem to make any difference.到
3.0-rc5
、 3.0-rc4
、 3.0-rc3
然后编译但它似乎没有任何区别。 Whenever my contract is built it references rc6
at the top:每当我的合约建立时,它都会在顶部引用
rc6
:
{"metadataVersion":"0.1.0","source":{"hash":"0x...","language":"ink! 3.0.0-rc6","compiler":"rustc 1.58.0-nightly",
Which suggests its ignoring my .toml
and using rc6
to compile the contract.这表明其无视我的
.toml
并使用rc6
编译合同。
I changed my cargo-contract
version to 0.14
but that causes polkadot-js to fail at reading the contract abi.我将我的
cargo-contract
版本更改为0.14
但这导致 polkadot-js 无法读取合同 abi。
I've tried using the substrate-contracts-node using the latest commit from master and also using the v0.1.0
release.我已经尝试使用来自 master 的最新提交并使用
v0.1.0
版本使用基板合同节点。 Same error in both cases.在这两种情况下相同的错误。
> rustup info
stable-x86_64-unknown-linux-gnu (default)
rustc 1.56.1 (59eed8a2a 2021-11-01)
There are more details in an issue on polkadot-js . polkadot-js 上的问题中有更多详细信息。
Any pointers on how to get a working setup would be very helpful!关于如何获得工作设置的任何指示都会非常有帮助!
The problem here was substrate-contracts-node
using an old version of the metadata .这里的问题是使用 旧版本元数据的
substrate-contracts-node
。
I was able to check out the repo before the metadata merge was reverted and build locally ( cargo build
).我能够在元数据合并被恢复并在本地构建(
cargo build
)之前检查存储库。
So checkout 8d91b8e to get it the node to work with versions 7.7.1
and 6.6.1
of polkadot-js packages.因此,请检查8d91b8e以使其成为与 polkadot-js 包的
7.7.1
和6.6.1
版一起使用的节点。
> git checkout 8d91b8e578065a7c06433cbd41ac059bf478a0bd
> cargo build
> ./target/debug/substrate-contracts-node --dev --tmp --version
substrate-contracts-node 0.1.0-8d91b8e-x86_64-linux-gnu
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.