Skip to content

WrappedSignature

Utility functions for working with ERC-6492 wrapped signatures.

Examples

import { Secp256k1, PersonalMessage } from 'ox'
import { WrappedSignature } from 'ox/erc6492'
 
const signature = Secp256k1.sign({
  payload: PersonalMessage.getSignPayload('0xdeadbeef'),
  privateKey: '0x...',
})
 
const wrapped = WrappedSignature.toHex({ 
  data: '0xcafebabe', 
  signature, 
  to: '0xcafebabecafebabecafebabecafebabecafebabe', 
})
'0x000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041fa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d01c000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492'

Functions

NameDescription
WrappedSignature.assertAsserts that the wrapped signature is valid.
WrappedSignature.fromParses an ERC-6492 wrapped signature into its constituent parts.
WrappedSignature.fromHexParses an ERC-6492 wrapped signature into its constituent parts.
WrappedSignature.toHexSerializes an ERC-6492 wrapped signature.
WrappedSignature.validateValidates a wrapped signature. Returns true if the wrapped signature is valid, false otherwise.

Errors

NameDescription
WrappedSignature.InvalidWrappedSignatureErrorThrown when the ERC-6492 wrapped signature is invalid.

Types

NameDescription
WrappedSignature.WrappedSignatureERC-6492 Wrapped Signature.