eip712-types.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: { owner: 'address', spender: 'address', value: 'uint256', nonce: 'uint256', deadline: 'uint256' },
  13. Ballot: { proposalId: 'uint256', support: 'uint8', voter: 'address', nonce: 'uint256' },
  14. ExtendedBallot: {
  15. proposalId: 'uint256',
  16. support: 'uint8',
  17. voter: 'address',
  18. nonce: 'uint256',
  19. reason: 'string',
  20. params: 'bytes',
  21. },
  22. OverrideBallot: { proposalId: 'uint256', support: 'uint8', voter: 'address', nonce: 'uint256', reason: 'string' },
  23. Delegation: { delegatee: 'address', nonce: 'uint256', expiry: 'uint256' },
  24. ForwardRequest: {
  25. from: 'address',
  26. to: 'address',
  27. value: 'uint256',
  28. gas: 'uint256',
  29. nonce: 'uint256',
  30. deadline: 'uint48',
  31. data: 'bytes',
  32. },
  33. PackedUserOperation: {
  34. sender: 'address',
  35. nonce: 'uint256',
  36. initCode: 'bytes',
  37. callData: 'bytes',
  38. accountGasLimits: 'bytes32',
  39. preVerificationGas: 'uint256',
  40. gasFees: 'bytes32',
  41. paymasterAndData: 'bytes',
  42. },
  43. UserOperationRequest: {
  44. sender: 'address',
  45. nonce: 'uint256',
  46. initCode: 'bytes',
  47. callData: 'bytes',
  48. accountGasLimits: 'bytes32',
  49. preVerificationGas: 'uint256',
  50. gasFees: 'bytes32',
  51. paymasterVerificationGasLimit: 'uint256',
  52. paymasterPostOpGasLimit: 'uint256',
  53. validAfter: 'uint48',
  54. validUntil: 'uint48',
  55. },
  56. },
  57. formatType,
  58. );
  59. module.exports.formatType = formatType;