Conflux-Chain / python-conflux-sdk

Conflux Python SDK
https://python-conflux-sdk.readthedocs.io/en/latest/
14 stars 3 forks source link

关于包含evm地址的请求参数 #24

Closed iteh3712198 closed 11 months ago

iteh3712198 commented 11 months ago

我在调用confluxhub的跨链桥的的crossToEvm方法时,直接填写evm地址会报错 Could not identify the intended function with name crossToEvm, positional arguments with type(s) str,address,int and keyword arguments with type(s) {}. Found 1 function(s) with the name crossToEvm: ['crossToEvm(address,address,uint256)'] Function invocation failed due to no matching argument types. 请问应该对如何填写参数才能正常调用呢?类似下图第二个evm地址直接填就无法调用,是要转换格式吗? image

darwintree commented 11 months ago

这里需要编码为base32格式。

from conflux_web3 import Web3
w3 = Web3(...)
evmAddress = "0x6808c7cf650c88c63273544695076f90339e1515"
base32EvmAddress = w3.address(evmAddress, _ignore_invalid_type=True)
...
darwintree commented 11 months ago

address相关的文档参考

  1. https://python-conflux-sdk.readthedocs.io/en/latest/examples/02-address_account_and_wallet.html (包含了主要的用法)
  2. https://conflux-fans.github.io/cfx-address/cfx_address.html#module-cfx_address(详细的文档
iteh3712198 commented 11 months ago

感谢,暂时先用了直接用原始数据调用的方法,还没有试过你这个,不过还是感谢解答