@cryptape/cita-sdk invalid address

使用javascript cita-js,@cryptape/cita-sdk 在传入address时,一直提示 invalid address错误。
合约代码:
function setAllowAccess(address key, bool val) public isOwner {
AllowAccess[key] = val;
}

js测试代码:
const addr = “0x8457e14AEb0019963cC3ebD5d575144D2a5A779c”;
const tx = {
…transaction,
validUntilBlock: +blockNum,
}
return contract.methods.setAllowAccess(addr, true).send(tx);

错误信息:
{ Error: invalid address (arg=“key”, coderType=“address”, value=“0x8457e14AEb0019963cC3ebD5d575144D2a5A779c”)
at Object.throwError (/root/cita-truffle-box/node_modules/ethers/utils/errors.js:68:17)
at CoderAddress.encode (/root/cita-truffle-box/node_modules/ethers/utils/abi-coder.js:467:20)
at /root/cita-truffle-box/node_modules/ethers/utils/abi-coder.js:605:59
at Array.forEach ()
at pack (/root/cita-truffle-box/node_modules/ethers/utils/abi-coder.js:604:12)
at CoderTuple.encode (/root/cita-truffle-box/node_modules/ethers/utils/abi-coder.js:764:16)
at AbiCoder.encode (/root/cita-truffle-box/node_modules/ethers/utils/abi-coder.js:897:77)
at ABICoder.encodeParameters (/root/cita-truffle-box/node_modules/web3-eth-abi/src/index.js:96:27)
at /root/cita-truffle-box/node_modules/web3-eth-contract/src/index.js:426:24
at Array.map ()
at Object._encodeMethodABI (/root/cita-truffle-box/node_modules/web3-eth-contract/src/index.js:425:12)
at Object._processExecuteArguments (/root/cita-truffle-box/node_modules/web3-eth-contract/src/index.js:741:39)
at Object._executeMethod (/root/cita-truffle-box/node_modules/@cryptape/cita-sdk/lib/contract/index.js:35:54)
at citaSDK.base.getBlockNumber.then.then.then.contract (/root/cita-truffle-box/kuajingTest.js:42:56)
at process._tickCallback (internal/process/next_tick.js:68:7)
reason: ‘invalid address’,
code: ‘INVALID_ARGUMENT’,
arg: ‘key’,
coderType: ‘address’,
value: ‘0x8457e14AEb0019963cC3ebD5d575144D2a5A779c’ }

是不是 address 不用 引号, 或者不用加 0x?
@ChenYu, 你知道这个原因吗?

不加引号,不加0x, 补全64位都试过了,都不对

“0x8457e14AEb0019963cC3ebD5d575144D2a5A779c” 不是合法地址, checksum 检查出错了, 你可以转换成全部都小写的地址来跳过 checksum 检查.

改成小写就可以了,为什么在truffle的测试中不存在这种问题,以太坊地址不是不存在大小写问题吗?有没有checksum检查的工具给推荐一个:grin:

truffle 测试中不检测 checksum 的情况我没有了解过, 但是现在对 checksum 做校验是推荐的, 以太坊地址如果存在大小写也会做校验.

校验方法很简单, 在 SDK 的 utils 里有个方法 cita.utils.isAddress 可以用来校验地址合法性