Add Bytes32x2Set (#5442)

Co-authored-by: Ernesto García <ernestognw@gmail.com>
This commit is contained in:
Hadrien Croubois
2025-02-04 20:30:53 +01:00
committed by GitHub
parent 2141d3faf5
commit 441dc141ac
7 changed files with 261 additions and 12 deletions

View File

@ -1,12 +1,16 @@
const { capitalize } = require('../../helpers');
const mapType = str => (str == 'uint256' ? 'Uint' : capitalize(str));
const mapType = ({ type, size }) => [type == 'uint256' ? 'Uint' : capitalize(type), size].filter(Boolean).join('x');
const formatType = type => ({
name: `${mapType(type)}Set`,
type,
const formatType = ({ type, size = undefined }) => ({
name: `${mapType({ type, size })}Set`,
type: size != undefined ? `${type}[${size}]` : type,
base: size != undefined ? type : undefined,
size,
});
const TYPES = ['bytes32', 'address', 'uint256'].map(formatType);
const TYPES = [{ type: 'bytes32' }, { type: 'bytes32', size: 2 }, { type: 'address' }, { type: 'uint256' }].map(
formatType,
);
module.exports = { TYPES, formatType };