eip712-types.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. OverrideBallot: {
  34. proposalId: 'uint256',
  35. support: 'uint8',
  36. voter: 'address',
  37. nonce: 'uint256',
  38. reason: 'string',
  39. },
  40. Delegation: {
  41. delegatee: 'address',
  42. nonce: 'uint256',
  43. expiry: 'uint256',
  44. },
  45. ForwardRequest: {
  46. from: 'address',
  47. to: 'address',
  48. value: 'uint256',
  49. gas: 'uint256',
  50. nonce: 'uint256',
  51. deadline: 'uint48',
  52. data: 'bytes',
  53. },
  54. },
  55. formatType,
  56. );
  57. module.exports.formatType = formatType;