Skip to content

What is the equivalent of ethers.utils.splitSignature in viem? #458

Closed Answered by jxom
bigint asked this question in Question
Discussion options

You must be logged in to vote
import { secp256k1 } from '@noble/curves/secp256k1'

const signatureHex = '0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c'
const { r, s } = secp256k1.Signature.fromCompact(signatureHex.slice(2, 130))
const v = hexToNumber(`0x${signatureHex.slice(130)}`)

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@bigint
Comment options

@jxom
Comment options

jxom May 8, 2023
Maintainer

Answer selected by bigint
@jxom
Comment options

jxom May 8, 2023
Maintainer

@dalechyn
Comment options

@dalechyn
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants