ethers-typed-data
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Ethers Typed Data

Signs typed data as per an extension of the published version of EIP 712.

Installation

npm install ethers-typed-data --save

Usage

import { buildTypedData, hashTypedData } from 'ethers-typed-data';
 
const typedData = buildTypedData(
  {
    name: 'test',
  },
  'Bid',
  {
    Identity: [
      { type: 'uint256', name: 'userId' },
      { type: 'address', name: 'wallet' },
    ],
    Bid: [
      { type: 'uint256', name: 'amount' },
      { type: 'Identity', name: 'bidder' },
    ],
  },
  {
    amount: 100,
    bidder: {
      userId: 10,
      wallet: '0xEEb4801FBc9781EEF20801853C1Cb25faB8A7a3b',
    },
  },
);
 
console.log('typed data:', typedData);
 
const hash = hashTypedData(typedData);
 
console.log('typed data hash:', hash);

License

MIT License.

Dependents (3)

Package Sidebar

Install

npm i ethers-typed-data

Weekly Downloads

5

Version

0.1.0

License

MIT

Unpacked Size

12.1 kB

Total Files

15

Last publish

Collaborators

  • staszek
  • jegorsidorenko