Skip to content

Commit

Permalink
feat: made salt mandatory on ERC-7739 verifierDomain
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Dec 29, 2024
1 parent 368dac0 commit 7148e47
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-shoes-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

**Experimental (ERC-7739):** Added `salt` as a mandatory field of `verifierDomain`.
7 changes: 4 additions & 3 deletions site/pages/experimental/erc7739/hashTypedData.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Hashes [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data via [ERC-773
## Import

```ts
import { hashTypedData } from 'viem/experimental/solady'
import { hashTypedData } from 'viem/experimental/erc7739'
```

## Usage

```ts
import { hashTypedData } from 'viem/experimental/solady'
import { hashTypedData } from 'viem/experimental/erc7739'

hashTypedData({
domain: {
Expand Down Expand Up @@ -50,10 +50,11 @@ hashTypedData({
extensions: [],
fields: '0x0f',
verifierDomain: {
chainId: 1,
name: 'Smart Account',
salt: '0x0000000000000000000000000000000000000000000000000000000000000000',
version: '1',
verifyingContract: '0x1234567890abcdef1234567890abcdef12345678',
chainId: 1,
},
})
```
Expand Down
2 changes: 1 addition & 1 deletion src/actions/public/getEip712Domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type GetEip712DomainParameters = {
export type GetEip712DomainReturnType = {
domain: RequiredBy<
TypedDataDomain,
'chainId' | 'name' | 'verifyingContract' | 'version'
'chainId' | 'name' | 'verifyingContract' | 'salt' | 'version'
>
fields: Hex
extensions: readonly bigint[]
Expand Down
2 changes: 1 addition & 1 deletion src/experimental/erc7739/utils/hashTypedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type HashTypedDataParameters<
> = TypedDataDefinition<typedData, primaryType, primaryTypes> & {
verifierDomain: RequiredBy<
TypedDataDomain,
'chainId' | 'name' | 'verifyingContract' | 'version'
'chainId' | 'name' | 'verifyingContract' | 'salt' | 'version'
>
}

Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"chains/utils": ["./_types/chains/utils.d.ts"],
"ens": ["./_types/ens/index.d.ts"],
"experimental": ["./_types/experimental/index.d.ts"],
"experimental/solady": ["./_types/experimental/solady/index.d.ts"],
"experimental/erc7739": ["./_types/experimental/erc7739/index.d.ts"],
"node": ["./_types/node/index.d.ts"],
"op-stack": ["./_types/op-stack/index.d.ts"],
"siwe": ["./_types/siwe/index.d.ts"],
Expand Down

0 comments on commit 7148e47

Please sign in to comment.