Skip to content

Commit

Permalink
feat: stabilize 6492 (#2424)
Browse files Browse the repository at this point in the history
* feat: stabilize 6492

* docs

* fix

* Update thin-yaks-attend.md
  • Loading branch information
jxom authored Jun 18, 2024
1 parent 7a646fc commit 4b92979
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 29 deletions.
11 changes: 11 additions & 0 deletions .changeset/thin-yaks-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"viem": minor
---

Stabilized ERC-6492 utilities:

- `isErc6492Signature`
- `parseErc6492Signature`
- `serializeErc6492Signature`

These utilities are no longer experimental, and can be imported from the `viem` entrypoint.
34 changes: 12 additions & 22 deletions site/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,10 +936,18 @@ export const sidebar = {
text: 'hashTypedData',
link: '/docs/utilities/hashTypedData',
},
{
text: 'isErc6492Signature',
link: '/docs/utilities/isErc6492Signature',
},
{
text: 'parseCompactSignature',
link: '/docs/utilities/parseCompactSignature',
},
{
text: 'parseErc6492Signature',
link: '/docs/utilities/parseErc6492Signature',
},
{
text: 'parseSignature',
link: '/docs/utilities/parseSignature',
Expand Down Expand Up @@ -968,6 +976,10 @@ export const sidebar = {
text: 'serializeCompactSignature',
link: '/docs/utilities/serializeCompactSignature',
},
{
text: 'serializeErc6492Signature',
link: '/docs/utilities/serializeErc6492Signature',
},
{
text: 'serializeSignature',
link: '/docs/utilities/serializeSignature',
Expand Down Expand Up @@ -1097,28 +1109,6 @@ export const sidebar = {
},
],
},
{
text: 'ERC-6492',
items: [
{
text: 'Utilities',
items: [
{
text: 'parseErc6492Signature',
link: '/experimental/erc6492/parseErc6492Signature',
},
{
text: 'isErc6492Signature',
link: '/experimental/erc6492/isErc6492Signature',
},
{
text: 'serializeErc6492Signature',
link: '/experimental/erc6492/serializeErc6492Signature',
},
],
},
],
},
{
text: 'ERC-7715',
items: [
Expand Down
18 changes: 15 additions & 3 deletions src/experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,35 @@ export {
} from './eip5792/decorators/eip5792.js'

export {
/** @deprecated This is no longer experimental – use `import type { ParseErc6492SignatureErrorType } from 'viem'` instead. */
type ParseErc6492SignatureErrorType,
/** @deprecated This is no longer experimental – use `import type { ParseErc6492SignatureParameters } from 'viem'` instead. */
type ParseErc6492SignatureParameters,
/** @deprecated This is no longer experimental – use `import type { ParseErc6492SignatureReturnType } from 'viem'` instead. */
type ParseErc6492SignatureReturnType,
/** @deprecated This is no longer experimental – use `import { parseErc6492Signature } from 'viem'` instead. */
parseErc6492Signature,
} from './erc6492/parseErc6492Signature.js'
} from '../utils/signature/parseErc6492Signature.js'
export {
/** @deprecated This is no longer experimental – use `import type { IsErc6492SignatureErrorType } from 'viem'` instead. */
type IsErc6492SignatureErrorType,
/** @deprecated This is no longer experimental – use `import type { IsErc6492SignatureParameters } from 'viem'` instead. */
type IsErc6492SignatureParameters,
/** @deprecated This is no longer experimental – use `import type { IsErc6492SignatureReturnType } from 'viem'` instead. */
type IsErc6492SignatureReturnType,
/** @deprecated This is no longer experimental – use `import { isErc6492Signature } from 'viem'` instead. */
isErc6492Signature,
} from './erc6492/isErc6492Signature.js'
} from '../utils/signature/isErc6492Signature.js'
export {
/** @deprecated This is no longer experimental – use `import type { SerializeErc6492SignatureErrorType } from 'viem'` instead. */
type SerializeErc6492SignatureErrorType,
/** @deprecated This is no longer experimental – use `import type { SerializeErc6492SignatureParameters } from 'viem'` instead. */
type SerializeErc6492SignatureParameters,
/** @deprecated This is no longer experimental – use `import type { SerializeErc6492SignatureReturnType } from 'viem'` instead. */
type SerializeErc6492SignatureReturnType,
/** @deprecated This is no longer experimental – use `import { serializeErc6492Signature } from 'viem'` instead. */
serializeErc6492Signature,
} from './erc6492/serializeErc6492Signature.js'
} from '../utils/signature/serializeErc6492Signature.js'

