当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ethers.utils.solidityKeccak256方法代码示例

本文整理汇总了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
 });
开发者ID:cylof22,项目名称:monorepo,代码行数:10,代码来源:conditional.spec.ts

示例2:

 const makeConditionParam = (expectedValue, parameters) => ({
   parameters,
   expectedValueHash: ethers.utils.solidityKeccak256(
     ["bytes"],
     [expectedValue]
   ),
   onlyCheckForSuccess: false,
   selector: testCondition.interface.functions.isSatisfiedParam.sighash,
   to: testCondition.address
 });
开发者ID:cylof22,项目名称:monorepo,代码行数:10,代码来源:conditionalTransaction.spec.ts

示例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);
}
开发者ID:cylof22,项目名称:monorepo,代码行数:18,代码来源:state-transition.spec.ts

示例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]
  );
开发者ID:cylof22,项目名称:monorepo,代码行数:5,代码来源:appInstance.spec.ts

示例5:

 const keccak256 = (bytes: string) =>
   ethers.utils.solidityKeccak256(["bytes"], [bytes]);
开发者ID:cylof22,项目名称:monorepo,代码行数:2,代码来源:twoPartyPayments.spec.ts

示例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]
  );
}
开发者ID:cylof22,项目名称:monorepo,代码行数:8,代码来源:commitReveal.spec.ts

示例7: cfaddress

 function cfaddress(initcode, i) {
   return ethers.utils.solidityKeccak256(
     ["bytes1", "bytes", "uint256"],
     ["0x19", initcode, i]
   );
 }
开发者ID:cylof22,项目名称:monorepo,代码行数:6,代码来源:registry.spec.ts

示例8:

 const computeKey = (timeout: ethers.utils.BigNumber, salt: string) =>
   ethers.utils.solidityKeccak256(
     ["address", "uint256", "bytes32"],
     [accounts[0], timeout, salt]
   );
开发者ID:cylof22,项目名称:monorepo,代码行数:5,代码来源:nonceRegistry.spec.ts


注:本文中的ethers.ethers.utils.solidityKeccak256方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。