https://github.com/hazae41/eip712
EIP-712 encoding for the web
https://github.com/hazae41/eip712
Last synced: about 1 month ago
JSON representation
EIP-712 encoding for the web
- Host: GitHub
- URL: https://github.com/hazae41/eip712
- Owner: hazae41
- License: mit
- Created: 2026-06-10T06:08:46.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-10T09:38:37.000Z (about 2 months ago)
- Last Synced: 2026-06-10T11:21:29.201Z (about 2 months ago)
- Language: TypeScript
- Size: 12.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
- awesome-ccamel - hazae41/eip712 - EIP-712 encoding for the web (TypeScript)
README
# EIP-712: Typed structured data hashing and signing
EIP-712 encoding for the web
```bash
npm install @hazae41/eip712
```
[**📦 NPM**](https://www.npmjs.com/package/@hazae41/eip712)
## Features
### Current features
- 100% TypeScript and ESM
- No external dependencies
- Rust-like patterns
## Usage
### Hashing
```tsx
const hash: Uint8Array = eip712.hash({
types: {
EIP712Domain: [
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "chainId", type: "uint256" },
{ name: "verifyingContract", type: "address" },
],
Person: [
{ name: "name", type: "string" },
{ name: "wallet", type: "address" }
],
Mail: [
{ name: "from", type: "Person" },
{ name: "to", type: "Person" },
{ name: "contents", type: "string" }
],
},
primaryType: "Mail",
domain: {
name: "Ether Mail",
version: "1",
chainId: 1n,
verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
},
message: {
from: {
name: "Cow",
wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
},
to: {
name: "Bob",
wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
},
contents: "Hello, Bob!",
},
})
```