本文整理汇总了TypeScript中ethers.ethers.utils.solidityKeccak256方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ethers.utils.solidityKeccak256方法的具体用法?TypeScript ethers.utils.solidityKeccak256怎么用?TypeScript ethers.utils.solidityKeccak256使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ethers.ethers.utils
的用法示例。
在下文中一共展示了ethers.utils.solidityKeccak256方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const makeCondition = (expectedValue, parameters, onlyCheckForSuccess) => ({
onlyCheckForSuccess,
parameters,
expectedValueHash: ethers.utils.solidityKeccak256(
["bytes"],
[expectedValue]
),
selector: example.interface.functions.isSatisfiedNoParam.sighash,
to: example.address
});
示例2:
const makeConditionParam = (expectedValue, parameters) => ({
parameters,
expectedValueHash: ethers.utils.solidityKeccak256(
["bytes"],
[expectedValue]
),
onlyCheckForSuccess: false,
selector: testCondition.interface.functions.isSatisfiedParam.sighash,
to: testCondition.address
});
示例3: validateSetupInfos
function validateSetupInfos(infos: cf.legacy.channel.StateChannelInfos) {
expect(Object.keys(infos).length).toEqual(1);
const info = infos[UNUSED_FUNDED_ACCOUNT];
expect(info.counterParty).toEqual(B_ADDRESS);
expect(info.me).toEqual(A_ADDRESS);
expect(Object.keys(info.appInstances).length).toEqual(0);
expect(info.freeBalance.alice).toEqual(A_ADDRESS);
expect(info.freeBalance.aliceBalance.toNumber()).toEqual(0);
expect(info.freeBalance.bob).toEqual(B_ADDRESS);
expect(info.freeBalance.bobBalance.toNumber()).toEqual(0);
expect(info.freeBalance.localNonce).toEqual(0);
expect(info.freeBalance.uniqueId).toEqual(0);
const expectedSalt = ethers.utils.solidityKeccak256(["uint256"], [0]);
expect(info.freeBalance.dependencyNonce.nonceValue).toEqual(0);
expect(info.freeBalance.dependencyNonce.salt).toEqual(expectedSalt);
}
示例4:
const computeHash = (stateHash: string, nonce: number, timeout: number) =>
ethers.utils.solidityKeccak256(
["bytes1", "address[]", "uint256", "uint256", "bytes32"],
["0x19", [A.address, B.address], nonce, timeout, stateHash]
);
示例5:
const keccak256 = (bytes: string) =>
ethers.utils.solidityKeccak256(["bytes"], [bytes]);
示例6: computeCommitHash
/// Returns the commit hash that can be used to commit to chosenNumber
/// using appSalt
function computeCommitHash(appSalt: string, chosenNumber: number) {
return ethers.utils.solidityKeccak256(
["bytes32", "uint256"],
[appSalt, chosenNumber]
);
}
示例7: cfaddress
function cfaddress(initcode, i) {
return ethers.utils.solidityKeccak256(
["bytes1", "bytes", "uint256"],
["0x19", initcode, i]
);
}
示例8:
const computeKey = (timeout: ethers.utils.BigNumber, salt: string) =>
ethers.utils.solidityKeccak256(
["address", "uint256", "bytes32"],
[accounts[0], timeout, salt]
);