export {
type IssuePermissionsParameters,
Expand Down
3 changes: 3 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ test('exports', () => {
"toRlp",
"verifyMessage",
"verifyTypedData",
"parseErc6492Signature",
"isErc6492Signature",
"serializeErc6492Signature",
"assertRequest",
"assertTransactionEIP1559",
"assertTransactionEIP2930",
Expand Down
18 changes: 18 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,24 @@ export {
type VerifyTypedDataReturnType,
verifyTypedData,
} from './utils/signature/verifyTypedData.js'
export {
type ParseErc6492SignatureErrorType,
type ParseErc6492SignatureParameters,
type ParseErc6492SignatureReturnType,
parseErc6492Signature,
} from './utils/signature/parseErc6492Signature.js'
export {
type IsErc6492SignatureErrorType,
type IsErc6492SignatureParameters,
type IsErc6492SignatureReturnType,
isErc6492Signature,
} from './utils/signature/isErc6492Signature.js'
export {
type SerializeErc6492SignatureErrorType,
type SerializeErc6492SignatureParameters,
type SerializeErc6492SignatureReturnType,
serializeErc6492Signature,
} from './utils/signature/serializeErc6492Signature.js'
export {
type AssertRequestErrorType,
assertRequest,
Expand Down
3 changes: 3 additions & 0 deletions src/utils/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ test('exports utils', () => {
"verifyMessage",
"verifyTypedData",
"hashMessage",
"parseErc6492Signature",
"isErc6492Signature",
"serializeErc6492Signature",
"getSerializedTransactionType",
"getTransactionType",
"assertRequest",
Expand Down
18 changes: 18 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,24 @@ export {
type HashMessageErrorType,
hashMessage,
} from './signature/hashMessage.js'
export {
type ParseErc6492SignatureErrorType,
type ParseErc6492SignatureParameters,
type ParseErc6492SignatureReturnType,
parseErc6492Signature,
} from './signature/parseErc6492Signature.js'
export {
type IsErc6492SignatureErrorType,
type IsErc6492SignatureParameters,
type IsErc6492SignatureReturnType,
isErc6492Signature,
} from './signature/isErc6492Signature.js'
export {
type SerializeErc6492SignatureErrorType,
type SerializeErc6492SignatureParameters,
type SerializeErc6492SignatureReturnType,
serializeErc6492Signature,
} from './signature/serializeErc6492Signature.js'
export {
type GetSerializedTransactionTypeErrorType,
type GetSerializedTransactionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { erc6492MagicBytes } from '../../constants/bytes.js'
import type { ErrorType } from '../../errors/utils.js'
import type { Hex } from '../../types/misc.js'
import { type SliceHexErrorType, sliceHex } from '../../utils/data/slice.js'
import { type SliceHexErrorType, sliceHex } from '../data/slice.js'

export type IsErc6492SignatureParameters = Hex
export type IsErc6492SignatureReturnType = boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { OneOf, Prettify } from '../../types/utils.js'
import {
type DecodeAbiParametersErrorType,
decodeAbiParameters,
} from '../../utils/abi/decodeAbiParameters.js'
} from '../abi/decodeAbiParameters.js'
import {
type IsErc6492SignatureErrorType,
isErc6492Signature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { Address } from 'abitype'
import { erc6492MagicBytes } from '../../constants/bytes.js'
import type { ErrorType } from '../../errors/utils.js'
import type { Hex } from '../../types/misc.js'
import { encodeAbiParameters } from '../../utils/abi/encodeAbiParameters.js'
import { concatHex } from '../../utils/data/concat.js'
import { encodeAbiParameters } from '../abi/encodeAbiParameters.js'
import { concatHex } from '../data/concat.js'

export type SerializeErc6492SignatureParameters = {
/** The ERC-4337 Account Factory address to use for counterfactual verification. */
Expand Down

0 comments on commit 4b92979

Please sign in to comment.