viem 1.10.14 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -2
- package/_cjs/chains/definitions/optimismSepolia.js +39 -0
- package/_cjs/chains/definitions/optimismSepolia.js.map +1 -0
- package/_cjs/chains/index.js +4 -2
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/index.js +5 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/hash/getEventSelector.js +5 -6
- package/_cjs/utils/hash/getEventSelector.js.map +1 -1
- package/_cjs/utils/hash/getEventSignature.js +9 -0
- package/_cjs/utils/hash/getEventSignature.js.map +1 -0
- package/_cjs/utils/hash/getFunctionSelector.js +5 -6
- package/_cjs/utils/hash/getFunctionSelector.js.map +1 -1
- package/_cjs/utils/hash/getFunctionSignature.js +15 -0
- package/_cjs/utils/hash/getFunctionSignature.js.map +1 -0
- package/_cjs/utils/hash/hashFunction.js +2 -4
- package/_cjs/utils/hash/hashFunction.js.map +1 -1
- package/_esm/chains/definitions/optimismSepolia.js +36 -0
- package/_esm/chains/definitions/optimismSepolia.js.map +1 -0
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/index.js +2 -0
- package/_esm/index.js.map +1 -1
- package/_esm/utils/hash/getEventSelector.js +5 -6
- package/_esm/utils/hash/getEventSelector.js.map +1 -1
- package/_esm/utils/hash/getEventSignature.js +5 -0
- package/_esm/utils/hash/getEventSignature.js.map +1 -0
- package/_esm/utils/hash/getFunctionSelector.js +5 -6
- package/_esm/utils/hash/getFunctionSelector.js.map +1 -1
- package/_esm/utils/hash/getFunctionSignature.js +11 -0
- package/_esm/utils/hash/getFunctionSignature.js.map +1 -0
- package/_esm/utils/hash/hashFunction.js +2 -4
- package/_esm/utils/hash/hashFunction.js.map +1 -1
- package/_types/chains/definitions/optimismSepolia.d.ts +331 -0
- package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -0
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/index.d.ts +2 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/utils/hash/getEventSelector.d.ts +1 -2
- package/_types/utils/hash/getEventSelector.d.ts.map +1 -1
- package/_types/utils/hash/getEventSignature.d.ts +3 -0
- package/_types/utils/hash/getEventSignature.d.ts.map +1 -0
- package/_types/utils/hash/getFunctionSelector.d.ts.map +1 -1
- package/_types/utils/hash/getFunctionSignature.d.ts +3 -0
- package/_types/utils/hash/getFunctionSignature.d.ts.map +1 -0
- package/_types/utils/hash/hashFunction.d.ts.map +1 -1
- package/chains/definitions/optimismSepolia.ts +39 -0
- package/chains/index.ts +1 -0
- package/index.ts +2 -0
- package/package.json +1 -1
- package/utils/hash/getEventSelector.ts +7 -6
- package/utils/hash/getEventSignature.ts +7 -0
- package/utils/hash/getFunctionSelector.ts +7 -5
- package/utils/hash/getFunctionSignature.ts +17 -0
- package/utils/hash/hashFunction.ts +2 -7
| @@ -1,19 +1,14 @@ | |
| 1 1 | 
             
            import type { AbiEvent, AbiFunction } from 'abitype'
         | 
| 2 2 | 
             
            import { formatAbiItem } from '../abi/formatAbiItem.js'
         | 
| 3 | 
            -
            import {
         | 
| 4 | 
            -
              extractFunctionName,
         | 
| 5 | 
            -
              extractFunctionParams,
         | 
| 6 | 
            -
            } from '../contract/extractFunctionParts.js'
         | 
| 7 3 | 
             
            import { toBytes } from '../encoding/toBytes.js'
         | 
| 8 4 |  | 
| 5 | 
            +
            import { getFunctionSignature } from './getFunctionSignature.js'
         | 
| 9 6 | 
             
            import { keccak256 } from './keccak256.js'
         | 
| 10 7 |  | 
| 11 8 | 
             
            const hash = (value: string) => keccak256(toBytes(value))
         | 
| 12 9 |  | 
| 13 10 | 
             
            export function hashFunction(def: string) {
         | 
| 14 | 
            -
               | 
| 15 | 
            -
              const params = extractFunctionParams(def) || []
         | 
| 16 | 
            -
              return hash(`${name}(${params.map(({ type }) => type).join(',')})`)
         | 
| 11 | 
            +
              return hash(getFunctionSignature(def))
         | 
| 17 12 | 
             
            }
         | 
| 18 13 |  | 
| 19 14 | 
             
            export function hashAbiItem(abiItem: AbiFunction | AbiEvent) {
         |