當前位置: 首頁>>代碼示例>>Python>>正文


Python Web3.soliditySha3方法代碼示例

本文整理匯總了Python中web3.Web3.soliditySha3方法的典型用法代碼示例。如果您正苦於以下問題:Python Web3.soliditySha3方法的具體用法?Python Web3.soliditySha3怎麽用?Python Web3.soliditySha3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在web3.Web3的用法示例。


在下文中一共展示了Web3.soliditySha3方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_soliditySha3_ens

# 需要導入模塊: from web3 import Web3 [as 別名]
# 或者: from web3.Web3 import soliditySha3 [as 別名]
    def test_soliditySha3_ens(self, web3, types, values, expected):
        with ens_addresses(web3, {
            'one.eth': "0x49EdDD3769c0712032808D86597B84ac5c2F5614",
            'two.eth': "0xA6b759bBbf4B59D24acf7E06e79f3a5D104fdCE5",
        }):
            # when called as class method, any name lookup attempt will fail
            with pytest.raises(InvalidAddress):
                Web3.soliditySha3(types, values)

            # when called as instance method method, ens lookups can succeed
            actual = web3.soliditySha3(types, values)
            assert actual == expected
開發者ID:syngraph,項目名稱:web3.py,代碼行數:14,代碼來源:web3_module.py

示例2: hash_balance_data

# 需要導入模塊: from web3 import Web3 [as 別名]
# 或者: from web3.Web3 import soliditySha3 [as 別名]
def hash_balance_data(
        transferred_amount: typing.TokenAmount,
        locked_amount: typing.TokenAmount,
        locksroot: typing.Locksroot,
) -> str:
    return Web3.soliditySha3(
        ['uint256', 'uint256', 'bytes32'],
        [transferred_amount, locked_amount, locksroot],
    )
開發者ID:AlphaX-IBS,項目名稱:raiden,代碼行數:11,代碼來源:utils.py

示例3: hash_balance_data

# 需要導入模塊: from web3 import Web3 [as 別名]
# 或者: from web3.Web3 import soliditySha3 [as 別名]
def hash_balance_data(
        transferred_amount: TokenAmount,
        locked_amount: TokenAmount,
        locksroot: Locksroot,
) -> bytes:
    assert locksroot != b''
    assert len(locksroot) == 32
    if transferred_amount == 0 and locked_amount == 0 and locksroot == EMPTY_HASH:
        return EMPTY_HASH

    return Web3.soliditySha3(  # pylint: disable=no-value-for-parameter
        ['uint256', 'uint256', 'bytes32'],
        [transferred_amount, locked_amount, locksroot],
    )
開發者ID:hackaugusto,項目名稱:raiden,代碼行數:16,代碼來源:utils.py


注:本文中的web3.Web3.soliditySha3方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。