Add Bytes32x2Set (#5442)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
This commit is contained in:
@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user