eip712-types.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const { mapValues } = require('./iterate');
  2. const formatType = schema => Object.entries(schema).map(([name, type]) => ({ name, type }));
  3. module.exports = mapValues(
  4. {
  5. EIP712Domain: {
  6. name: 'string',
  7. version: 'string',
  8. chainId: 'uint256',
  9. verifyingContract: 'address',
  10. salt: 'bytes32',
  11. },
  12. Permit: {
  13. owner: 'address',
  14. spender: 'address',
  15. value: 'uint256',
  16. nonce: 'uint256',
  17. deadline: 'uint256',
  18. },
  19. Ballot: {
  20. proposalId: 'uint256',
  21. support: 'uint8',
  22. voter: 'address',
  23. nonce: 'uint256',
  24. },
  25. ExtendedBallot: {
  26. proposalId: 'uint256',
  27. support: 'uint8',
  28. voter: 'address',
  29. nonce: 'uint256',
  30. reason: 'string',
  31. params: 'bytes',
  32. },
  33. Delegation: {
  34. delegatee: 'address',
  35. nonce: 'uint256',
  36. expiry: 'uint256',
  37. },
  38. ForwardRequest: {
  39. from: 'address',
  40. to: 'address',
  41. value: 'uint256',
  42. gas: 'uint256',
  43. nonce: 'uint256',
  44. deadline: 'uint48',
  45. data: 'bytes',
  46. },
  47. },
  48. formatType,
  49. );
  50. module.exports.formatType = formatType;